tide-commander 1.41.0 → 1.43.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.
Files changed (47) hide show
  1. package/dist/assets/{BossLogsModal-gE17BBT9.js → BossLogsModal-CnIyv0O7.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-SPvzti1i.js → BossSpawnModal-C5JHnXoV.js} +1 -1
  3. package/dist/assets/{ControlsModal-A489_yUU.js → ControlsModal-DJ6kwJQg.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-Bexhv2Eo.js → DockerLogsModal-wLLPPw3N.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-BdrKX9Ef.js → EmbeddedEditor-BZUBqqzE.js} +1 -1
  6. package/dist/assets/{GmailOAuthSetup-BRDLCsnz.js → GmailOAuthSetup-DU-rYgPc.js} +1 -1
  7. package/dist/assets/{GoogleOAuthSetup-8tWGRN1a.js → GoogleOAuthSetup-DUG794k5.js} +1 -1
  8. package/dist/assets/{IframeModal-AIthNZLG.js → IframeModal-BEaeYao1.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-D4rlShHL.js → IntegrationsPanel-CrT3G7gD.js} +2 -2
  10. package/dist/assets/{LogViewerModal-CWASeq5k.js → LogViewerModal-pmKvg2_3.js} +1 -1
  11. package/dist/assets/{MonitoringModal-GCxQ22tf.js → MonitoringModal-BopLTYX0.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-BFJ1_6O0.js → PM2LogsModal-akdCsnNY.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-BtuMbJVE.js → RestoreArchivedAreaModal-BAe0BLNN.js} +1 -1
  14. package/dist/assets/{SaveSnapshotModal-BUn9mntc.js → SaveSnapshotModal-CCK5ncy-.js} +1 -1
  15. package/dist/assets/{Scene2DCanvas-CToncCYk.js → Scene2DCanvas-CTrNCLiT.js} +1 -1
  16. package/dist/assets/{SceneManager-BivL9Mu6.js → SceneManager-WQvF4y8-.js} +1 -1
  17. package/dist/assets/{SkillsPanel-IE07LIWC.js → SkillsPanel-BpY-jIMP.js} +1 -1
  18. package/dist/assets/{SnapshotManager-Cs7fZ_aA.js → SnapshotManager-DlJQAEC-.js} +1 -1
  19. package/dist/assets/SpawnModal-Ci_uvH1F.js +1 -0
  20. package/dist/assets/{SubordinateAssignmentModal-DdANoM7g.js → SubordinateAssignmentModal-kFDllrhg.js} +1 -1
  21. package/dist/assets/{SupervisorPanel-CE7sMgHN.js → SupervisorPanel-CPyoCa6i.js} +1 -1
  22. package/dist/assets/{TriggerManagerPanel-Cyb1Sf8s.js → TriggerManagerPanel-B7qEVCh4.js} +1 -1
  23. package/dist/assets/{WorkflowEditorPanel-BM9nnUIT.js → WorkflowEditorPanel-D8FwpAyj.js} +1 -1
  24. package/dist/assets/{index-CvetF6vL.js → index-BWCjlz0C.js} +3 -3
  25. package/dist/assets/{index-DESPWRkl.js → index-Bu3B9Eke.js} +2 -2
  26. package/dist/assets/{index-DahUmubU.js → index-C5IJ99Dq.js} +1 -1
  27. package/dist/assets/{index-Ez0uF12M.js → index-CRD8TN18.js} +1 -1
  28. package/dist/assets/{index-bXLSkGdM.js → index-CjH90tsj.js} +1 -1
  29. package/dist/assets/{index-DlFukYeW.js → index-DkhEv4qN.js} +1 -1
  30. package/dist/assets/{index-B_0CIcus.js → index-M90uUgxL.js} +1 -1
  31. package/dist/assets/{index-dnQQyjiL.js → index-OOJWJ_4Z.js} +1 -1
  32. package/dist/assets/{main-CVYa_fKP.css → main-Chjl2UXl.css} +1 -1
  33. package/dist/assets/main-DB67UbmQ.js +153 -0
  34. package/dist/assets/{web-CwCZTch8.js → web-D4vvRMYa.js} +1 -1
  35. package/dist/assets/{web-DGZ9VJ1o.js → web-DRj84zWD.js} +1 -1
  36. package/dist/index.html +2 -2
  37. package/dist/src/packages/server/data/builtin-skills/agent-tracking.js +48 -0
  38. package/dist/src/packages/server/data/builtin-skills/boss-instructions.js +75 -129
  39. package/dist/src/packages/server/data/builtin-skills/index.js +2 -0
  40. package/dist/src/packages/server/routes/agents.js +21 -0
  41. package/dist/src/packages/server/services/agent-service.js +26 -11
  42. package/dist/src/packages/server/services/boss-message-service.js +1 -1
  43. package/dist/src/packages/server/services/skill-service.js +4 -1
  44. package/dist/src/packages/server/websocket/handlers/agent-handler.js +3 -0
  45. package/package.json +1 -1
  46. package/dist/assets/SpawnModal-DbfTe3y2.js +0 -1
  47. package/dist/assets/main-BL6u5aPD.js +0 -153
@@ -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-Bu3B9Eke.js","assets/modulepreload-polyfill-B5Qt9EMX.js","assets/vendor-three-Chj50gSY.js","assets/web-D4vvRMYa.js","assets/SceneManager-WQvF4y8-.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-Ci_uvH1F.js","assets/BossSpawnModal-C5JHnXoV.js","assets/SubordinateAssignmentModal-kFDllrhg.js","assets/index-OOJWJ_4Z.js","assets/index-Bykeknjl.css","assets/index-CRD8TN18.js","assets/index-DkhEv4qN.js","assets/index-BWCjlz0C.js","assets/SupervisorPanel-CPyoCa6i.js","assets/index-M90uUgxL.js","assets/ControlsModal-DJ6kwJQg.js","assets/SkillsPanel-BpY-jIMP.js","assets/SnapshotManager-DlJQAEC-.js","assets/RestoreArchivedAreaModal-BAe0BLNN.js","assets/IntegrationsPanel-CrT3G7gD.js","assets/MonitoringModal-BopLTYX0.js","assets/WorkflowEditorPanel-D8FwpAyj.js","assets/TriggerManagerPanel-B7qEVCh4.js","assets/index-C5IJ99Dq.js","assets/index-CprCD9du.css","assets/PM2LogsModal-akdCsnNY.js","assets/LogViewerModal-pmKvg2_3.js","assets/DockerLogsModal-wLLPPw3N.js","assets/BossLogsModal-CnIyv0O7.js","assets/Scene2DCanvas-CTrNCLiT.js","assets/Scene2DCanvas-DwXbvB-b.css","assets/index-CjH90tsj.js","assets/index-BZyCMBzi.css","assets/IframeModal-BEaeYao1.js","assets/IframeModal-DJkCGwT6.css","assets/SaveSnapshotModal-CCK5ncy-.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 Ze=(t,e,n)=>ME(t,typeof e!="symbol"?e+"":e,n);import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as Yb,g as ju,a as LA,c as D0}from"./vendor-react--Eh9ivFN.js";import{T as DE,a as nb,b as PA,L as IA,c as Zc,F as Rf,M as ar,V as BA,C as Pr,d as sr,S as Mr,e as RE,P as OE,D as sb,f as Of,g as ao,I as LE,Q as FA,h as PE,O as zA,i as IE,j as BE,B as eu,k as FE,l as $A,N as zE,m as $E,n as HE,o as ab,p as HA,R as rb,q as UE,r as WE,s as qE,t as wf,u as VE,v as Kb,w as UA,x as pl,y as GE,z as WA,A as YE,E as ul,G as KE,H as QE,J as XE,K as JE,U as Fm,W as qA,X as ZE,Y as eM,Z as tM,_ as nM,$ as sM,a0 as aM,a1 as VA,a2 as rM,a3 as R0,a4 as O0,a5 as L0,a6 as P0,a7 as ib,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 zm={exports:{}},Nc={};/**
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 I0;function yM(){if(I0)return Nc;I0=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 Nc.Fragment=e,Nc.jsx=n,Nc.jsxs=n,Nc}var B0;function vM(){return B0||(B0=1,zm.exports=yM()),zm.exports}var o=vM(),b=Yb();const Ce=ju(b),GA=xM({__proto__:null,default:Ce},[b]);var $m={exports:{}},Tc={},Hm={exports:{}},Um={};/**
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 F0;function wM(){return F0||(F0=1,(function(t){function e(F,W){var V=F.length;F.push(W);e:for(;0<V;){var Y=V-1>>>1,z=F[Y];if(0<a(z,W))F[Y]=W,F[V]=z,V=Y;else break e}}function n(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var W=F[0],V=F.pop();if(V!==W){F[0]=V;e:for(var Y=0,z=F.length,Q=z>>>1;Y<Q;){var K=2*(Y+1)-1,q=F[K],xe=K+1,de=F[xe];if(0>a(q,V))xe<z&&0>a(de,q)?(F[Y]=de,F[xe]=V,Y=xe):(F[Y]=q,F[K]=V,Y=K);else if(xe<z&&0>a(de,V))F[Y]=de,F[xe]=V,Y=xe;else break e}}return W}function a(F,W){var V=F.sortIndex-W.sortIndex;return V!==0?V:F.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,C=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function _(F){for(var W=n(f);W!==null;){if(W.callback===null)s(f);else if(W.startTime<=F)s(f),W.sortIndex=W.expirationTime,e(d,W);else break;W=n(f)}}function D(F){if(S=!1,_(F),!v)if(n(d)!==null)v=!0,E||(E=!0,B());else{var W=n(f);W!==null&&L(D,W.startTime-F)}}var E=!1,I=-1,O=5,T=-1;function M(){return C?!0:!(t.unstable_now()-T<O)}function R(){if(C=!1,E){var F=t.unstable_now();T=F;var W=!0;try{e:{v=!1,S&&(S=!1,N(I),I=-1),y=!0;var V=x;try{t:{for(_(F),m=n(d);m!==null&&!(m.expirationTime>F&&M());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,x=m.priorityLevel;var z=Y(m.expirationTime<=F);if(F=t.unstable_now(),typeof z=="function"){m.callback=z,_(F),W=!0;break t}m===n(d)&&s(d),_(F)}else s(d);m=n(d)}if(m!==null)W=!0;else{var Q=n(f);Q!==null&&L(D,Q.startTime-F),W=!1}}break e}finally{m=null,x=V,y=!1}W=void 0}}finally{W?B():E=!1}}}var B;if(typeof j=="function")B=function(){j(R)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,U=$.port2;$.port1.onmessage=R,B=function(){U.postMessage(null)}}else B=function(){k(R,0)};function L(F,W){I=k(function(){F(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(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(F){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var V=x;x=W;try{return F()}finally{x=V}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(F,W){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var V=x;x=F;try{return W()}finally{x=V}},t.unstable_scheduleCallback=function(F,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,F){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=V+z,F={id:h++,callback:W,priorityLevel:F,startTime:V,expirationTime:z,sortIndex:-1},V>Y?(F.sortIndex=V,e(f,F),n(d)===null&&F===n(f)&&(S?(N(I),I=-1):S=!0,L(D,V-Y))):(F.sortIndex=z,e(d,F),v||y||(v=!0,E||(E=!0,B()))),F},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(F){var W=x;return function(){var V=x;x=W;try{return F.apply(this,arguments)}finally{x=V}}}})(Um)),Um}var z0;function kM(){return z0||(z0=1,Hm.exports=wM()),Hm.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 $0;function SM(){if($0)return Tc;$0=1;var t=kM(),e=Yb(),n=LA();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 A=w.alternate;if(A===null){if(g=w.return,g!==null){p=g;continue}break}if(w.child===A.child){for(A=w.child;A;){if(A===p)return d(w),l;if(A===g)return d(w),u;A=A.sibling}throw Error(s(188))}if(p.return!==g.return)p=w,g=A;else{for(var P=!1,G=w.child;G;){if(G===p){P=!0,p=w,g=A;break}if(G===g){P=!0,g=w,p=A;break}G=G.sibling}if(!P){for(G=A.child;G;){if(G===p){P=!0,p=A,g=w;break}if(G===g){P=!0,g=A,p=w;break}G=G.sibling}if(!P)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"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),j=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),I=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 B(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 C:return"StrictMode";case D:return"Suspense";case E: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 _:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case I: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,F=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=[],z=-1;function Q(l){return{current:l}}function K(l){0>z||(l.current=Y[z],Y[z]=null,z--)}function q(l,u){z++,Y[z]=l.current,l.current=u}var xe=Q(null),de=Q(null),ee=Q(null),fe=Q(null);function je(l,u){switch(q(ee,u),q(de,l),q(xe,null),u.nodeType){case 9:case 11:l=(l=u.documentElement)&&(l=l.namespaceURI)?t0(l):0;break;default:if(l=u.tagName,u=u.namespaceURI)u=t0(u),l=n0(u,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}K(xe),q(xe,l)}function ge(){K(xe),K(de),K(ee)}function Ee(l){l.memoizedState!==null&&q(fe,l);var u=xe.current,p=n0(u,l.type);u!==p&&(q(de,l),q(xe,p))}function Be(l){de.current===l&&(K(xe),K(de)),fe.current===l&&(K(fe),Sc._currentValue=V)}var Ve,J;function ne(l){if(Ve===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);Ve=u&&u[1]||"",J=-1<p.stack.indexOf(`
27
+ at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
28
+ `+Ve+l+J}var Te=!1;function qe(l,u){if(!l||Te)return"";Te=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(u){var Je=function(){throw Error()};if(Object.defineProperty(Je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Je,[])}catch(Ue){var Ie=Ue}Reflect.construct(l,[],Je)}else{try{Je.call()}catch(Ue){Ie=Ue}l.call(Je.prototype)}}else{try{throw Error()}catch(Ue){Ie=Ue}(Je=l())&&typeof Je.catch=="function"&&Je.catch(function(){})}}catch(Ue){if(Ue&&Ie&&typeof Ue.stack=="string")return[Ue.stack,Ie.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 A=g.DetermineComponentFrameRoot(),P=A[0],G=A[1];if(P&&G){var re=P.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{Te=!1,Error.prepareStackTrace=p}return(p=l?l.displayName||l.name:"")?ne(p):""}function at(l,u){switch(l.tag){case 26:case 27:case 5:return ne(l.type);case 16:return ne("Lazy");case 13:return l.child!==u&&u!==null?ne("Suspense Fallback"):ne("Suspense");case 19:return ne("SuspenseList");case 0:case 15:return qe(l.type,!1);case 11:return qe(l.type.render,!1);case 1:return qe(l.type,!0);case 31:return ne("Activity");default:return""}}function Se(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 Fe=Object.prototype.hasOwnProperty,ie=t.unstable_scheduleCallback,he=t.unstable_cancelCallback,We=t.unstable_shouldYield,st=t.unstable_requestPaint,ut=t.unstable_now,ue=t.unstable_getCurrentPriorityLevel,X=t.unstable_ImmediatePriority,ae=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Z=t.unstable_LowPriority,ve=t.unstable_IdlePriority,He=t.log,Pe=t.unstable_setDisableYieldValue,oe=null,Le=null;function le(l){if(typeof He=="function"&&Pe(l),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(oe,l)}catch{}}var me=Math.clz32?Math.clz32:Ke,se=Math.log,Re=Math.LN2;function Ke(l){return l>>>=0,l===0?32:31-(se(l)/Re|0)|0}var ze=256,tt=262144,ot=4194304;function nt(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 lt(l,u,p){var g=l.pendingLanes;if(g===0)return 0;var w=0,A=l.suspendedLanes,P=l.pingedLanes;l=l.warmLanes;var G=g&134217727;return G!==0?(g=G&~A,g!==0?w=nt(g):(P&=G,P!==0?w=nt(P):p||(p=G&~l,p!==0&&(w=nt(p))))):(G=g&~A,G!==0?w=nt(G):P!==0?w=nt(P):p||(p=g&~l,p!==0&&(w=nt(p)))),w===0?0:u!==0&&u!==w&&(u&A)===0&&(A=w&-w,p=u&-u,A>=p||A===32&&(p&4194048)!==0)?u:w}function it(l,u){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&u)===0}function ht(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 jt(){var l=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),l}function be(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 Ge(l,u,p,g,w,A){var P=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=P&~p;0<p;){var Ye=31-me(p),Je=1<<Ye;G[Ye]=0,re[Ye]=-1;var Ie=De[Ye];if(Ie!==null)for(De[Ye]=null,Ye=0;Ye<Ie.length;Ye++){var Ue=Ie[Ye];Ue!==null&&(Ue.lane&=-536870913)}p&=~Je}g!==0&&et(l,g,0),A!==0&&w===0&&l.tag!==0&&(l.suspendedLanes|=A&~(P&~u))}function et(l,u,p){l.pendingLanes|=u,l.suspendedLanes&=~u;var g=31-me(u);l.entangledLanes|=u,l.entanglements[g]=l.entanglements[g]|1073741824|p&261930}function Nt(l,u){var p=l.entangledLanes|=u;for(l=l.entanglements;p;){var g=31-me(p),w=1<<g;w&u|l[g]&u&&(l[g]|=u),p&=~w}}function zt(l,u){var p=u&-u;return p=(p&42)!==0?1:Lt(p),(p&(l.suspendedLanes|u))!==0?0:p}function Lt(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 Pt(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:A0(l.type))}function mt(l,u){var p=W.p;try{return W.p=l,u()}finally{W.p=p}}var ct=Math.random().toString(36).slice(2),xt="__reactFiber$"+ct,Mt="__reactProps$"+ct,kn="__reactContainer$"+ct,cn="__reactEvents$"+ct,ls="__reactListeners$"+ct,Ba="__reactHandles$"+ct,Ts="__reactResources$"+ct,Hs="__reactMarker$"+ct;function Fa(l){delete l[xt],delete l[Mt],delete l[cn],delete l[ls],delete l[Ba]}function ws(l){var u=l[xt];if(u)return u;for(var p=l.parentNode;p;){if(u=p[kn]||p[xt]){if(p=u.alternate,u.child!==null||p!==null&&p.child!==null)for(l=c0(l);l!==null;){if(p=l[xt])return p;l=c0(l)}return u}l=p,p=l.parentNode}return null}function Zn(l){if(l=l[xt]||l[kn]){var u=l.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return l}return null}function Et(l){var u=l.tag;if(u===5||u===26||u===27||u===6)return l.stateNode;throw Error(s(33))}function rs(l){var u=l[Ts];return u||(u=l[Ts]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function fn(l){l[Hs]=!0}var cr=new Set,Hr={};function _s(l,u){Es(l,u),Es(l+"Capture",u)}function Es(l,u){for(Hr[l]=u,l=0;l<u.length;l++)cr.add(u[l])}var _i=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]*$"),wo={},Ur={};function Il(l){return Fe.call(Ur,l)?!0:Fe.call(wo,l)?!1:_i.test(l)?Ur[l]=!0:(wo[l]=!0,!1)}function gs(l,u,p){if(Il(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 Ca(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 cs(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 Vn(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Wr(l){var u=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Ae(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,A=g.set;return Object.defineProperty(l,u,{configurable:!0,get:function(){return w.call(this)},set:function(P){p=""+P,A.call(this,P)}}),Object.defineProperty(l,u,{enumerable:g.enumerable}),{getValue:function(){return p},setValue:function(P){p=""+P},stopTracking:function(){l._valueTracker=null,delete l[u]}}}}function Xe(l){if(!l._valueTracker){var u=Wr(l)?"checked":"value";l._valueTracker=Ae(l,u,""+l[u])}}function Ct(l){if(!l)return!1;var u=l._valueTracker;if(!u)return!0;var p=u.getValue(),g="";return l&&(g=Wr(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 Ln=/[\n"\\]/g;function $t(l){return l.replace(Ln,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function At(l,u,p,g,w,A,P,G){l.name="",P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?l.type=P:l.removeAttribute("type"),u!=null?P==="number"?(u===0&&l.value===""||l.value!=u)&&(l.value=""+Vn(u)):l.value!==""+Vn(u)&&(l.value=""+Vn(u)):P!=="submit"&&P!=="reset"||l.removeAttribute("value"),u!=null?ks(l,P,Vn(u)):p!=null?ks(l,P,Vn(p)):g!=null&&l.removeAttribute("value"),w==null&&A!=null&&(l.defaultChecked=!!A),w!=null&&(l.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?l.name=""+Vn(G):l.removeAttribute("name")}function Nn(l,u,p,g,w,A,P,G){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(l.type=A),u!=null||p!=null){if(!(A!=="submit"&&A!=="reset"||u!=null)){Xe(l);return}p=p!=null?""+Vn(p):"",u=u!=null?""+Vn(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,P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(l.name=P),Xe(l)}function ks(l,u,p){u==="number"&&en(l.ownerDocument)===l||l.defaultValue===""+p||(l.defaultValue=""+p)}function Pn(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=""+Vn(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 Us(l,u,p){if(u!=null&&(u=""+Vn(u),u!==l.value&&(l.value=u),p==null)){l.defaultValue!==u&&(l.defaultValue=u);return}l.defaultValue=p!=null?""+Vn(p):""}function Aa(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=Vn(u),l.defaultValue=p,g=l.textContent,g===p&&g!==""&&g!==null&&(l.value=g),Xe(l)}function ia(l,u){if(u){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=u;return}}l.textContent=u}var Bl=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 Iu(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||Bl.has(u)?u==="float"?l.cssFloat=p:l[u]=(""+p).trim():l[u]=p+"px"}function Bu(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&&Iu(l,w,g)}else for(var A in u)u.hasOwnProperty(A)&&Iu(l,A,u[A])}function ko(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 Fu=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"]]),Ei=/^[\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 qr(l){return Ei.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}function ja(){}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 Vr=null,ur=null;function $l(l){var u=Zn(l);if(u&&(l=u.stateNode)){var p=l[Mt]||null;e:switch(l=u.stateNode,u.type){case"input":if(At(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="'+$t(""+u)+'"][type="radio"]'),u=0;u<p.length;u++){var g=p[u];if(g!==l&&g.form===l.form){var w=g[Mt]||null;if(!w)throw Error(s(90));At(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&&Ct(g)}break e;case"textarea":Us(l,p.value,p.defaultValue);break e;case"select":u=p.value,u!=null&&Pn(l,!!p.multiple,u,!1)}}}var So=!1;function Hl(l,u,p){if(So)return l(u,p);So=!0;try{var g=l(u);return g}finally{if(So=!1,(Vr!==null||ur!==null)&&(Cd(),Vr&&(u=Vr,l=ur,ur=Vr=null,$l(u),l)))for(u=0;u<l.length;u++)$l(l[u])}}function Gr(l,u){var p=l.stateNode;if(p===null)return null;var g=p[Mt]||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 oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Co=!1;if(oa)try{var Yr={};Object.defineProperty(Yr,"passive",{get:function(){Co=!0}}),window.addEventListener("test",Yr,Yr),window.removeEventListener("test",Yr,Yr)}catch{Co=!1}var Na=null,Ao=null,Mi=null;function Ul(){if(Mi)return Mi;var l,u=Ao,p=u.length,g,w="value"in Na?Na.value:Na.textContent,A=w.length;for(l=0;l<p&&u[l]===w[l];l++);var P=p-l;for(g=1;g<=P&&u[p-g]===w[A-g];g++);return Mi=w.slice(l,1<g?1-g:void 0)}function Di(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 Ne(){return!1}function pe(l){function u(p,g,w,A,P){this._reactName=p,this._targetInst=w,this.type=g,this.nativeEvent=A,this.target=P,this.currentTarget=null;for(var G in l)l.hasOwnProperty(G)&&(p=l[G],this[G]=p?p(A):A[G]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?te:Ne,this.isPropagationStopped=Ne,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 $e={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gt=pe($e),Tt=m({},$e,{view:0,detail:0}),Sn=pe(Tt),tn,$n,es,Ms=m({},Tt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wp,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!==es&&(es&&l.type==="mousemove"?(tn=l.screenX-es.screenX,$n=l.screenY-es.screenY):$n=tn=0,es=l),tn)},movementY:function(l){return"movementY"in l?l.movementY:$n}}),zp=pe(Ms),$p=m({},Ms,{dataTransfer:0}),zu=pe($p),$u=m({},Tt,{relatedTarget:0}),Ri=pe($u),Hu=m({},$e,{animationName:0,elapsedTime:0,pseudoElement:0}),Hp=pe(Hu),Up=m({},$e,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),LT=pe(Up),PT=m({},$e,{data:0}),ry=pe(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 Wp(){return zT}var $T=m({},Tt,{key:function(l){if(l.key){var u=IT[l.key]||l.key;if(u!=="Unidentified")return u}return l.type==="keypress"?(l=Di(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:Wp,charCode:function(l){return l.type==="keypress"?Di(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?Di(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),HT=pe($T),UT=m({},Ms,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),iy=pe(UT),WT=m({},Tt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wp}),qT=pe(WT),VT=m({},$e,{propertyName:0,elapsedTime:0,pseudoElement:0}),GT=pe(VT),YT=m({},Ms,{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=pe(YT),QT=m({},$e,{newState:0,oldState:0}),XT=pe(QT),JT=[9,13,27,32],qp=oa&&"CompositionEvent"in window,Wl=null;oa&&"documentMode"in document&&(Wl=document.documentMode);var ZT=oa&&"TextEvent"in window&&!Wl,oy=oa&&(!qp||Wl&&8<Wl&&11>=Wl),ly=" ",cy=!1;function uy(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 dy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var jo=!1;function e_(l,u){switch(l){case"compositionend":return dy(u);case"keypress":return u.which!==32?null:(cy=!0,ly);case"textInput":return l=u.data,l===ly&&cy?null:l;default:return null}}function t_(l,u){if(jo)return l==="compositionend"||!qp&&uy(l,u)?(l=Ul(),Mi=Ao=Na=null,jo=!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 oy&&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 fy(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u==="input"?!!n_[l.type]:u==="textarea"}function py(l,u,p,g){Vr?ur?ur.push(g):ur=[g]:Vr=g,u=Md(u,"onChange"),0<u.length&&(p=new gt("onChange","change",null,p,g),l.push({event:p,listeners:u}))}var ql=null,Vl=null;function s_(l){Kw(l,0)}function Uu(l){var u=Et(l);if(Ct(u))return l}function hy(l,u){if(l==="change")return u}var my=!1;if(oa){var Vp;if(oa){var Gp="oninput"in document;if(!Gp){var gy=document.createElement("div");gy.setAttribute("oninput","return;"),Gp=typeof gy.oninput=="function"}Vp=Gp}else Vp=!1;my=Vp&&(!document.documentMode||9<document.documentMode)}function by(){ql&&(ql.detachEvent("onpropertychange",xy),Vl=ql=null)}function xy(l){if(l.propertyName==="value"&&Uu(Vl)){var u=[];py(u,Vl,l,zl(l)),Hl(s_,u)}}function a_(l,u,p){l==="focusin"?(by(),ql=u,Vl=p,ql.attachEvent("onpropertychange",xy)):l==="focusout"&&by()}function r_(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return Uu(Vl)}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 Ws=typeof Object.is=="function"?Object.is:l_;function Gl(l,u){if(Ws(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(!Fe.call(u,w)||!Ws(l[w],u[w]))return!1}return!0}function yy(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function vy(l,u){var p=yy(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=yy(p)}}function wy(l,u){return l&&u?l===u?!0:l&&l.nodeType===3?!1:u&&u.nodeType===3?wy(l,u.parentNode):"contains"in l?l.contains(u):l.compareDocumentPosition?!!(l.compareDocumentPosition(u)&16):!1:!1}function ky(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 Yp(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_=oa&&"documentMode"in document&&11>=document.documentMode,No=null,Kp=null,Yl=null,Qp=!1;function Sy(l,u,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Qp||No==null||No!==en(g)||(g=No,"selectionStart"in g&&Yp(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}),Yl&&Gl(Yl,g)||(Yl=g,g=Md(Kp,"onSelect"),0<g.length&&(u=new gt("onSelect","select",null,u,p),l.push({event:u,listeners:g}),u.target=No)))}function Oi(l,u){var p={};return p[l.toLowerCase()]=u.toLowerCase(),p["Webkit"+l]="webkit"+u,p["Moz"+l]="moz"+u,p}var To={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionrun:Oi("Transition","TransitionRun"),transitionstart:Oi("Transition","TransitionStart"),transitioncancel:Oi("Transition","TransitionCancel"),transitionend:Oi("Transition","TransitionEnd")},Xp={},Cy={};oa&&(Cy=document.createElement("div").style,"AnimationEvent"in window||(delete To.animationend.animation,delete To.animationiteration.animation,delete To.animationstart.animation),"TransitionEvent"in window||delete To.transitionend.transition);function Li(l){if(Xp[l])return Xp[l];if(!To[l])return l;var u=To[l],p;for(p in u)if(u.hasOwnProperty(p)&&p in Cy)return Xp[l]=u[p];return l}var Ay=Li("animationend"),jy=Li("animationiteration"),Ny=Li("animationstart"),u_=Li("transitionrun"),d_=Li("transitionstart"),f_=Li("transitioncancel"),Ty=Li("transitionend"),_y=new Map,Jp="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(" ");Jp.push("scrollEnd");function Ta(l,u){_y.set(l,u),_s(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)},la=[],_o=0,Zp=0;function qu(){for(var l=_o,u=Zp=_o=0;u<l;){var p=la[u];la[u++]=null;var g=la[u];la[u++]=null;var w=la[u];la[u++]=null;var A=la[u];if(la[u++]=null,g!==null&&w!==null){var P=g.pending;P===null?w.next=w:(w.next=P.next,P.next=w),g.pending=w}A!==0&&Ey(p,w,A)}}function Vu(l,u,p,g){la[_o++]=l,la[_o++]=u,la[_o++]=p,la[_o++]=g,Zp|=g,l.lanes|=g,l=l.alternate,l!==null&&(l.lanes|=g)}function eh(l,u,p,g){return Vu(l,u,p,g),Gu(l)}function Pi(l,u){return Vu(l,null,null,u),Gu(l)}function Ey(l,u,p){l.lanes|=p;var g=l.alternate;g!==null&&(g.lanes|=p);for(var w=!1,A=l.return;A!==null;)A.childLanes|=p,g=A.alternate,g!==null&&(g.childLanes|=p),A.tag===22&&(l=A.stateNode,l===null||l._visibility&1||(w=!0)),l=A,A=A.return;return l.tag===3?(A=l.stateNode,w&&u!==null&&(w=31-me(p),l=A.hiddenUpdates,g=l[w],g===null?l[w]=[u]:g.push(u),u.lane=p|536870912),A):null}function Gu(l){if(50<gc)throw gc=0,cm=null,Error(s(185));for(var u=l.return;u!==null;)l=u,u=l.return;return l.tag===3?l.stateNode:null}var Eo={};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 qs(l,u,p,g){return new p_(l,u,p,g)}function th(l){return l=l.prototype,!(!l||!l.isReactComponent)}function dr(l,u){var p=l.alternate;return p===null?(p=qs(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 My(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,A){var P=0;if(g=l,typeof l=="function")th(l)&&(P=1);else if(typeof l=="string")P=xE(l,p,xe.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case T:return l=qs(31,p,u,w),l.elementType=T,l.lanes=A,l;case S:return Ii(p.children,w,A,u);case C:P=8,w|=24;break;case k:return l=qs(12,p,u,w|2),l.elementType=k,l.lanes=A,l;case D:return l=qs(13,p,u,w),l.elementType=D,l.lanes=A,l;case E:return l=qs(19,p,u,w),l.elementType=E,l.lanes=A,l;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case j:P=10;break e;case N:P=9;break e;case _:P=11;break e;case I:P=14;break e;case O:P=16,g=null;break e}P=29,p=Error(s(130,l===null?"null":typeof l,"")),g=null}return u=qs(P,p,u,w),u.elementType=l,u.type=g,u.lanes=A,u}function Ii(l,u,p,g){return l=qs(7,l,g,u),l.lanes=p,l}function nh(l,u,p){return l=qs(6,l,null,u),l.lanes=p,l}function Dy(l){var u=qs(18,null,null,0);return u.stateNode=l,u}function sh(l,u,p){return u=qs(4,l.children!==null?l.children:[],l.key,u),u.lanes=p,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}var Ry=new WeakMap;function ca(l,u){if(typeof l=="object"&&l!==null){var p=Ry.get(l);return p!==void 0?p:(u={value:l,source:u,stack:Se(u)},Ry.set(l,u),u)}return{value:l,source:u,stack:Se(u)}}var Mo=[],Do=0,Ku=null,Kl=0,ua=[],da=0,Kr=null,za=1,$a="";function fr(l,u){Mo[Do++]=Kl,Mo[Do++]=Ku,Ku=l,Kl=u}function Oy(l,u,p){ua[da++]=za,ua[da++]=$a,ua[da++]=Kr,Kr=l;var g=za;l=$a;var w=32-me(g)-1;g&=~(1<<w),p+=1;var A=32-me(u)+w;if(30<A){var P=w-w%5;A=(g&(1<<P)-1).toString(32),g>>=P,w-=P,za=1<<32-me(u)+w|p<<w|g,$a=A+l}else za=1<<A|p<<w|g,$a=l}function ah(l){l.return!==null&&(fr(l,1),Oy(l,1,0))}function rh(l){for(;l===Ku;)Ku=Mo[--Do],Mo[Do]=null,Kl=Mo[--Do],Mo[Do]=null;for(;l===Kr;)Kr=ua[--da],ua[da]=null,$a=ua[--da],ua[da]=null,za=ua[--da],ua[da]=null}function Ly(l,u){ua[da++]=za,ua[da++]=$a,ua[da++]=Kr,za=u.id,$a=u.overflow,Kr=l}var us=null,En=null,rn=!1,Qr=null,fa=!1,ih=Error(s(519));function Xr(l){var u=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ql(ca(u,l)),ih}function Py(l){var u=l.stateNode,p=l.type,g=l.memoizedProps;switch(u[xt]=l,u[Mt]=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<xc.length;p++)Kt(xc[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),Nn(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),Aa(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||Zw(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=ja),u=!0):u=!1,u||Xr(l,!0)}function Iy(l){for(us=l.return;us;)switch(us.tag){case 5:case 31:case 13:fa=!1;return;case 27:case 3:fa=!0;return;default:us=us.return}}function Ro(l){if(l!==us)return!1;if(!rn)return Iy(l),rn=!0,!1;var u=l.tag,p;if((p=u!==3&&u!==27)&&((p=u===5)&&(p=l.type,p=!(p!=="form"&&p!=="button")||Cm(l.type,l.memoizedProps)),p=!p),p&&En&&Xr(l),Iy(l),u===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(317));En=l0(l)}else if(u===31){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(317));En=l0(l)}else u===27?(u=En,di(l.type)?(l=_m,_m=null,En=l):En=u):En=us?ha(l.stateNode.nextSibling):null;return!0}function Bi(){En=us=null,rn=!1}function oh(){var l=Qr;return l!==null&&(Ls===null?Ls=l:Ls.push.apply(Ls,l),Qr=null),l}function Ql(l){Qr===null?Qr=[l]:Qr.push(l)}var lh=Q(null),Fi=null,pr=null;function Jr(l,u,p){q(lh,u._currentValue),u._currentValue=p}function hr(l){l._currentValue=lh.current,K(lh)}function ch(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 uh(l,u,p,g){var w=l.child;for(w!==null&&(w.return=l);w!==null;){var A=w.dependencies;if(A!==null){var P=w.child;A=A.firstContext;e:for(;A!==null;){var G=A;A=w;for(var re=0;re<u.length;re++)if(G.context===u[re]){A.lanes|=p,G=A.alternate,G!==null&&(G.lanes|=p),ch(A.return,p,l),g||(P=null);break e}A=G.next}}else if(w.tag===18){if(P=w.return,P===null)throw Error(s(341));P.lanes|=p,A=P.alternate,A!==null&&(A.lanes|=p),ch(P,p,l),P=null}else P=w.child;if(P!==null)P.return=w;else for(P=w;P!==null;){if(P===l){P=null;break}if(w=P.sibling,w!==null){w.return=P.return,P=w;break}P=P.return}w=P}}function Oo(l,u,p,g){l=null;for(var w=u,A=!1;w!==null;){if(!A){if((w.flags&524288)!==0)A=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var P=w.alternate;if(P===null)throw Error(s(387));if(P=P.memoizedProps,P!==null){var G=w.type;Ws(w.pendingProps.value,P.value)||(l!==null?l.push(G):l=[G])}}else if(w===fe.current){if(P=w.alternate,P===null)throw Error(s(387));P.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(l!==null?l.push(Sc):l=[Sc])}w=w.return}l!==null&&uh(u,l,p,g),u.flags|=262144}function Qu(l){for(l=l.firstContext;l!==null;){if(!Ws(l.context._currentValue,l.memoizedValue))return!0;l=l.next}return!1}function zi(l){Fi=l,pr=null,l=l.dependencies,l!==null&&(l.firstContext=null)}function ds(l){return By(Fi,l)}function Xu(l,u){return Fi===null&&zi(l),By(l,u)}function By(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 dh(){return{controller:new h_,data:new Map,refCount:0}}function Xl(l){l.refCount--,l.refCount===0&&m_(g_,function(){l.controller.abort()})}var Jl=null,fh=0,Lo=0,Po=null;function b_(l,u){if(Jl===null){var p=Jl=[];fh=0,Lo=mm(),Po={status:"pending",value:void 0,then:function(g){p.push(g)}}}return fh++,u.then(Fy,Fy),u}function Fy(){if(--fh===0&&Jl!==null){Po!==null&&(Po.status="fulfilled");var l=Jl;Jl=null,Lo=0,Po=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 zy=F.S;F.S=function(l,u){Sw=ut(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&b_(l,u),zy!==null&&zy(l,u)};var $i=Q(null);function ph(){var l=$i.current;return l!==null?l:Cn.pooledCache}function Ju(l,u){u===null?q($i,$i.current):q($i,u.pool)}function $y(){var l=ph();return l===null?null:{parent:Gn._currentValue,pool:l}}var Io=Error(s(460)),hh=Error(s(474)),Zu=Error(s(542)),ed={then:function(){}};function Hy(l){return l=l.status,l==="fulfilled"||l==="rejected"}function Uy(l,u,p){switch(p=l[p],p===void 0?l.push(u):p!==u&&(u.then(ja,ja),u=p),u.status){case"fulfilled":return u.value;case"rejected":throw l=u.reason,qy(l),l;default:if(typeof u.status=="string")u.then(ja,ja);else{if(l=Cn,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,qy(l),l}throw Ui=u,Io}}function Hi(l){try{var u=l._init;return u(l._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Ui=p,Io):p}}var Ui=null;function Wy(){if(Ui===null)throw Error(s(459));var l=Ui;return Ui=null,l}function qy(l){if(l===Io||l===Zu)throw Error(s(483))}var Bo=null,Zl=0;function td(l){var u=Zl;return Zl+=1,Bo===null&&(Bo=[]),Uy(Bo,l,u)}function ec(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 Vy(l){function u(ke,ce){if(l){var Me=ke.deletions;Me===null?(ke.deletions=[ce],ke.flags|=16):Me.push(ce)}}function p(ke,ce){if(!l)return null;for(;ce!==null;)u(ke,ce),ce=ce.sibling;return null}function g(ke){for(var ce=new Map;ke!==null;)ke.key!==null?ce.set(ke.key,ke):ce.set(ke.index,ke),ke=ke.sibling;return ce}function w(ke,ce){return ke=dr(ke,ce),ke.index=0,ke.sibling=null,ke}function A(ke,ce,Me){return ke.index=Me,l?(Me=ke.alternate,Me!==null?(Me=Me.index,Me<ce?(ke.flags|=67108866,ce):Me):(ke.flags|=67108866,ce)):(ke.flags|=1048576,ce)}function P(ke){return l&&ke.alternate===null&&(ke.flags|=67108866),ke}function G(ke,ce,Me,Qe){return ce===null||ce.tag!==6?(ce=nh(Me,ke.mode,Qe),ce.return=ke,ce):(ce=w(ce,Me),ce.return=ke,ce)}function re(ke,ce,Me,Qe){var _t=Me.type;return _t===S?Ye(ke,ce,Me.props.children,Qe,Me.key):ce!==null&&(ce.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===O&&Hi(_t)===ce.type)?(ce=w(ce,Me.props),ec(ce,Me),ce.return=ke,ce):(ce=Yu(Me.type,Me.key,Me.props,null,ke.mode,Qe),ec(ce,Me),ce.return=ke,ce)}function De(ke,ce,Me,Qe){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==Me.containerInfo||ce.stateNode.implementation!==Me.implementation?(ce=sh(Me,ke.mode,Qe),ce.return=ke,ce):(ce=w(ce,Me.children||[]),ce.return=ke,ce)}function Ye(ke,ce,Me,Qe,_t){return ce===null||ce.tag!==7?(ce=Ii(Me,ke.mode,Qe,_t),ce.return=ke,ce):(ce=w(ce,Me),ce.return=ke,ce)}function Je(ke,ce,Me){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ce=nh(""+ce,ke.mode,Me),ce.return=ke,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return Me=Yu(ce.type,ce.key,ce.props,null,ke.mode,Me),ec(Me,ce),Me.return=ke,Me;case v:return ce=sh(ce,ke.mode,Me),ce.return=ke,ce;case O:return ce=Hi(ce),Je(ke,ce,Me)}if(L(ce)||B(ce))return ce=Ii(ce,ke.mode,Me,null),ce.return=ke,ce;if(typeof ce.then=="function")return Je(ke,td(ce),Me);if(ce.$$typeof===j)return Je(ke,Xu(ke,ce),Me);nd(ke,ce)}return null}function Ie(ke,ce,Me,Qe){var _t=ce!==null?ce.key:null;if(typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint")return _t!==null?null:G(ke,ce,""+Me,Qe);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case y:return Me.key===_t?re(ke,ce,Me,Qe):null;case v:return Me.key===_t?De(ke,ce,Me,Qe):null;case O:return Me=Hi(Me),Ie(ke,ce,Me,Qe)}if(L(Me)||B(Me))return _t!==null?null:Ye(ke,ce,Me,Qe,null);if(typeof Me.then=="function")return Ie(ke,ce,td(Me),Qe);if(Me.$$typeof===j)return Ie(ke,ce,Xu(ke,Me),Qe);nd(ke,Me)}return null}function Ue(ke,ce,Me,Qe,_t){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number"||typeof Qe=="bigint")return ke=ke.get(Me)||null,G(ce,ke,""+Qe,_t);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case y:return ke=ke.get(Qe.key===null?Me:Qe.key)||null,re(ce,ke,Qe,_t);case v:return ke=ke.get(Qe.key===null?Me:Qe.key)||null,De(ce,ke,Qe,_t);case O:return Qe=Hi(Qe),Ue(ke,ce,Me,Qe,_t)}if(L(Qe)||B(Qe))return ke=ke.get(Me)||null,Ye(ce,ke,Qe,_t,null);if(typeof Qe.then=="function")return Ue(ke,ce,Me,td(Qe),_t);if(Qe.$$typeof===j)return Ue(ke,ce,Me,Xu(ce,Qe),_t);nd(ce,Qe)}return null}function yt(ke,ce,Me,Qe){for(var _t=null,un=null,kt=ce,Ut=ce=0,sn=null;kt!==null&&Ut<Me.length;Ut++){kt.index>Ut?(sn=kt,kt=null):sn=kt.sibling;var dn=Ie(ke,kt,Me[Ut],Qe);if(dn===null){kt===null&&(kt=sn);break}l&&kt&&dn.alternate===null&&u(ke,kt),ce=A(dn,ce,Ut),un===null?_t=dn:un.sibling=dn,un=dn,kt=sn}if(Ut===Me.length)return p(ke,kt),rn&&fr(ke,Ut),_t;if(kt===null){for(;Ut<Me.length;Ut++)kt=Je(ke,Me[Ut],Qe),kt!==null&&(ce=A(kt,ce,Ut),un===null?_t=kt:un.sibling=kt,un=kt);return rn&&fr(ke,Ut),_t}for(kt=g(kt);Ut<Me.length;Ut++)sn=Ue(kt,ke,Ut,Me[Ut],Qe),sn!==null&&(l&&sn.alternate!==null&&kt.delete(sn.key===null?Ut:sn.key),ce=A(sn,ce,Ut),un===null?_t=sn:un.sibling=sn,un=sn);return l&&kt.forEach(function(gi){return u(ke,gi)}),rn&&fr(ke,Ut),_t}function Ot(ke,ce,Me,Qe){if(Me==null)throw Error(s(151));for(var _t=null,un=null,kt=ce,Ut=ce=0,sn=null,dn=Me.next();kt!==null&&!dn.done;Ut++,dn=Me.next()){kt.index>Ut?(sn=kt,kt=null):sn=kt.sibling;var gi=Ie(ke,kt,dn.value,Qe);if(gi===null){kt===null&&(kt=sn);break}l&&kt&&gi.alternate===null&&u(ke,kt),ce=A(gi,ce,Ut),un===null?_t=gi:un.sibling=gi,un=gi,kt=sn}if(dn.done)return p(ke,kt),rn&&fr(ke,Ut),_t;if(kt===null){for(;!dn.done;Ut++,dn=Me.next())dn=Je(ke,dn.value,Qe),dn!==null&&(ce=A(dn,ce,Ut),un===null?_t=dn:un.sibling=dn,un=dn);return rn&&fr(ke,Ut),_t}for(kt=g(kt);!dn.done;Ut++,dn=Me.next())dn=Ue(kt,ke,Ut,dn.value,Qe),dn!==null&&(l&&dn.alternate!==null&&kt.delete(dn.key===null?Ut:dn.key),ce=A(dn,ce,Ut),un===null?_t=dn:un.sibling=dn,un=dn);return l&&kt.forEach(function(_E){return u(ke,_E)}),rn&&fr(ke,Ut),_t}function wn(ke,ce,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 _t=Me.key;ce!==null;){if(ce.key===_t){if(_t=Me.type,_t===S){if(ce.tag===7){p(ke,ce.sibling),Qe=w(ce,Me.props.children),Qe.return=ke,ke=Qe;break e}}else if(ce.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===O&&Hi(_t)===ce.type){p(ke,ce.sibling),Qe=w(ce,Me.props),ec(Qe,Me),Qe.return=ke,ke=Qe;break e}p(ke,ce);break}else u(ke,ce);ce=ce.sibling}Me.type===S?(Qe=Ii(Me.props.children,ke.mode,Qe,Me.key),Qe.return=ke,ke=Qe):(Qe=Yu(Me.type,Me.key,Me.props,null,ke.mode,Qe),ec(Qe,Me),Qe.return=ke,ke=Qe)}return P(ke);case v:e:{for(_t=Me.key;ce!==null;){if(ce.key===_t)if(ce.tag===4&&ce.stateNode.containerInfo===Me.containerInfo&&ce.stateNode.implementation===Me.implementation){p(ke,ce.sibling),Qe=w(ce,Me.children||[]),Qe.return=ke,ke=Qe;break e}else{p(ke,ce);break}else u(ke,ce);ce=ce.sibling}Qe=sh(Me,ke.mode,Qe),Qe.return=ke,ke=Qe}return P(ke);case O:return Me=Hi(Me),wn(ke,ce,Me,Qe)}if(L(Me))return yt(ke,ce,Me,Qe);if(B(Me)){if(_t=B(Me),typeof _t!="function")throw Error(s(150));return Me=_t.call(Me),Ot(ke,ce,Me,Qe)}if(typeof Me.then=="function")return wn(ke,ce,td(Me),Qe);if(Me.$$typeof===j)return wn(ke,ce,Xu(ke,Me),Qe);nd(ke,Me)}return typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint"?(Me=""+Me,ce!==null&&ce.tag===6?(p(ke,ce.sibling),Qe=w(ce,Me),Qe.return=ke,ke=Qe):(p(ke,ce),Qe=nh(Me,ke.mode,Qe),Qe.return=ke,ke=Qe),P(ke)):p(ke,ce)}return function(ke,ce,Me,Qe){try{Zl=0;var _t=wn(ke,ce,Me,Qe);return Bo=null,_t}catch(kt){if(kt===Io||kt===Zu)throw kt;var un=qs(29,kt,null,ke.mode);return un.lanes=Qe,un.return=ke,un}finally{}}}var Wi=Vy(!0),Gy=Vy(!1),Zr=!1;function mh(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gh(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 ei(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function ti(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),Ey(l,null,p),u}return Vu(l,g,u,p),Gu(l)}function tc(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,Nt(l,p)}}function bh(l,u){var p=l.updateQueue,g=l.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var w=null,A=null;if(p=p.firstBaseUpdate,p!==null){do{var P={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};A===null?w=A=P:A=A.next=P,p=p.next}while(p!==null);A===null?w=A=u:A=A.next=u}else w=A=u;p={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:A,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 xh=!1;function nc(){if(xh){var l=Po;if(l!==null)throw l}}function sc(l,u,p,g){xh=!1;var w=l.updateQueue;Zr=!1;var A=w.firstBaseUpdate,P=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var re=G,De=re.next;re.next=null,P===null?A=De:P.next=De,P=re;var Ye=l.alternate;Ye!==null&&(Ye=Ye.updateQueue,G=Ye.lastBaseUpdate,G!==P&&(G===null?Ye.firstBaseUpdate=De:G.next=De,Ye.lastBaseUpdate=re))}if(A!==null){var Je=w.baseState;P=0,Ye=De=re=null,G=A;do{var Ie=G.lane&-536870913,Ue=Ie!==G.lane;if(Ue?(nn&Ie)===Ie:(g&Ie)===Ie){Ie!==0&&Ie===Lo&&(xh=!0),Ye!==null&&(Ye=Ye.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var yt=l,Ot=G;Ie=u;var wn=p;switch(Ot.tag){case 1:if(yt=Ot.payload,typeof yt=="function"){Je=yt.call(wn,Je,Ie);break e}Je=yt;break e;case 3:yt.flags=yt.flags&-65537|128;case 0:if(yt=Ot.payload,Ie=typeof yt=="function"?yt.call(wn,Je,Ie):yt,Ie==null)break e;Je=m({},Je,Ie);break e;case 2:Zr=!0}}Ie=G.callback,Ie!==null&&(l.flags|=64,Ue&&(l.flags|=8192),Ue=w.callbacks,Ue===null?w.callbacks=[Ie]:Ue.push(Ie))}else Ue={lane:Ie,tag:G.tag,payload:G.payload,callback:G.callback,next:null},Ye===null?(De=Ye=Ue,re=Je):Ye=Ye.next=Ue,P|=Ie;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;Ue=G,G=Ue.next,Ue.next=null,w.lastBaseUpdate=Ue,w.shared.pending=null}}while(!0);Ye===null&&(re=Je),w.baseState=re,w.firstBaseUpdate=De,w.lastBaseUpdate=Ye,A===null&&(w.shared.lanes=0),ii|=P,l.lanes=P,l.memoizedState=Je}}function Yy(l,u){if(typeof l!="function")throw Error(s(191,l));l.call(u)}function Ky(l,u){var p=l.callbacks;if(p!==null)for(l.callbacks=null,l=0;l<p.length;l++)Yy(p[l],u)}var Fo=Q(null),sd=Q(0);function Qy(l,u){l=Sr,q(sd,l),q(Fo,u),Sr=l|u.baseLanes}function yh(){q(sd,Sr),q(Fo,Fo.current)}function vh(){Sr=sd.current,K(Fo),K(sd)}var Vs=Q(null),pa=null;function ni(l){var u=l.alternate;q(Hn,Hn.current&1),q(Vs,l),pa===null&&(u===null||Fo.current!==null||u.memoizedState!==null)&&(pa=l)}function wh(l){q(Hn,Hn.current),q(Vs,l),pa===null&&(pa=l)}function Xy(l){l.tag===22?(q(Hn,Hn.current),q(Vs,l),pa===null&&(pa=l)):si()}function si(){q(Hn,Hn.current),q(Vs,Vs.current)}function Gs(l){K(Vs),pa===l&&(pa=null),K(Hn)}var Hn=Q(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||Nm(p)||Tm(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,zo=!1,qi=!1,id=0,ac=0,$o=null,y_=0;function In(){throw Error(s(321))}function kh(l,u){if(u===null)return!1;for(var p=0;p<u.length&&p<l.length;p++)if(!Ws(l[p],u[p]))return!1;return!0}function Sh(l,u,p,g,w,A){return mr=A,Ht=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,F.H=l===null||l.memoizedState===null?Ov:Bh,qi=!1,A=p(g,w),qi=!1,zo&&(A=Zy(u,p,g,w)),Jy(l),A}function Jy(l){F.H=oc;var u=yn!==null&&yn.next!==null;if(mr=0,Yn=yn=Ht=null,rd=!1,ac=0,$o=null,u)throw Error(s(300));l===null||Kn||(l=l.dependencies,l!==null&&Qu(l)&&(Kn=!0))}function Zy(l,u,p,g){Ht=l;var w=0;do{if(zo&&($o=null),ac=0,zo=!1,25<=w)throw Error(s(301));if(w+=1,Yn=yn=null,l.updateQueue!=null){var A=l.updateQueue;A.lastEffect=null,A.events=null,A.stores=null,A.memoCache!=null&&(A.memoCache.index=0)}F.H=Lv,A=u(p,g)}while(zo);return A}function v_(){var l=F.H,u=l.useState()[0];return u=typeof u.then=="function"?rc(u):u,l=l.useState()[0],(yn!==null?yn.memoizedState:null)!==l&&(Ht.flags|=1024),u}function Ch(){var l=id!==0;return id=0,l}function Ah(l,u,p){u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~p}function jh(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,zo=!1,ac=id=0,$o=null}function Ss(){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 rc(l){var u=ac;return ac+=1,$o===null&&($o=[]),l=Uy($o,l,u),u=Ht,(Yn===null?u.memoizedState:Yn.next)===null&&(u=u.alternate,F.H=u===null||u.memoizedState===null?Ov:Bh),l}function ld(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return rc(l);if(l.$$typeof===j)return ds(l)}throw Error(s(438,String(l)))}function Nh(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 Th(u,yn,l)}function Th(l,u,p){var g=l.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=p;var w=l.baseQueue,A=g.pending;if(A!==null){if(w!==null){var P=w.next;w.next=A.next,A.next=P}u.baseQueue=w=A,g.pending=null}if(A=l.baseState,w===null)l.memoizedState=A;else{u=w.next;var G=P=null,re=null,De=u,Ye=!1;do{var Je=De.lane&-536870913;if(Je!==De.lane?(nn&Je)===Je:(mr&Je)===Je){var Ie=De.revertLane;if(Ie===0)re!==null&&(re=re.next={lane:0,revertLane:0,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),Je===Lo&&(Ye=!0);else if((mr&Ie)===Ie){De=De.next,Ie===Lo&&(Ye=!0);continue}else Je={lane:0,revertLane:De.revertLane,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},re===null?(G=re=Je,P=A):re=re.next=Je,Ht.lanes|=Ie,ii|=Ie;Je=De.action,qi&&p(A,Je),A=De.hasEagerState?De.eagerState:p(A,Je)}else Ie={lane:Je,revertLane:De.revertLane,gesture:De.gesture,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},re===null?(G=re=Ie,P=A):re=re.next=Ie,Ht.lanes|=Je,ii|=Je;De=De.next}while(De!==null&&De!==u);if(re===null?P=A:re.next=G,!Ws(A,l.memoizedState)&&(Kn=!0,Ye&&(p=Po,p!==null)))throw p;l.memoizedState=A,l.baseState=P,l.baseQueue=re,g.lastRenderedState=A}return w===null&&(g.lanes=0),[l.memoizedState,g.dispatch]}function _h(l){var u=Un(),p=u.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=l;var g=p.dispatch,w=p.pending,A=u.memoizedState;if(w!==null){p.pending=null;var P=w=w.next;do A=l(A,P.action),P=P.next;while(P!==w);Ws(A,u.memoizedState)||(Kn=!0),u.memoizedState=A,u.baseQueue===null&&(u.baseState=A),p.lastRenderedState=A}return[A,g]}function ev(l,u,p){var g=Ht,w=Un(),A=rn;if(A){if(p===void 0)throw Error(s(407));p=p()}else p=u();var P=!Ws((yn||w).memoizedState,p);if(P&&(w.memoizedState=p,Kn=!0),w=w.queue,Dh(sv.bind(null,g,w,l),[l]),w.getSnapshot!==u||P||Yn!==null&&Yn.memoizedState.tag&1){if(g.flags|=2048,Ho(9,{destroy:void 0},nv.bind(null,g,w,p,u),null),Cn===null)throw Error(s(349));A||(mr&127)!==0||tv(g,u,p)}return p}function tv(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 nv(l,u,p,g){u.value=p,u.getSnapshot=g,av(u)&&rv(l)}function sv(l,u,p){return p(function(){av(u)&&rv(l)})}function av(l){var u=l.getSnapshot;l=l.value;try{var p=u();return!Ws(l,p)}catch{return!0}}function rv(l){var u=Pi(l,2);u!==null&&Ps(u,l,2)}function Eh(l){var u=Ss();if(typeof l=="function"){var p=l;if(l=p(),qi){le(!0);try{p()}finally{le(!1)}}}return u.memoizedState=u.baseState=l,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:l},u}function iv(l,u,p,g){return l.baseState=p,Th(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 A={payload:w,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){A.listeners.push(P)}};F.T!==null?p(!0):A.isTransition=!1,g(A),p=u.pending,p===null?(A.next=u.pending=A,ov(u,A)):(A.next=p.next,u.pending=p.next=A)}}function ov(l,u){var p=u.action,g=u.payload,w=l.state;if(u.isTransition){var A=F.T,P={};F.T=P;try{var G=p(w,g),re=F.S;re!==null&&re(P,G),lv(l,u,G)}catch(De){Mh(l,u,De)}finally{A!==null&&P.types!==null&&(A.types=P.types),F.T=A}}else try{A=p(w,g),lv(l,u,A)}catch(De){Mh(l,u,De)}}function lv(l,u,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(g){cv(l,u,g)},function(g){return Mh(l,u,g)}):cv(l,u,p)}function cv(l,u,p){u.status="fulfilled",u.value=p,uv(u),l.state=p,u=l.pending,u!==null&&(p=u.next,p===u?l.pending=null:(p=p.next,u.next=p,ov(l,p)))}function Mh(l,u,p){var g=l.pending;if(l.pending=null,g!==null){g=g.next;do u.status="rejected",u.reason=p,uv(u),u=u.next;while(u!==g)}l.action=null}function uv(l){l=l.listeners;for(var u=0;u<l.length;u++)(0,l[u])()}function dv(l,u){return u}function fv(l,u){if(rn){var p=Cn.formState;if(p!==null){e:{var g=Ht;if(rn){if(En){t:{for(var w=En,A=fa;w.nodeType!==8;){if(!A){w=null;break t}if(w=ha(w.nextSibling),w===null){w=null;break t}}A=w.data,w=A==="F!"||A==="F"?w:null}if(w){En=ha(w.nextSibling),g=w.data==="F!";break e}}Xr(g)}g=!1}g&&(u=p[0])}}return p=Ss(),p.memoizedState=p.baseState=u,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dv,lastRenderedState:u},p.queue=g,p=Mv.bind(null,Ht,g),g.dispatch=p,g=Eh(!1),A=Ih.bind(null,Ht,!1,g.queue),g=Ss(),w={state:u,dispatch:null,action:l,pending:null},g.queue=w,p=w_.bind(null,Ht,w,A,p),w.dispatch=p,g.memoizedState=l,[u,p,!1]}function pv(l){var u=Un();return hv(u,yn,l)}function hv(l,u,p){if(u=Th(l,u,dv)[0],l=cd(gr)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var g=rc(u)}catch(P){throw P===Io?Zu:P}else g=u;u=Un();var w=u.queue,A=w.dispatch;return p!==u.memoizedState&&(Ht.flags|=2048,Ho(9,{destroy:void 0},k_.bind(null,w,p),null)),[g,A,l]}function k_(l,u){l.action=u}function mv(l){var u=Un(),p=yn;if(p!==null)return hv(u,p,l);Un(),u=u.memoizedState,p=Un();var g=p.queue.dispatch;return p.memoizedState=l,[u,g,!1]}function Ho(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 gv(){return Un().memoizedState}function ud(l,u,p,g){var w=Ss();Ht.flags|=l,w.memoizedState=Ho(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 A=w.memoizedState.inst;yn!==null&&g!==null&&kh(g,yn.memoizedState.deps)?w.memoizedState=Ho(u,A,p,g):(Ht.flags|=l,w.memoizedState=Ho(1|u,A,p,g))}function bv(l,u){ud(8390656,8,l,u)}function Dh(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 xv(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 yv(l,u){return dd(4,2,l,u)}function vv(l,u){return dd(4,4,l,u)}function wv(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 kv(l,u,p){p=p!=null?p.concat([l]):null,dd(4,4,wv.bind(null,u,l),p)}function Rh(){}function Sv(l,u){var p=Un();u=u===void 0?null:u;var g=p.memoizedState;return u!==null&&kh(u,g[1])?g[0]:(p.memoizedState=[l,u],l)}function Cv(l,u){var p=Un();u=u===void 0?null:u;var g=p.memoizedState;if(u!==null&&kh(u,g[1]))return g[0];if(g=l(),qi){le(!0);try{l()}finally{le(!1)}}return p.memoizedState=[g,u],g}function Oh(l,u,p){return p===void 0||(mr&1073741824)!==0&&(nn&261930)===0?l.memoizedState=u:(l.memoizedState=p,l=Aw(),Ht.lanes|=l,ii|=l,p)}function Av(l,u,p,g){return Ws(p,u)?p:Fo.current!==null?(l=Oh(l,p,g),Ws(l,u)||(Kn=!0),l):(mr&42)===0||(mr&1073741824)!==0&&(nn&261930)===0?(Kn=!0,l.memoizedState=p):(l=Aw(),Ht.lanes|=l,ii|=l,u)}function jv(l,u,p,g,w){var A=W.p;W.p=A!==0&&8>A?A:8;var P=F.T,G={};F.T=G,Ih(l,!1,u,p);try{var re=w(),De=F.S;if(De!==null&&De(G,re),re!==null&&typeof re=="object"&&typeof re.then=="function"){var Ye=x_(re,g);ic(l,u,Ye,Qs(l))}else ic(l,u,g,Qs(l))}catch(Je){ic(l,u,{then:function(){},status:"rejected",reason:Je},Qs())}finally{W.p=A,P!==null&&G.types!==null&&(P.types=G.types),F.T=P}}function C_(){}function Lh(l,u,p,g){if(l.tag!==5)throw Error(s(476));var w=Nv(l).queue;jv(l,w,u,V,p===null?C_:function(){return Tv(l),p(g)})}function Nv(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 Tv(l){var u=Nv(l);u.next===null&&(u=l.alternate.memoizedState),ic(l,u.next.queue,{},Qs())}function Ph(){return ds(Sc)}function _v(){return Un().memoizedState}function Ev(){return Un().memoizedState}function A_(l){for(var u=l.return;u!==null;){switch(u.tag){case 24:case 3:var p=Qs();l=ei(p);var g=ti(u,l,p);g!==null&&(Ps(g,u,p),tc(g,u,p)),u={cache:dh()},l.payload=u;return}u=u.return}}function j_(l,u,p){var g=Qs();p={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},fd(l)?Dv(u,p):(p=eh(l,u,p,g),p!==null&&(Ps(p,l,g),Rv(p,u,g)))}function Mv(l,u,p){var g=Qs();ic(l,u,p,g)}function ic(l,u,p,g){var w={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(fd(l))Dv(u,w);else{var A=l.alternate;if(l.lanes===0&&(A===null||A.lanes===0)&&(A=u.lastRenderedReducer,A!==null))try{var P=u.lastRenderedState,G=A(P,p);if(w.hasEagerState=!0,w.eagerState=G,Ws(G,P))return Vu(l,u,w,0),Cn===null&&qu(),!1}catch{}finally{}if(p=eh(l,u,w,g),p!==null)return Ps(p,l,g),Rv(p,u,g),!0}return!1}function Ih(l,u,p,g){if(g={lane:2,revertLane:mm(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},fd(l)){if(u)throw Error(s(479))}else u=eh(l,p,g,2),u!==null&&Ps(u,l,2)}function fd(l){var u=l.alternate;return l===Ht||u!==null&&u===Ht}function Dv(l,u){zo=rd=!0;var p=l.pending;p===null?u.next=u:(u.next=p.next,p.next=u),l.pending=u}function Rv(l,u,p){if((p&4194048)!==0){var g=u.lanes;g&=l.pendingLanes,p|=g,u.lanes=p,Nt(l,p)}}var oc={readContext:ds,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};oc.useEffectEvent=In;var Ov={readContext:ds,use:ld,useCallback:function(l,u){return Ss().memoizedState=[l,u===void 0?null:u],l},useContext:ds,useEffect:bv,useImperativeHandle:function(l,u,p){p=p!=null?p.concat([l]):null,ud(4194308,4,wv.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=Ss();u=u===void 0?null:u;var g=l();if(qi){le(!0);try{l()}finally{le(!1)}}return p.memoizedState=[g,u],g},useReducer:function(l,u,p){var g=Ss();if(p!==void 0){var w=p(u);if(qi){le(!0);try{p(u)}finally{le(!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=Ss();return l={current:l},u.memoizedState=l},useState:function(l){l=Eh(l);var u=l.queue,p=Mv.bind(null,Ht,u);return u.dispatch=p,[l.memoizedState,p]},useDebugValue:Rh,useDeferredValue:function(l,u){var p=Ss();return Oh(p,l,u)},useTransition:function(){var l=Eh(!1);return l=jv.bind(null,Ht,l.queue,!0,!1),Ss().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,u,p){var g=Ht,w=Ss();if(rn){if(p===void 0)throw Error(s(407));p=p()}else{if(p=u(),Cn===null)throw Error(s(349));(nn&127)!==0||tv(g,u,p)}w.memoizedState=p;var A={value:p,getSnapshot:u};return w.queue=A,bv(sv.bind(null,g,A,l),[l]),g.flags|=2048,Ho(9,{destroy:void 0},nv.bind(null,g,A,p,u),null),p},useId:function(){var l=Ss(),u=Cn.identifierPrefix;if(rn){var p=$a,g=za;p=(g&~(1<<32-me(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:Ph,useFormState:fv,useActionState:fv,useOptimistic:function(l){var u=Ss();u.memoizedState=u.baseState=l;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=p,u=Ih.bind(null,Ht,!0,p),p.dispatch=u,[l,u]},useMemoCache:Nh,useCacheRefresh:function(){return Ss().memoizedState=A_.bind(null,Ht)},useEffectEvent:function(l){var u=Ss(),p={impl:l};return u.memoizedState=p,function(){if((pn&2)!==0)throw Error(s(440));return p.impl.apply(void 0,arguments)}}},Bh={readContext:ds,use:ld,useCallback:Sv,useContext:ds,useEffect:Dh,useImperativeHandle:kv,useInsertionEffect:yv,useLayoutEffect:vv,useMemo:Cv,useReducer:cd,useRef:gv,useState:function(){return cd(gr)},useDebugValue:Rh,useDeferredValue:function(l,u){var p=Un();return Av(p,yn.memoizedState,l,u)},useTransition:function(){var l=cd(gr)[0],u=Un().memoizedState;return[typeof l=="boolean"?l:rc(l),u]},useSyncExternalStore:ev,useId:_v,useHostTransitionStatus:Ph,useFormState:pv,useActionState:pv,useOptimistic:function(l,u){var p=Un();return iv(p,yn,l,u)},useMemoCache:Nh,useCacheRefresh:Ev};Bh.useEffectEvent=xv;var Lv={readContext:ds,use:ld,useCallback:Sv,useContext:ds,useEffect:Dh,useImperativeHandle:kv,useInsertionEffect:yv,useLayoutEffect:vv,useMemo:Cv,useReducer:_h,useRef:gv,useState:function(){return _h(gr)},useDebugValue:Rh,useDeferredValue:function(l,u){var p=Un();return yn===null?Oh(p,l,u):Av(p,yn.memoizedState,l,u)},useTransition:function(){var l=_h(gr)[0],u=Un().memoizedState;return[typeof l=="boolean"?l:rc(l),u]},useSyncExternalStore:ev,useId:_v,useHostTransitionStatus:Ph,useFormState:mv,useActionState:mv,useOptimistic:function(l,u){var p=Un();return yn!==null?iv(p,yn,l,u):(p.baseState=l,[l,p.queue.dispatch])},useMemoCache:Nh,useCacheRefresh:Ev};Lv.useEffectEvent=xv;function Fh(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 zh={enqueueSetState:function(l,u,p){l=l._reactInternals;var g=Qs(),w=ei(g);w.payload=u,p!=null&&(w.callback=p),u=ti(l,w,g),u!==null&&(Ps(u,l,g),tc(u,l,g))},enqueueReplaceState:function(l,u,p){l=l._reactInternals;var g=Qs(),w=ei(g);w.tag=1,w.payload=u,p!=null&&(w.callback=p),u=ti(l,w,g),u!==null&&(Ps(u,l,g),tc(u,l,g))},enqueueForceUpdate:function(l,u){l=l._reactInternals;var p=Qs(),g=ei(p);g.tag=2,u!=null&&(g.callback=u),u=ti(l,g,p),u!==null&&(Ps(u,l,p),tc(u,l,p))}};function Pv(l,u,p,g,w,A,P){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(g,A,P):u.prototype&&u.prototype.isPureReactComponent?!Gl(p,g)||!Gl(w,A):!0}function Iv(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&&zh.enqueueReplaceState(u,u.state,null)}function Vi(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 Bv(l){Wu(l)}function Fv(l){console.error(l)}function zv(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 $v(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 $h(l,u,p){return p=ei(p),p.tag=3,p.payload={element:null},p.callback=function(){pd(l,u)},p}function Hv(l){return l=ei(l),l.tag=3,l}function Uv(l,u,p,g){var w=p.type.getDerivedStateFromError;if(typeof w=="function"){var A=g.value;l.payload=function(){return w(A)},l.callback=function(){$v(u,p,g)}}var P=p.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(l.callback=function(){$v(u,p,g),typeof w!="function"&&(oi===null?oi=new Set([this]):oi.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&&Oo(u,p,w,!0),p=Vs.current,p!==null){switch(p.tag){case 31:case 13:return pa===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),fm(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)),fm(l,g,w)),!1}throw Error(s(435,p.tag))}return fm(l,g,w),Ad(),!1}if(rn)return u=Vs.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=w,g!==ih&&(l=Error(s(422),{cause:g}),Ql(ca(l,p)))):(g!==ih&&(u=Error(s(423),{cause:g}),Ql(ca(u,p))),l=l.current.alternate,l.flags|=65536,w&=-w,l.lanes|=w,g=ca(g,p),w=$h(l.stateNode,g,w),bh(l,w),Bn!==4&&(Bn=2)),!1;var A=Error(s(520),{cause:g});if(A=ca(A,p),mc===null?mc=[A]:mc.push(A),Bn!==4&&(Bn=2),u===null)return!0;g=ca(g,p),p=u;do{switch(p.tag){case 3:return p.flags|=65536,l=w&-w,p.lanes|=l,l=$h(p.stateNode,g,l),bh(p,l),!1;case 1:if(u=p.type,A=p.stateNode,(p.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||A!==null&&typeof A.componentDidCatch=="function"&&(oi===null||!oi.has(A))))return p.flags|=65536,w&=-w,p.lanes|=w,w=Hv(w),Uv(w,l,p,g),bh(p,w),!1}p=p.return}while(p!==null);return!1}var Hh=Error(s(461)),Kn=!1;function fs(l,u,p,g){u.child=l===null?Gy(u,null,p,g):Wi(u,l.child,p,g)}function Wv(l,u,p,g,w){p=p.render;var A=u.ref;if("ref"in g){var P={};for(var G in g)G!=="ref"&&(P[G]=g[G])}else P=g;return zi(u),g=Sh(l,u,p,P,A,w),G=Ch(),l!==null&&!Kn?(Ah(l,u,w),br(l,u,w)):(rn&&G&&ah(u),u.flags|=1,fs(l,u,g,w),u.child)}function qv(l,u,p,g,w){if(l===null){var A=p.type;return typeof A=="function"&&!th(A)&&A.defaultProps===void 0&&p.compare===null?(u.tag=15,u.type=A,Vv(l,u,A,g,w)):(l=Yu(p.type,null,g,u,u.mode,w),l.ref=u.ref,l.return=u,u.child=l)}if(A=l.child,!Qh(l,w)){var P=A.memoizedProps;if(p=p.compare,p=p!==null?p:Gl,p(P,g)&&l.ref===u.ref)return br(l,u,w)}return u.flags|=1,l=dr(A,g),l.ref=u.ref,l.return=u,u.child=l}function Vv(l,u,p,g,w){if(l!==null){var A=l.memoizedProps;if(Gl(A,g)&&l.ref===u.ref)if(Kn=!1,u.pendingProps=g=A,Qh(l,w))(l.flags&131072)!==0&&(Kn=!0);else return u.lanes=l.lanes,br(l,u,w)}return Uh(l,u,p,g,w)}function Gv(l,u,p,g){var w=g.children,A=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(A=A!==null?A.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&~A}else g=0,u.child=null;return Yv(l,u,A,p,g)}if((p&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},l!==null&&Ju(u,A!==null?A.cachePool:null),A!==null?Qy(u,A):yh(),Xy(u);else return g=u.lanes=536870912,Yv(l,u,A!==null?A.baseLanes|p:p,p,g)}else A!==null?(Ju(u,A.cachePool),Qy(u,A),si(),u.memoizedState=null):(l!==null&&Ju(u,null),yh(),si());return fs(l,u,w,p),u.child}function lc(l,u){return l!==null&&l.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function Yv(l,u,p,g,w){var A=ph();return A=A===null?null:{parent:Gn._currentValue,pool:A},u.memoizedState={baseLanes:p,cachePool:A},l!==null&&Ju(u,null),yh(),Xy(u),l!==null&&Oo(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 Kv(l,u,p){return Wi(u,l.child,null,p),l=hd(u,u.pendingProps),l.flags|=2,Gs(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(rn){if(g.mode==="hidden")return l=hd(u,g),u.lanes=536870912,lc(null,l);if(wh(u),(l=En)?(l=o0(l,fa),l=l!==null&&l.data==="&"?l:null,l!==null&&(u.memoizedState={dehydrated:l,treeContext:Kr!==null?{id:za,overflow:$a}:null,retryLane:536870912,hydrationErrors:null},p=Dy(l),p.return=u,u.child=p,us=u,En=null)):l=null,l===null)throw Xr(u);return u.lanes=536870912,null}return hd(u,g)}var A=l.memoizedState;if(A!==null){var P=A.dehydrated;if(wh(u),w)if(u.flags&256)u.flags&=-257,u=Kv(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||Oo(l,u,p,!1),w=(p&l.childLanes)!==0,Kn||w){if(g=Cn,g!==null&&(P=zt(g,p),P!==0&&P!==A.retryLane))throw A.retryLane=P,Pi(l,P),Ps(g,l,P),Hh;Ad(),u=Kv(l,u,p)}else l=A.treeContext,En=ha(P.nextSibling),us=u,rn=!0,Qr=null,fa=!1,l!==null&&Ly(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 Uh(l,u,p,g,w){return zi(u),p=Sh(l,u,p,g,void 0,w),g=Ch(),l!==null&&!Kn?(Ah(l,u,w),br(l,u,w)):(rn&&g&&ah(u),u.flags|=1,fs(l,u,p,w),u.child)}function Qv(l,u,p,g,w,A){return zi(u),u.updateQueue=null,p=Zy(u,g,p,w),Jy(l),g=Ch(),l!==null&&!Kn?(Ah(l,u,A),br(l,u,A)):(rn&&g&&ah(u),u.flags|=1,fs(l,u,p,A),u.child)}function Xv(l,u,p,g,w){if(zi(u),u.stateNode===null){var A=Eo,P=p.contextType;typeof P=="object"&&P!==null&&(A=ds(P)),A=new p(g,A),u.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,A.updater=zh,u.stateNode=A,A._reactInternals=u,A=u.stateNode,A.props=g,A.state=u.memoizedState,A.refs={},mh(u),P=p.contextType,A.context=typeof P=="object"&&P!==null?ds(P):Eo,A.state=u.memoizedState,P=p.getDerivedStateFromProps,typeof P=="function"&&(Fh(u,p,P,g),A.state=u.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(P=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),P!==A.state&&zh.enqueueReplaceState(A,A.state,null),sc(u,g,A,w),nc(),A.state=u.memoizedState),typeof A.componentDidMount=="function"&&(u.flags|=4194308),g=!0}else if(l===null){A=u.stateNode;var G=u.memoizedProps,re=Vi(p,G);A.props=re;var De=A.context,Ye=p.contextType;P=Eo,typeof Ye=="object"&&Ye!==null&&(P=ds(Ye));var Je=p.getDerivedStateFromProps;Ye=typeof Je=="function"||typeof A.getSnapshotBeforeUpdate=="function",G=u.pendingProps!==G,Ye||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(G||De!==P)&&Iv(u,A,g,P),Zr=!1;var Ie=u.memoizedState;A.state=Ie,sc(u,g,A,w),nc(),De=u.memoizedState,G||Ie!==De||Zr?(typeof Je=="function"&&(Fh(u,p,Je,g),De=u.memoizedState),(re=Zr||Pv(u,p,re,g,Ie,De,P))?(Ye||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(u.flags|=4194308)):(typeof A.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=g,u.memoizedState=De),A.props=g,A.state=De,A.context=P,g=re):(typeof A.componentDidMount=="function"&&(u.flags|=4194308),g=!1)}else{A=u.stateNode,gh(l,u),P=u.memoizedProps,Ye=Vi(p,P),A.props=Ye,Je=u.pendingProps,Ie=A.context,De=p.contextType,re=Eo,typeof De=="object"&&De!==null&&(re=ds(De)),G=p.getDerivedStateFromProps,(De=typeof G=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(P!==Je||Ie!==re)&&Iv(u,A,g,re),Zr=!1,Ie=u.memoizedState,A.state=Ie,sc(u,g,A,w),nc();var Ue=u.memoizedState;P!==Je||Ie!==Ue||Zr||l!==null&&l.dependencies!==null&&Qu(l.dependencies)?(typeof G=="function"&&(Fh(u,p,G,g),Ue=u.memoizedState),(Ye=Zr||Pv(u,p,Ye,g,Ie,Ue,re)||l!==null&&l.dependencies!==null&&Qu(l.dependencies))?(De||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,Ue,re),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,Ue,re)),typeof A.componentDidUpdate=="function"&&(u.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof A.componentDidUpdate!="function"||P===l.memoizedProps&&Ie===l.memoizedState||(u.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||P===l.memoizedProps&&Ie===l.memoizedState||(u.flags|=1024),u.memoizedProps=g,u.memoizedState=Ue),A.props=g,A.state=Ue,A.context=re,g=Ye):(typeof A.componentDidUpdate!="function"||P===l.memoizedProps&&Ie===l.memoizedState||(u.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||P===l.memoizedProps&&Ie===l.memoizedState||(u.flags|=1024),g=!1)}return A=g,md(l,u),g=(u.flags&128)!==0,A||g?(A=u.stateNode,p=g&&typeof p.getDerivedStateFromError!="function"?null:A.render(),u.flags|=1,l!==null&&g?(u.child=Wi(u,l.child,null,w),u.child=Wi(u,null,p,w)):fs(l,u,p,w),u.memoizedState=A.state,l=u.child):l=br(l,u,w),l}function Jv(l,u,p,g){return Bi(),u.flags|=256,fs(l,u,p,g),u.child}var Wh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qh(l){return{baseLanes:l,cachePool:$y()}}function Vh(l,u,p){return l=l!==null?l.childLanes&~p:0,u&&(l|=Ks),l}function Zv(l,u,p){var g=u.pendingProps,w=!1,A=(u.flags&128)!==0,P;if((P=A)||(P=l!==null&&l.memoizedState===null?!1:(Hn.current&2)!==0),P&&(w=!0,u.flags&=-129),P=(u.flags&32)!==0,u.flags&=-33,l===null){if(rn){if(w?ni(u):si(),(l=En)?(l=o0(l,fa),l=l!==null&&l.data!=="&"?l:null,l!==null&&(u.memoizedState={dehydrated:l,treeContext:Kr!==null?{id:za,overflow:$a}:null,retryLane:536870912,hydrationErrors:null},p=Dy(l),p.return=u,u.child=p,us=u,En=null)):l=null,l===null)throw Xr(u);return Tm(l)?u.lanes=32:u.lanes=536870912,null}var G=g.children;return g=g.fallback,w?(si(),w=u.mode,G=gd({mode:"hidden",children:G},w),g=Ii(g,w,p,null),G.return=u,g.return=u,G.sibling=g,u.child=G,g=u.child,g.memoizedState=qh(p),g.childLanes=Vh(l,P,p),u.memoizedState=Wh,lc(null,g)):(ni(u),Gh(u,G))}var re=l.memoizedState;if(re!==null&&(G=re.dehydrated,G!==null)){if(A)u.flags&256?(ni(u),u.flags&=-257,u=Yh(l,u,p)):u.memoizedState!==null?(si(),u.child=l.child,u.flags|=128,u=null):(si(),G=g.fallback,w=u.mode,g=gd({mode:"visible",children:g.children},w),G=Ii(G,w,p,null),G.flags|=2,g.return=u,G.return=u,g.sibling=G,u.child=g,Wi(u,l.child,null,p),g=u.child,g.memoizedState=qh(p),g.childLanes=Vh(l,P,p),u.memoizedState=Wh,u=lc(null,g));else if(ni(u),Tm(G)){if(P=G.nextSibling&&G.nextSibling.dataset,P)var De=P.dgst;P=De,g=Error(s(419)),g.stack="",g.digest=P,Ql({value:g,source:null,stack:null}),u=Yh(l,u,p)}else if(Kn||Oo(l,u,p,!1),P=(p&l.childLanes)!==0,Kn||P){if(P=Cn,P!==null&&(g=zt(P,p),g!==0&&g!==re.retryLane))throw re.retryLane=g,Pi(l,g),Ps(P,l,g),Hh;Nm(G)||Ad(),u=Yh(l,u,p)}else Nm(G)?(u.flags|=192,u.child=l.child,u=null):(l=re.treeContext,En=ha(G.nextSibling),us=u,rn=!0,Qr=null,fa=!1,l!==null&&Ly(u,l),u=Gh(u,g.children),u.flags|=4096);return u}return w?(si(),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=Ii(G,w,p,null),G.flags|=2),G.return=u,g.return=u,g.sibling=G,u.child=g,lc(null,g),g=u.child,G=l.child.memoizedState,G===null?G=qh(p):(w=G.cachePool,w!==null?(re=Gn._currentValue,w=w.parent!==re?{parent:re,pool:re}:w):w=$y(),G={baseLanes:G.baseLanes|p,cachePool:w}),g.memoizedState=G,g.childLanes=Vh(l,P,p),u.memoizedState=Wh,lc(l.child,g)):(ni(u),p=l.child,l=p.sibling,p=dr(p,{mode:"visible",children:g.children}),p.return=u,p.sibling=null,l!==null&&(P=u.deletions,P===null?(u.deletions=[l],u.flags|=16):P.push(l)),u.child=p,u.memoizedState=null,p)}function Gh(l,u){return u=gd({mode:"visible",children:u},l.mode),u.return=l,l.child=u}function gd(l,u){return l=qs(22,l,null,u),l.lanes=0,l}function Yh(l,u,p){return Wi(u,l.child,null,p),l=Gh(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function ew(l,u,p){l.lanes|=u;var g=l.alternate;g!==null&&(g.lanes|=u),ch(l.return,u,p)}function Kh(l,u,p,g,w,A){var P=l.memoizedState;P===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:g,tail:p,tailMode:w,treeForkCount:A}:(P.isBackwards=u,P.rendering=null,P.renderingStartTime=0,P.last=g,P.tail=p,P.tailMode=w,P.treeForkCount=A)}function tw(l,u,p){var g=u.pendingProps,w=g.revealOrder,A=g.tail;g=g.children;var P=Hn.current,G=(P&2)!==0;if(G?(P=P&1|2,u.flags|=128):P&=1,q(Hn,P),fs(l,u,g,p),g=rn?Kl:0,!G&&l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&ew(l,p,u);else if(l.tag===19)ew(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),Kh(u,!1,w,p,A,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}Kh(u,!0,p,null,A,g);break;case"together":Kh(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),ii|=u.lanes,(p&u.childLanes)===0)if(l!==null){if(Oo(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 Qh(l,u){return(l.lanes&u)!==0?!0:(l=l.dependencies,!!(l!==null&&Qu(l)))}function __(l,u,p){switch(u.tag){case 3:je(u,u.stateNode.containerInfo),Jr(u,Gn,l.memoizedState.cache),Bi();break;case 27:case 5:Ee(u);break;case 4:je(u,u.stateNode.containerInfo);break;case 10:Jr(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,wh(u),null;break;case 13:var g=u.memoizedState;if(g!==null)return g.dehydrated!==null?(ni(u),u.flags|=128,null):(p&u.child.childLanes)!==0?Zv(l,u,p):(ni(u),l=br(l,u,p),l!==null?l.sibling:null);ni(u);break;case 19:var w=(l.flags&128)!==0;if(g=(p&u.childLanes)!==0,g||(Oo(l,u,p,!1),g=(p&u.childLanes)!==0),w){if(g)return tw(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,Gv(l,u,p,u.pendingProps);case 24:Jr(u,Gn,l.memoizedState.cache)}return br(l,u,p)}function nw(l,u,p){if(l!==null)if(l.memoizedProps!==u.pendingProps)Kn=!0;else{if(!Qh(l,p)&&(u.flags&128)===0)return Kn=!1,__(l,u,p);Kn=(l.flags&131072)!==0}else Kn=!1,rn&&(u.flags&1048576)!==0&&Oy(u,Kl,u.index);switch(u.lanes=0,u.tag){case 16:e:{var g=u.pendingProps;if(l=Hi(u.elementType),u.type=l,typeof l=="function")th(l)?(g=Vi(l,g),u.tag=1,u=Xv(null,u,l,g,p)):(u.tag=0,u=Uh(null,u,l,g,p));else{if(l!=null){var w=l.$$typeof;if(w===_){u.tag=11,u=Wv(null,u,l,g,p);break e}else if(w===I){u.tag=14,u=qv(null,u,l,g,p);break e}}throw u=U(l)||l,Error(s(306,u,""))}}return u;case 0:return Uh(l,u,u.type,u.pendingProps,p);case 1:return g=u.type,w=Vi(g,u.pendingProps),Xv(l,u,g,w,p);case 3:e:{if(je(u,u.stateNode.containerInfo),l===null)throw Error(s(387));g=u.pendingProps;var A=u.memoizedState;w=A.element,gh(l,u),sc(u,g,null,p);var P=u.memoizedState;if(g=P.cache,Jr(u,Gn,g),g!==A.cache&&uh(u,[Gn],p,!0),nc(),g=P.element,A.isDehydrated)if(A={element:g,isDehydrated:!1,cache:P.cache},u.updateQueue.baseState=A,u.memoizedState=A,u.flags&256){u=Jv(l,u,g,p);break e}else if(g!==w){w=ca(Error(s(424)),u),Ql(w),u=Jv(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(En=ha(l.firstChild),us=u,rn=!0,Qr=null,fa=!0,p=Gy(u,null,g,p),u.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Bi(),g===w){u=br(l,u,p);break e}fs(l,u,g,p)}u=u.child}return u;case 26:return md(l,u),l===null?(p=p0(u.type,null,u.pendingProps,null))?u.memoizedState=p:rn||(p=u.type,l=u.pendingProps,g=Dd(ee.current).createElement(p),g[xt]=u,g[Mt]=l,ps(g,p,l),fn(g),u.stateNode=g):u.memoizedState=p0(u.type,l.memoizedProps,u.pendingProps,l.memoizedState),null;case 27:return Ee(u),l===null&&rn&&(g=u.stateNode=u0(u.type,u.pendingProps,ee.current),us=u,fa=!0,w=En,di(u.type)?(_m=w,En=ha(g.firstChild)):En=w),fs(l,u,u.pendingProps.children,p),md(l,u),l===null&&(u.flags|=4194304),u.child;case 5:return l===null&&rn&&((w=g=En)&&(g=rE(g,u.type,u.pendingProps,fa),g!==null?(u.stateNode=g,us=u,En=ha(g.firstChild),fa=!1,w=!0):w=!1),w||Xr(u)),Ee(u),w=u.type,A=u.pendingProps,P=l!==null?l.memoizedProps:null,g=A.children,Cm(w,A)?g=null:P!==null&&Cm(w,P)&&(u.flags|=32),u.memoizedState!==null&&(w=Sh(l,u,v_,null,null,p),Sc._currentValue=w),md(l,u),fs(l,u,g,p),u.child;case 6:return l===null&&rn&&((l=p=En)&&(p=iE(p,u.pendingProps,fa),p!==null?(u.stateNode=p,us=u,En=null,l=!0):l=!1),l||Xr(u)),null;case 13:return Zv(l,u,p);case 4:return je(u,u.stateNode.containerInfo),g=u.pendingProps,l===null?u.child=Wi(u,null,g,p):fs(l,u,g,p),u.child;case 11:return Wv(l,u,u.type,u.pendingProps,p);case 7:return fs(l,u,u.pendingProps,p),u.child;case 8:return fs(l,u,u.pendingProps.children,p),u.child;case 12:return fs(l,u,u.pendingProps.children,p),u.child;case 10:return g=u.pendingProps,Jr(u,u.type,g.value),fs(l,u,g.children,p),u.child;case 9:return w=u.type._context,g=u.pendingProps.children,zi(u),w=ds(w),g=g(w),u.flags|=1,fs(l,u,g,p),u.child;case 14:return qv(l,u,u.type,u.pendingProps,p);case 15:return Vv(l,u,u.type,u.pendingProps,p);case 19:return tw(l,u,p);case 31:return T_(l,u,p);case 22:return Gv(l,u,p,u.pendingProps);case 24:return zi(u),g=ds(Gn),l===null?(w=ph(),w===null&&(w=Cn,A=dh(),w.pooledCache=A,A.refCount++,A!==null&&(w.pooledCacheLanes|=p),w=A),u.memoizedState={parent:g,cache:w},mh(u),Jr(u,Gn,w)):((l.lanes&p)!==0&&(gh(l,u),sc(u,null,null,p),nc()),w=l.memoizedState,A=u.memoizedState,w.parent!==g?(w={parent:g,cache:g},u.memoizedState=w,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=w),Jr(u,Gn,g)):(g=A.cache,Jr(u,Gn,g),g!==w.cache&&uh(u,[Gn],p,!0))),fs(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 Xh(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(_w())l.flags|=8192;else throw Ui=ed,hh}else l.flags&=-16777217}function sw(l,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)l.flags&=-16777217;else if(l.flags|=16777216,!x0(u))if(_w())l.flags|=8192;else throw Ui=ed,hh}function bd(l,u){u!==null&&(l.flags|=4),l.flags&16384&&(u=l.tag!==22?jt():536870912,l.lanes|=u,Vo|=u)}function cc(l,u){if(!rn)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 Mn(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(rh(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mn(u),null;case 1:return Mn(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),ge(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(l===null||l.child===null)&&(Ro(u)?xr(u):l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,oh())),Mn(u),null;case 26:var w=u.type,A=u.memoizedState;return l===null?(xr(u),A!==null?(Mn(u),sw(u,A)):(Mn(u),Xh(u,w,null,g,p))):A?A!==l.memoizedState?(xr(u),Mn(u),sw(u,A)):(Mn(u),u.flags&=-16777217):(l=l.memoizedProps,l!==g&&xr(u),Mn(u),Xh(u,w,l,g,p)),null;case 27:if(Be(u),p=ee.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 Mn(u),null}l=xe.current,Ro(u)?Py(u):(l=u0(w,g,p),u.stateNode=l,xr(u))}return Mn(u),null;case 5:if(Be(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 Mn(u),null}if(A=xe.current,Ro(u))Py(u);else{var P=Dd(ee.current);switch(A){case 1:A=P.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:A=P.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":A=P.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":A=P.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":A=P.createElement("div"),A.innerHTML="<script><\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof g.is=="string"?P.createElement("select",{is:g.is}):P.createElement("select"),g.multiple?A.multiple=!0:g.size&&(A.size=g.size);break;default:A=typeof g.is=="string"?P.createElement(w,{is:g.is}):P.createElement(w)}}A[xt]=u,A[Mt]=g;e:for(P=u.child;P!==null;){if(P.tag===5||P.tag===6)A.appendChild(P.stateNode);else if(P.tag!==4&&P.tag!==27&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===u)break e;for(;P.sibling===null;){if(P.return===null||P.return===u)break e;P=P.return}P.sibling.return=P.return,P=P.sibling}u.stateNode=A;e:switch(ps(A,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 Mn(u),Xh(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=ee.current,Ro(u)){if(l=u.stateNode,p=u.memoizedProps,g=null,w=us,w!==null)switch(w.tag){case 27:case 5:g=w.memoizedProps}l[xt]=u,l=!!(l.nodeValue===p||g!==null&&g.suppressHydrationWarning===!0||Zw(l.nodeValue,p)),l||Xr(u,!0)}else l=Dd(l).createTextNode(g),l[xt]=u,u.stateNode=l}return Mn(u),null;case 31:if(p=u.memoizedState,l===null||l.memoizedState!==null){if(g=Ro(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[xt]=u}else Bi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Mn(u),l=!1}else p=oh(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=p),l=!0;if(!l)return u.flags&256?(Gs(u),u):(Gs(u),null);if((u.flags&128)!==0)throw Error(s(558))}return Mn(u),null;case 13:if(g=u.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(w=Ro(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[xt]=u}else Bi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Mn(u),w=!1}else w=oh(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=w),w=!0;if(!w)return u.flags&256?(Gs(u),u):(Gs(u),null)}return Gs(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),A=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(A=g.memoizedState.cachePool.pool),A!==w&&(g.flags|=2048)),p!==l&&p&&(u.child.flags|=8192),bd(u,u.updateQueue),Mn(u),null);case 4:return ge(),l===null&&ym(u.stateNode.containerInfo),Mn(u),null;case 10:return hr(u.type),Mn(u),null;case 19:if(K(Hn),g=u.memoizedState,g===null)return Mn(u),null;if(w=(u.flags&128)!==0,A=g.rendering,A===null)if(w)cc(g,!1);else{if(Bn!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(A=ad(l),A!==null){for(u.flags|=128,cc(g,!1),l=A.updateQueue,u.updateQueue=l,bd(u,l),u.subtreeFlags=0,l=p,p=u.child;p!==null;)My(p,l),p=p.sibling;return q(Hn,Hn.current&1|2),rn&&fr(u,g.treeForkCount),u.child}l=l.sibling}g.tail!==null&&ut()>kd&&(u.flags|=128,w=!0,cc(g,!1),u.lanes=4194304)}else{if(!w)if(l=ad(A),l!==null){if(u.flags|=128,w=!0,l=l.updateQueue,u.updateQueue=l,bd(u,l),cc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!A.alternate&&!rn)return Mn(u),null}else 2*ut()-g.renderingStartTime>kd&&p!==536870912&&(u.flags|=128,w=!0,cc(g,!1),u.lanes=4194304);g.isBackwards?(A.sibling=u.child,u.child=A):(l=g.last,l!==null?l.sibling=A:u.child=A,g.last=A)}return g.tail!==null?(l=g.tail,g.rendering=l,g.tail=l.sibling,g.renderingStartTime=ut(),l.sibling=null,p=Hn.current,q(Hn,w?p&1|2:p&1),rn&&fr(u,g.treeForkCount),l):(Mn(u),null);case 22:case 23:return Gs(u),vh(),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&&(Mn(u),u.subtreeFlags&6&&(u.flags|=8192)):Mn(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&&K($i),null;case 24:return p=null,l!==null&&(p=l.memoizedState.cache),u.memoizedState.cache!==p&&(u.flags|=2048),hr(Gn),Mn(u),null;case 25:return null;case 30:return null}throw Error(s(156,u.tag))}function M_(l,u){switch(rh(u),u.tag){case 1:return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return hr(Gn),ge(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 26:case 27:case 5:return Be(u),null;case 31:if(u.memoizedState!==null){if(Gs(u),u.alternate===null)throw Error(s(340));Bi()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 13:if(Gs(u),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(s(340));Bi()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return K(Hn),null;case 4:return ge(),null;case 10:return hr(u.type),null;case 22:case 23:return Gs(u),vh(),l!==null&&K($i),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 aw(l,u){switch(rh(u),u.tag){case 3:hr(Gn),ge();break;case 26:case 27:case 5:Be(u);break;case 4:ge();break;case 31:u.memoizedState!==null&&Gs(u);break;case 13:Gs(u);break;case 19:K(Hn);break;case 10:hr(u.type);break;case 22:case 23:Gs(u),vh(),l!==null&&K($i);break;case 24:hr(Gn)}}function uc(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 A=p.create,P=p.inst;g=A(),P.destroy=g}p=p.next}while(p!==w)}}catch(G){gn(u,u.return,G)}}function ai(l,u,p){try{var g=u.updateQueue,w=g!==null?g.lastEffect:null;if(w!==null){var A=w.next;g=A;do{if((g.tag&l)===l){var P=g.inst,G=P.destroy;if(G!==void 0){P.destroy=void 0,w=u;var re=p,De=G;try{De()}catch(Ye){gn(w,re,Ye)}}}g=g.next}while(g!==A)}}catch(Ye){gn(u,u.return,Ye)}}function rw(l){var u=l.updateQueue;if(u!==null){var p=l.stateNode;try{Ky(u,p)}catch(g){gn(l,l.return,g)}}}function iw(l,u,p){p.props=Vi(l.type,l.memoizedProps),p.state=l.memoizedState;try{p.componentWillUnmount()}catch(g){gn(l,u,g)}}function dc(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 Ha(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 ow(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 Jh(l,u,p){try{var g=l.stateNode;Z_(g,l.type,p,u),g[Mt]=u}catch(w){gn(l,l.return,w)}}function lw(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&di(l.type)||l.tag===4}function Zh(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||lw(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&&di(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 em(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=ja));else if(g!==4&&(g===27&&di(l.type)&&(p=l.stateNode,u=null),l=l.child,l!==null))for(em(l,u,p),l=l.sibling;l!==null;)em(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&&di(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 cw(l){var u=l.stateNode,p=l.memoizedProps;try{for(var g=l.type,w=u.attributes;w.length;)u.removeAttributeNode(w[0]);ps(u,g,p),u[xt]=l,u[Mt]=p}catch(A){gn(l,l.return,A)}}var yr=!1,Qn=!1,tm=!1,uw=typeof WeakSet=="function"?WeakSet:Set,is=null;function D_(l,u){if(l=l.containerInfo,km=Fd,l=ky(l),Yp(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,A=g.focusNode;g=g.focusOffset;try{p.nodeType,A.nodeType}catch{p=null;break e}var P=0,G=-1,re=-1,De=0,Ye=0,Je=l,Ie=null;t:for(;;){for(var Ue;Je!==p||w!==0&&Je.nodeType!==3||(G=P+w),Je!==A||g!==0&&Je.nodeType!==3||(re=P+g),Je.nodeType===3&&(P+=Je.nodeValue.length),(Ue=Je.firstChild)!==null;)Ie=Je,Je=Ue;for(;;){if(Je===l)break t;if(Ie===p&&++De===w&&(G=P),Ie===A&&++Ye===g&&(re=P),(Ue=Je.nextSibling)!==null)break;Je=Ie,Ie=Je.parentNode}Je=Ue}p=G===-1||re===-1?null:{start:G,end:re}}else p=null}p=p||{start:0,end:0}}else p=null;for(Sm={focusedElem:l,selectionRange:p},Fd=!1,is=u;is!==null;)if(u=is,l=u.child,(u.subtreeFlags&1028)!==0&&l!==null)l.return=u,is=l;else for(;is!==null;){switch(u=is,A=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&&A!==null){l=void 0,p=u,w=A.memoizedProps,A=A.memoizedState,g=p.stateNode;try{var yt=Vi(p.type,w);l=g.getSnapshotBeforeUpdate(yt,A),g.__reactInternalSnapshotBeforeUpdate=l}catch(Ot){gn(p,p.return,Ot)}}break;case 3:if((l&1024)!==0){if(l=u.stateNode.containerInfo,p=l.nodeType,p===9)jm(l);else if(p===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":jm(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,is=l;break}is=u.return}}function dw(l,u,p){var g=p.flags;switch(p.tag){case 0:case 11:case 15:wr(l,p),g&4&&uc(5,p);break;case 1:if(wr(l,p),g&4)if(l=p.stateNode,u===null)try{l.componentDidMount()}catch(P){gn(p,p.return,P)}else{var w=Vi(p.type,u.memoizedProps);u=u.memoizedState;try{l.componentDidUpdate(w,u,l.__reactInternalSnapshotBeforeUpdate)}catch(P){gn(p,p.return,P)}}g&64&&rw(p),g&512&&dc(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{Ky(l,u)}catch(P){gn(p,p.return,P)}}break;case 27:u===null&&g&4&&cw(p);case 26:case 5:wr(l,p),u===null&&g&4&&ow(p),g&512&&dc(p,p.return);break;case 12:wr(l,p);break;case 31:wr(l,p),g&4&&hw(l,p);break;case 13:wr(l,p),g&4&&mw(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 A=Qn;yr=g,(Qn=u)&&!A?kr(l,p,(p.subtreeFlags&8772)!==0):wr(l,p),yr=w,Qn=A}break;case 30:break;default:wr(l,p)}}function fw(l){var u=l.alternate;u!==null&&(l.alternate=null,fw(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&Fa(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,Ds=!1;function vr(l,u,p){for(p=p.child;p!==null;)pw(l,u,p),p=p.sibling}function pw(l,u,p){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(oe,p)}catch{}switch(p.tag){case 26:Qn||Ha(p,u),vr(l,u,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Qn||Ha(p,u);var g=Rn,w=Ds;di(p.type)&&(Rn=p.stateNode,Ds=!1),vr(l,u,p),vc(p.stateNode),Rn=g,Ds=w;break;case 5:Qn||Ha(p,u);case 6:if(g=Rn,w=Ds,Rn=null,vr(l,u,p),Rn=g,Ds=w,Rn!==null)if(Ds)try{(Rn.nodeType===9?Rn.body:Rn.nodeName==="HTML"?Rn.ownerDocument.body:Rn).removeChild(p.stateNode)}catch(A){gn(p,u,A)}else try{Rn.removeChild(p.stateNode)}catch(A){gn(p,u,A)}break;case 18:Rn!==null&&(Ds?(l=Rn,r0(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,p.stateNode),el(l)):r0(Rn,p.stateNode));break;case 4:g=Rn,w=Ds,Rn=p.stateNode.containerInfo,Ds=!0,vr(l,u,p),Rn=g,Ds=w;break;case 0:case 11:case 14:case 15:ai(2,p,u),Qn||ai(4,p,u),vr(l,u,p);break;case 1:Qn||(Ha(p,u),g=p.stateNode,typeof g.componentWillUnmount=="function"&&iw(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 hw(l,u){if(u.memoizedState===null&&(l=u.alternate,l!==null&&(l=l.memoizedState,l!==null))){l=l.dehydrated;try{el(l)}catch(p){gn(u,u.return,p)}}}function mw(l,u){if(u.memoizedState===null&&(l=u.alternate,l!==null&&(l=l.memoizedState,l!==null&&(l=l.dehydrated,l!==null))))try{el(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 uw),u;case 22:return l=l.stateNode,u=l._retryCache,u===null&&(u=l._retryCache=new uw),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 Rs(l,u){var p=u.deletions;if(p!==null)for(var g=0;g<p.length;g++){var w=p[g],A=l,P=u,G=P;e:for(;G!==null;){switch(G.tag){case 27:if(di(G.type)){Rn=G.stateNode,Ds=!1;break e}break;case 5:Rn=G.stateNode,Ds=!1;break e;case 3:case 4:Rn=G.stateNode.containerInfo,Ds=!0;break e}G=G.return}if(Rn===null)throw Error(s(160));pw(A,P,w),Rn=null,Ds=!1,A=w.alternate,A!==null&&(A.return=null),w.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)gw(u,l),u=u.sibling}var _a=null;function gw(l,u){var p=l.alternate,g=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:Rs(u,l),Os(l),g&4&&(ai(3,l,l.return),uc(3,l),ai(5,l,l.return));break;case 1:Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(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=_a;if(Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),g&4){var A=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":A=w.getElementsByTagName("title")[0],(!A||A[Hs]||A[xt]||A.namespaceURI==="http://www.w3.org/2000/svg"||A.hasAttribute("itemprop"))&&(A=w.createElement(g),w.head.insertBefore(A,w.querySelector("head > title"))),ps(A,g,p),A[xt]=l,fn(A),g=A;break e;case"link":var P=g0("link","href",w).get(g+(p.href||""));if(P){for(var G=0;G<P.length;G++)if(A=P[G],A.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&A.getAttribute("rel")===(p.rel==null?null:p.rel)&&A.getAttribute("title")===(p.title==null?null:p.title)&&A.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){P.splice(G,1);break t}}A=w.createElement(g),ps(A,g,p),w.head.appendChild(A);break;case"meta":if(P=g0("meta","content",w).get(g+(p.content||""))){for(G=0;G<P.length;G++)if(A=P[G],A.getAttribute("content")===(p.content==null?null:""+p.content)&&A.getAttribute("name")===(p.name==null?null:p.name)&&A.getAttribute("property")===(p.property==null?null:p.property)&&A.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&A.getAttribute("charset")===(p.charSet==null?null:p.charSet)){P.splice(G,1);break t}}A=w.createElement(g),ps(A,g,p),w.head.appendChild(A);break;default:throw Error(s(468,g))}A[xt]=l,fn(A),g=A}l.stateNode=g}else b0(w,l.type,l.stateNode);else l.stateNode=m0(w,g,l.memoizedProps);else A!==g?(A===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):A.count--,g===null?b0(w,l.type,l.stateNode):m0(w,g,l.memoizedProps)):g===null&&l.stateNode!==null&&Jh(l,l.memoizedProps,p.memoizedProps)}break;case 27:Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),p!==null&&g&4&&Jh(l,l.memoizedProps,p.memoizedProps);break;case 5:if(Rs(u,l),Os(l),g&512&&(Qn||p===null||Ha(p,p.return)),l.flags&32){w=l.stateNode;try{ia(w,"")}catch(yt){gn(l,l.return,yt)}}g&4&&l.stateNode!=null&&(w=l.memoizedProps,Jh(l,w,p!==null?p.memoizedProps:w)),g&1024&&(tm=!0);break;case 6:if(Rs(u,l),Os(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=_a,_a=Rd(u.containerInfo),Rs(u,l),_a=w,Os(l),g&4&&p!==null&&p.memoizedState.isDehydrated)try{el(u.containerInfo)}catch(yt){gn(l,l.return,yt)}tm&&(tm=!1,bw(l));break;case 4:g=_a,_a=Rd(l.stateNode.containerInfo),Rs(u,l),Os(l),_a=g;break;case 12:Rs(u,l),Os(l);break;case 31:Rs(u,l),Os(l),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 13:Rs(u,l),Os(l),l.child.flags&8192&&l.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(wd=ut()),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,Rs(u,l),Qn=Ye,yr=De,Os(l),g&8192)e:for(u=l.stateNode,u._visibility=w?u._visibility&-2:u._visibility|1,w&&(p===null||re||yr||Qn||Gi(l)),p=null,u=l;;){if(u.tag===5||u.tag===26){if(p===null){re=p=u;try{if(A=re.stateNode,w)P=A.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{G=re.stateNode;var Je=re.memoizedProps.style,Ie=Je!=null&&Je.hasOwnProperty("display")?Je.display:null;G.style.display=Ie==null||typeof Ie=="boolean"?"":(""+Ie).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 Ue=re.stateNode;w?i0(Ue,!0):i0(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:Rs(u,l),Os(l),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 30:break;case 21:break;default:Rs(u,l),Os(l)}}function Os(l){var u=l.flags;if(u&2){try{for(var p,g=l.return;g!==null;){if(lw(g)){p=g;break}g=g.return}if(p==null)throw Error(s(160));switch(p.tag){case 27:var w=p.stateNode,A=Zh(l);xd(l,A,w);break;case 5:var P=p.stateNode;p.flags&32&&(ia(P,""),p.flags&=-33);var G=Zh(l);xd(l,G,P);break;case 3:case 4:var re=p.stateNode.containerInfo,De=Zh(l);em(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 bw(l){if(l.subtreeFlags&1024)for(l=l.child;l!==null;){var u=l;bw(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;)dw(l,u.alternate,u),u=u.sibling}function Gi(l){for(l=l.child;l!==null;){var u=l;switch(u.tag){case 0:case 11:case 14:case 15:ai(4,u,u.return),Gi(u);break;case 1:Ha(u,u.return);var p=u.stateNode;typeof p.componentWillUnmount=="function"&&iw(u,u.return,p),Gi(u);break;case 27:vc(u.stateNode);case 26:case 5:Ha(u,u.return),Gi(u);break;case 22:u.memoizedState===null&&Gi(u);break;case 30:Gi(u);break;default:Gi(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,A=u,P=A.flags;switch(A.tag){case 0:case 11:case 15:kr(w,A,p),uc(4,A);break;case 1:if(kr(w,A,p),g=A,w=g.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(De){gn(g,g.return,De)}if(g=A,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++)Yy(re[w],G)}catch(De){gn(g,g.return,De)}}p&&P&64&&rw(A),dc(A,A.return);break;case 27:cw(A);case 26:case 5:kr(w,A,p),p&&g===null&&P&4&&ow(A),dc(A,A.return);break;case 12:kr(w,A,p);break;case 31:kr(w,A,p),p&&P&4&&hw(w,A);break;case 13:kr(w,A,p),p&&P&4&&mw(w,A);break;case 22:A.memoizedState===null&&kr(w,A,p),dc(A,A.return);break;case 30:break;default:kr(w,A,p)}u=u.sibling}}function nm(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&&Xl(p))}function sm(l,u){l=null,u.alternate!==null&&(l=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==l&&(u.refCount++,l!=null&&Xl(l))}function Ea(l,u,p,g){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)xw(l,u,p,g),u=u.sibling}function xw(l,u,p,g){var w=u.flags;switch(u.tag){case 0:case 11:case 15:Ea(l,u,p,g),w&2048&&uc(9,u);break;case 1:Ea(l,u,p,g);break;case 3:Ea(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&&Xl(l)));break;case 12:if(w&2048){Ea(l,u,p,g),l=u.stateNode;try{var A=u.memoizedProps,P=A.id,G=A.onPostCommit;typeof G=="function"&&G(P,u.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(re){gn(u,u.return,re)}}else Ea(l,u,p,g);break;case 31:Ea(l,u,p,g);break;case 13:Ea(l,u,p,g);break;case 23:break;case 22:A=u.stateNode,P=u.alternate,u.memoizedState!==null?A._visibility&2?Ea(l,u,p,g):fc(l,u):A._visibility&2?Ea(l,u,p,g):(A._visibility|=2,Uo(l,u,p,g,(u.subtreeFlags&10256)!==0||!1)),w&2048&&nm(P,u);break;case 24:Ea(l,u,p,g),w&2048&&sm(u.alternate,u);break;default:Ea(l,u,p,g)}}function Uo(l,u,p,g,w){for(w=w&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var A=l,P=u,G=p,re=g,De=P.flags;switch(P.tag){case 0:case 11:case 15:Uo(A,P,G,re,w),uc(8,P);break;case 23:break;case 22:var Ye=P.stateNode;P.memoizedState!==null?Ye._visibility&2?Uo(A,P,G,re,w):fc(A,P):(Ye._visibility|=2,Uo(A,P,G,re,w)),w&&De&2048&&nm(P.alternate,P);break;case 24:Uo(A,P,G,re,w),w&&De&2048&&sm(P.alternate,P);break;default:Uo(A,P,G,re,w)}u=u.sibling}}function fc(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:fc(p,g),w&2048&&nm(g.alternate,g);break;case 24:fc(p,g),w&2048&&sm(g.alternate,g);break;default:fc(p,g)}u=u.sibling}}var pc=8192;function Wo(l,u,p){if(l.subtreeFlags&pc)for(l=l.child;l!==null;)yw(l,u,p),l=l.sibling}function yw(l,u,p){switch(l.tag){case 26:Wo(l,u,p),l.flags&pc&&l.memoizedState!==null&&yE(p,_a,l.memoizedState,l.memoizedProps);break;case 5:Wo(l,u,p);break;case 3:case 4:var g=_a;_a=Rd(l.stateNode.containerInfo),Wo(l,u,p),_a=g;break;case 22:l.memoizedState===null&&(g=l.alternate,g!==null&&g.memoizedState!==null?(g=pc,pc=16777216,Wo(l,u,p),pc=g):Wo(l,u,p));break;default:Wo(l,u,p)}}function vw(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 hc(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];is=g,kw(g,l)}vw(l)}if(l.subtreeFlags&10256)for(l=l.child;l!==null;)ww(l),l=l.sibling}function ww(l){switch(l.tag){case 0:case 11:case 15:hc(l),l.flags&2048&&ai(9,l,l.return);break;case 3:hc(l);break;case 12:hc(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)):hc(l);break;default:hc(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];is=g,kw(g,l)}vw(l)}for(l=l.child;l!==null;){switch(u=l,u.tag){case 0:case 11:case 15:ai(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 kw(l,u){for(;is!==null;){var p=is;switch(p.tag){case 0:case 11:case 15:ai(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:Xl(p.memoizedState.cache)}if(g=p.child,g!==null)g.return=p,is=g;else e:for(p=l;is!==null;){g=is;var w=g.sibling,A=g.return;if(fw(g),g===p){is=null;break e}if(w!==null){w.return=A,is=w;break e}is=A}}}var O_={getCacheForType:function(l){var u=ds(Gn),p=u.data.get(l);return p===void 0&&(p=l(),u.data.set(l,p)),p},cacheSignal:function(){return ds(Gn).controller.signal}},L_=typeof WeakMap=="function"?WeakMap:Map,pn=0,Cn=null,Yt=null,nn=0,mn=0,Ys=null,ri=!1,qo=!1,am=!1,Sr=0,Bn=0,ii=0,Yi=0,rm=0,Ks=0,Vo=0,mc=null,Ls=null,im=!1,wd=0,Sw=0,kd=1/0,Sd=null,oi=null,ts=0,li=null,Go=null,Cr=0,om=0,lm=null,Cw=null,gc=0,cm=null;function Qs(){return(pn&2)!==0&&nn!==0?nn&-nn:F.T!==null?mm():Vt()}function Aw(){if(Ks===0)if((nn&536870912)===0||rn){var l=tt;tt<<=1,(tt&3932160)===0&&(tt=262144),Ks=l}else Ks=536870912;return l=Vs.current,l!==null&&(l.flags|=32),Ks}function Ps(l,u,p){(l===Cn&&(mn===2||mn===9)||l.cancelPendingCommit!==null)&&(Yo(l,0),ci(l,nn,Ks,!1)),_e(l,p),((pn&2)===0||l!==Cn)&&(l===Cn&&((pn&2)===0&&(Yi|=p),Bn===4&&ci(l,nn,Ks,!1)),Ua(l))}function jw(l,u,p){if((pn&6)!==0)throw Error(s(327));var g=!p&&(u&127)===0&&(u&l.expiredLanes)===0||it(l,u),w=g?B_(l,u):dm(l,u,!0),A=g;do{if(w===0){qo&&!g&&ci(l,u,0,!1);break}else{if(p=l.current.alternate,A&&!P_(p)){w=dm(l,u,!1),A=!1;continue}if(w===2){if(A=u,l.errorRecoveryDisabledLanes&A)var P=0;else P=l.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){u=P;e:{var G=l;w=mc;var re=G.current.memoizedState.isDehydrated;if(re&&(Yo(G,P).flags|=256),P=dm(G,P,!1),P!==2){if(am&&!re){G.errorRecoveryDisabledLanes|=A,Yi|=A,w=4;break e}A=Ls,Ls=w,A!==null&&(Ls===null?Ls=A:Ls.push.apply(Ls,A))}w=P}if(A=!1,w!==2)continue}}if(w===1){Yo(l,0),ci(l,u,0,!0);break}e:{switch(g=l,A=w,A){case 0:case 1:throw Error(s(345));case 4:if((u&4194048)!==u)break;case 6:ci(g,u,Ks,!ri);break e;case 2:Ls=null;break;case 3:case 5:break;default:throw Error(s(329))}if((u&62914560)===u&&(w=wd+300-ut(),10<w)){if(ci(g,u,Ks,!ri),lt(g,0,!0)!==0)break e;Cr=u,g.timeoutHandle=s0(Nw.bind(null,g,p,Ls,Sd,im,u,Ks,Yi,Vo,ri,A,"Throttled",-0,0),w);break e}Nw(g,p,Ls,Sd,im,u,Ks,Yi,Vo,ri,A,null,-0,0)}}break}while(!0);Ua(l)}function Nw(l,u,p,g,w,A,P,G,re,De,Ye,Je,Ie,Ue){if(l.timeoutHandle=-1,Je=u.subtreeFlags,Je&8192||(Je&16785408)===16785408){Je={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ja},yw(u,A,Je);var yt=(A&62914560)===A?wd-ut():(A&4194048)===A?Sw-ut():0;if(yt=vE(Je,yt),yt!==null){Cr=A,l.cancelPendingCommit=yt(Lw.bind(null,l,u,A,p,g,w,P,G,re,Ye,Je,null,Ie,Ue)),ci(l,A,P,!De);return}}Lw(l,u,A,p,g,w,P,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],A=w.getSnapshot;w=w.value;try{if(!Ws(A(),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 ci(l,u,p,g){u&=~rm,u&=~Yi,l.suspendedLanes|=u,l.pingedLanes&=~u,g&&(l.warmLanes|=u),g=l.expirationTimes;for(var w=u;0<w;){var A=31-me(w),P=1<<A;g[A]=-1,w&=~P}p!==0&&et(l,p,u)}function Cd(){return(pn&6)===0?(bc(0),!1):!0}function um(){if(Yt!==null){if(mn===0)var l=Yt.return;else l=Yt,pr=Fi=null,jh(l),Bo=null,Zl=0,l=Yt;for(;l!==null;)aw(l.alternate,l),l=l.return;Yt=null}}function Yo(l,u){var p=l.timeoutHandle;p!==-1&&(l.timeoutHandle=-1,nE(p)),p=l.cancelPendingCommit,p!==null&&(l.cancelPendingCommit=null,p()),Cr=0,um(),Cn=l,Yt=p=dr(l.current,null),nn=u,mn=0,Ys=null,ri=!1,qo=it(l,u),am=!1,Vo=Ks=rm=Yi=ii=Bn=0,Ls=mc=null,im=!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-me(g),A=1<<w;u|=l[w],g&=~A}return Sr=u,qu(),p}function Tw(l,u){Ht=null,F.H=oc,u===Io||u===Zu?(u=Wy(),mn=3):u===hh?(u=Wy(),mn=4):mn=u===Hh?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,Ys=u,Yt===null&&(Bn=1,pd(l,ca(u,l.current)))}function _w(){var l=Vs.current;return l===null?!0:(nn&4194048)===nn?pa===null:(nn&62914560)===nn||(nn&536870912)!==0?l===pa:!1}function Ew(){var l=F.H;return F.H=oc,l===null?oc:l}function Mw(){var l=F.A;return F.A=O_,l}function Ad(){Bn=4,ri||(nn&4194048)!==nn&&Vs.current!==null||(qo=!0),(ii&134217727)===0&&(Yi&134217727)===0||Cn===null||ci(Cn,nn,Ks,!1)}function dm(l,u,p){var g=pn;pn|=2;var w=Ew(),A=Mw();(Cn!==l||nn!==u)&&(Sd=null,Yo(l,u)),u=!1;var P=Bn;e:do try{if(mn!==0&&Yt!==null){var G=Yt,re=Ys;switch(mn){case 8:um(),P=6;break e;case 3:case 2:case 9:case 6:Vs.current===null&&(u=!0);var De=mn;if(mn=0,Ys=null,Ko(l,G,re,De),p&&qo){P=0;break e}break;default:De=mn,mn=0,Ys=null,Ko(l,G,re,De)}}I_(),P=Bn;break}catch(Ye){Tw(l,Ye)}while(!0);return u&&l.shellSuspendCounter++,pr=Fi=null,pn=g,F.H=w,F.A=A,Yt===null&&(Cn=null,nn=0,qu()),P}function I_(){for(;Yt!==null;)Dw(Yt)}function B_(l,u){var p=pn;pn|=2;var g=Ew(),w=Mw();Cn!==l||nn!==u?(Sd=null,kd=ut()+500,Yo(l,u)):qo=it(l,u);e:do try{if(mn!==0&&Yt!==null){u=Yt;var A=Ys;t:switch(mn){case 1:mn=0,Ys=null,Ko(l,u,A,1);break;case 2:case 9:if(Hy(A)){mn=0,Ys=null,Rw(u);break}u=function(){mn!==2&&mn!==9||Cn!==l||(mn=7),Ua(l)},A.then(u,u);break e;case 3:mn=7;break e;case 4:mn=5;break e;case 7:Hy(A)?(mn=0,Ys=null,Rw(u)):(mn=0,Ys=null,Ko(l,u,A,7));break;case 5:var P=null;switch(Yt.tag){case 26:P=Yt.memoizedState;case 5:case 27:var G=Yt;if(P?x0(P):G.stateNode.complete){mn=0,Ys=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,Ys=null,Ko(l,u,A,5);break;case 6:mn=0,Ys=null,Ko(l,u,A,6);break;case 8:um(),Bn=6;break e;default:throw Error(s(462))}}F_();break}catch(Ye){Tw(l,Ye)}while(!0);return pr=Fi=null,F.H=g,F.A=w,pn=p,Yt!==null?0:(Cn=null,nn=0,qu(),Bn)}function F_(){for(;Yt!==null&&!We();)Dw(Yt)}function Dw(l){var u=nw(l.alternate,l,Sr);l.memoizedProps=l.pendingProps,u===null?jd(l):Yt=u}function Rw(l){var u=l,p=u.alternate;switch(u.tag){case 15:case 0:u=Qv(p,u,u.pendingProps,u.type,void 0,nn);break;case 11:u=Qv(p,u,u.pendingProps,u.type.render,u.ref,nn);break;case 5:jh(u);default:aw(p,u),u=Yt=My(u,Sr),u=nw(p,u,Sr)}l.memoizedProps=l.pendingProps,u===null?jd(l):Yt=u}function Ko(l,u,p,g){pr=Fi=null,jh(u),Bo=null,Zl=0;var w=u.return;try{if(N_(l,w,u,p,nn)){Bn=1,pd(l,ca(p,l.current)),Yt=null;return}}catch(A){if(w!==null)throw Yt=w,A;Bn=1,pd(l,ca(p,l.current)),Yt=null;return}u.flags&32768?(rn||g===1?l=!0:qo||(nn&536870912)!==0?l=!1:(ri=l=!0,(g===2||g===9||g===3||g===6)&&(g=Vs.current,g!==null&&g.tag===13&&(g.flags|=16384))),Ow(u,l)):jd(u)}function jd(l){var u=l;do{if((u.flags&32768)!==0){Ow(u,ri);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 Ow(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 Lw(l,u,p,g,w,A,P,G,re){l.cancelPendingCommit=null;do Nd();while(ts!==0);if((pn&6)!==0)throw Error(s(327));if(u!==null){if(u===l.current)throw Error(s(177));if(A=u.lanes|u.childLanes,A|=Zp,Ge(l,p,A,P,G,re),l===Cn&&(Yt=Cn=null,nn=0),Go=u,li=l,Cr=p,om=A,lm=w,Cw=g,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(l.callbackNode=null,l.callbackPriority=0,U_(we,function(){return zw(),null})):(l.callbackNode=null,l.callbackPriority=0),g=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||g){g=F.T,F.T=null,w=W.p,W.p=2,P=pn,pn|=4;try{D_(l,u,p)}finally{pn=P,W.p=w,F.T=g}}ts=1,Pw(),Iw(),Bw()}}function Pw(){if(ts===1){ts=0;var l=li,u=Go,p=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var g=W.p;W.p=2;var w=pn;pn|=4;try{gw(u,l);var A=Sm,P=ky(l.containerInfo),G=A.focusedElem,re=A.selectionRange;if(P!==G&&G&&G.ownerDocument&&wy(G.ownerDocument.documentElement,G)){if(re!==null&&Yp(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 Je=G.ownerDocument||document,Ie=Je&&Je.defaultView||window;if(Ie.getSelection){var Ue=Ie.getSelection(),yt=G.textContent.length,Ot=Math.min(re.start,yt),wn=re.end===void 0?Ot:Math.min(re.end,yt);!Ue.extend&&Ot>wn&&(P=wn,wn=Ot,Ot=P);var ke=vy(G,Ot),ce=vy(G,wn);if(ke&&ce&&(Ue.rangeCount!==1||Ue.anchorNode!==ke.node||Ue.anchorOffset!==ke.offset||Ue.focusNode!==ce.node||Ue.focusOffset!==ce.offset)){var Me=Je.createRange();Me.setStart(ke.node,ke.offset),Ue.removeAllRanges(),Ot>wn?(Ue.addRange(Me),Ue.extend(ce.node,ce.offset)):(Me.setEnd(ce.node,ce.offset),Ue.addRange(Me))}}}}for(Je=[],Ue=G;Ue=Ue.parentNode;)Ue.nodeType===1&&Je.push({element:Ue,left:Ue.scrollLeft,top:Ue.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<Je.length;G++){var Qe=Je[G];Qe.element.scrollLeft=Qe.left,Qe.element.scrollTop=Qe.top}}Fd=!!km,Sm=km=null}finally{pn=w,W.p=g,F.T=p}}l.current=u,ts=2}}function Iw(){if(ts===2){ts=0;var l=li,u=Go,p=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var g=W.p;W.p=2;var w=pn;pn|=4;try{dw(l,u.alternate,u)}finally{pn=w,W.p=g,F.T=p}}ts=3}}function Bw(){if(ts===4||ts===3){ts=0,st();var l=li,u=Go,p=Cr,g=Cw;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?ts=5:(ts=0,Go=li=null,Fw(l,l.pendingLanes));var w=l.pendingLanes;if(w===0&&(oi=null),Pt(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=F.T,w=W.p,W.p=2,F.T=null;try{for(var A=l.onRecoverableError,P=0;P<g.length;P++){var G=g[P];A(G.value,{componentStack:G.stack})}}finally{F.T=u,W.p=w}}(Cr&3)!==0&&Nd(),Ua(l),w=l.pendingLanes,(p&261930)!==0&&(w&42)!==0?l===cm?gc++:(gc=0,cm=l):gc=0,bc(0)}}function Fw(l,u){(l.pooledCacheLanes&=u)===0&&(u=l.pooledCache,u!=null&&(l.pooledCache=null,Xl(u)))}function Nd(){return Pw(),Iw(),Bw(),zw()}function zw(){if(ts!==5)return!1;var l=li,u=om;om=0;var p=Pt(Cr),g=F.T,w=W.p;try{W.p=32>p?32:p,F.T=null,p=lm,lm=null;var A=li,P=Cr;if(ts=0,Go=li=null,Cr=0,(pn&6)!==0)throw Error(s(331));var G=pn;if(pn|=4,ww(A.current),xw(A,A.current,P,p),pn=G,bc(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(oe,A)}catch{}return!0}finally{W.p=w,F.T=g,Fw(l,u)}}function $w(l,u,p){u=ca(p,u),u=$h(l.stateNode,u,2),l=ti(l,u,2),l!==null&&(_e(l,2),Ua(l))}function gn(l,u,p){if(l.tag===3)$w(l,l,p);else for(;u!==null;){if(u.tag===3){$w(u,l,p);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(oi===null||!oi.has(g))){l=ca(p,l),p=Hv(2),g=ti(u,p,2),g!==null&&(Uv(p,g,u,l),_e(g,2),Ua(g));break}}u=u.return}}function fm(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)||(am=!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,Cn===l&&(nn&p)===p&&(Bn===4||Bn===3&&(nn&62914560)===nn&&300>ut()-wd?(pn&2)===0&&Yo(l,0):rm|=p,Vo===nn&&(Vo=0)),Ua(l)}function Hw(l,u){u===0&&(u=jt()),l=Pi(l,u),l!==null&&(_e(l,u),Ua(l))}function $_(l){var u=l.memoizedState,p=0;u!==null&&(p=u.retryLane),Hw(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),Hw(l,p)}function U_(l,u){return ie(l,u)}var Td=null,Qo=null,pm=!1,_d=!1,hm=!1,ui=0;function Ua(l){l!==Qo&&l.next===null&&(Qo===null?Td=Qo=l:Qo=Qo.next=l),_d=!0,pm||(pm=!0,q_())}function bc(l,u){if(!hm&&_d){hm=!0;do for(var p=!1,g=Td;g!==null;){if(l!==0){var w=g.pendingLanes;if(w===0)var A=0;else{var P=g.suspendedLanes,G=g.pingedLanes;A=(1<<31-me(42|l)+1)-1,A&=w&~(P&~G),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(p=!0,Vw(g,A))}else A=nn,A=lt(g,g===Cn?A:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(A&3)===0||it(g,A)||(p=!0,Vw(g,A));g=g.next}while(p);hm=!1}}function W_(){Uw()}function Uw(){_d=pm=!1;var l=0;ui!==0&&tE()&&(l=ui);for(var u=ut(),p=null,g=Td;g!==null;){var w=g.next,A=Ww(g,u);A===0?(g.next=null,p===null?Td=w:p.next=w,w===null&&(Qo=p)):(p=g,(l!==0||(A&3)!==0)&&(_d=!0)),g=w}ts!==0&&ts!==5||bc(l),ui!==0&&(ui=0)}function Ww(l,u){for(var p=l.suspendedLanes,g=l.pingedLanes,w=l.expirationTimes,A=l.pendingLanes&-62914561;0<A;){var P=31-me(A),G=1<<P,re=w[P];re===-1?((G&p)===0||(G&g)!==0)&&(w[P]=ht(G,u)):re<=u&&(l.expiredLanes|=G),A&=~G}if(u=Cn,p=nn,p=lt(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&&he(g),l.callbackNode=null,l.callbackPriority=0;if((p&3)===0||it(l,p)){if(u=p&-p,u===l.callbackPriority)return u;switch(g!==null&&he(g),Pt(p)){case 2:case 8:p=ae;break;case 32:p=we;break;case 268435456:p=ve;break;default:p=we}return g=qw.bind(null,l),p=ie(p,g),l.callbackPriority=u,l.callbackNode=p,u}return g!==null&&g!==null&&he(g),l.callbackPriority=2,l.callbackNode=null,2}function qw(l,u){if(ts!==0&&ts!==5)return l.callbackNode=null,l.callbackPriority=0,null;var p=l.callbackNode;if(Nd()&&l.callbackNode!==p)return null;var g=nn;return g=lt(l,l===Cn?g:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),g===0?null:(jw(l,g,u),Ww(l,ut()),l.callbackNode!=null&&l.callbackNode===p?qw.bind(null,l):null)}function Vw(l,u){if(Nd())return null;jw(l,u,!0)}function q_(){sE(function(){(pn&6)!==0?ie(X,W_):Uw()})}function mm(){if(ui===0){var l=Lo;l===0&&(l=ze,ze<<=1,(ze&261888)===0&&(ze=256)),ui=l}return ui}function Gw(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:qr(""+l)}function Yw(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 A=Gw((w[Mt]||null).action),P=g.submitter;P&&(u=(u=P[Mt]||null)?Gw(u.formAction):P.getAttribute("formAction"),u!==null&&(A=u,P=null));var G=new gt("action","action",null,g,w);l.push({event:G,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(ui!==0){var re=P?Yw(w,P):new FormData(w);Lh(p,{pending:!0,data:re,method:w.method,action:A},null,re)}}else typeof A=="function"&&(G.preventDefault(),re=P?Yw(w,P):new FormData(w),Lh(p,{pending:!0,data:re,method:w.method,action:A},A,re))},currentTarget:w}]})}}for(var gm=0;gm<Jp.length;gm++){var bm=Jp[gm],G_=bm.toLowerCase(),Y_=bm[0].toUpperCase()+bm.slice(1);Ta(G_,"on"+Y_)}Ta(Ay,"onAnimationEnd"),Ta(jy,"onAnimationIteration"),Ta(Ny,"onAnimationStart"),Ta("dblclick","onDoubleClick"),Ta("focusin","onFocus"),Ta("focusout","onBlur"),Ta(u_,"onTransitionRun"),Ta(d_,"onTransitionStart"),Ta(f_,"onTransitionCancel"),Ta(Ty,"onTransitionEnd"),Es("onMouseEnter",["mouseout","mouseover"]),Es("onMouseLeave",["mouseout","mouseover"]),Es("onPointerEnter",["pointerout","pointerover"]),Es("onPointerLeave",["pointerout","pointerover"]),_s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),_s("onBeforeInput",["compositionend","keypress","textInput","paste"]),_s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xc="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(xc));function Kw(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 A=void 0;if(u)for(var P=g.length-1;0<=P;P--){var G=g[P],re=G.instance,De=G.currentTarget;if(G=G.listener,re!==A&&w.isPropagationStopped())break e;A=G,w.currentTarget=De;try{A(w)}catch(Ye){Wu(Ye)}w.currentTarget=null,A=re}else for(P=0;P<g.length;P++){if(G=g[P],re=G.instance,De=G.currentTarget,G=G.listener,re!==A&&w.isPropagationStopped())break e;A=G,w.currentTarget=De;try{A(w)}catch(Ye){Wu(Ye)}w.currentTarget=null,A=re}}}}function Kt(l,u){var p=u[cn];p===void 0&&(p=u[cn]=new Set);var g=l+"__bubble";p.has(g)||(Qw(u,l,2,!1),p.add(g))}function xm(l,u,p){var g=0;u&&(g|=4),Qw(p,l,g,u)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function ym(l){if(!l[Ed]){l[Ed]=!0,cr.forEach(function(p){p!=="selectionchange"&&(K_.has(p)||xm(p,!1,l),xm(p,!0,l))});var u=l.nodeType===9?l:l.ownerDocument;u===null||u[Ed]||(u[Ed]=!0,xm("selectionchange",!1,u))}}function Qw(l,u,p,g){switch(A0(u)){case 2:var w=SE;break;case 8:w=CE;break;default:w=Om}p=w.bind(null,u,p,l),w=void 0,!Co||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 vm(l,u,p,g,w){var A=g;if((u&1)===0&&(u&2)===0&&g!==null)e:for(;;){if(g===null)return;var P=g.tag;if(P===3||P===4){var G=g.stateNode.containerInfo;if(G===w)break;if(P===4)for(P=g.return;P!==null;){var re=P.tag;if((re===3||re===4)&&P.stateNode.containerInfo===w)return;P=P.return}for(;G!==null;){if(P=ws(G),P===null)return;if(re=P.tag,re===5||re===6||re===26||re===27){g=A=P;continue e}G=G.parentNode}}g=g.return}Hl(function(){var De=A,Ye=zl(p),Je=[];e:{var Ie=_y.get(l);if(Ie!==void 0){var Ue=gt,yt=l;switch(l){case"keypress":if(Di(p)===0)break e;case"keydown":case"keyup":Ue=HT;break;case"focusin":yt="focus",Ue=Ri;break;case"focusout":yt="blur",Ue=Ri;break;case"beforeblur":case"afterblur":Ue=Ri;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":Ue=zp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ue=zu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ue=qT;break;case Ay:case jy:case Ny:Ue=Hp;break;case Ty:Ue=GT;break;case"scroll":case"scrollend":Ue=Sn;break;case"wheel":Ue=KT;break;case"copy":case"cut":case"paste":Ue=LT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ue=iy;break;case"toggle":case"beforetoggle":Ue=XT}var Ot=(u&4)!==0,wn=!Ot&&(l==="scroll"||l==="scrollend"),ke=Ot?Ie!==null?Ie+"Capture":null:Ie;Ot=[];for(var ce=De,Me;ce!==null;){var Qe=ce;if(Me=Qe.stateNode,Qe=Qe.tag,Qe!==5&&Qe!==26&&Qe!==27||Me===null||ke===null||(Qe=Gr(ce,ke),Qe!=null&&Ot.push(yc(ce,Qe,Me))),wn)break;ce=ce.return}0<Ot.length&&(Ie=new Ue(Ie,yt,null,p,Ye),Je.push({event:Ie,listeners:Ot}))}}if((u&7)===0){e:{if(Ie=l==="mouseover"||l==="pointerover",Ue=l==="mouseout"||l==="pointerout",Ie&&p!==Fl&&(yt=p.relatedTarget||p.fromElement)&&(ws(yt)||yt[kn]))break e;if((Ue||Ie)&&(Ie=Ye.window===Ye?Ye:(Ie=Ye.ownerDocument)?Ie.defaultView||Ie.parentWindow:window,Ue?(yt=p.relatedTarget||p.toElement,Ue=De,yt=yt?ws(yt):null,yt!==null&&(wn=r(yt),Ot=yt.tag,yt!==wn||Ot!==5&&Ot!==27&&Ot!==6)&&(yt=null)):(Ue=null,yt=De),Ue!==yt)){if(Ot=zp,Qe="onMouseLeave",ke="onMouseEnter",ce="mouse",(l==="pointerout"||l==="pointerover")&&(Ot=iy,Qe="onPointerLeave",ke="onPointerEnter",ce="pointer"),wn=Ue==null?Ie:Et(Ue),Me=yt==null?Ie:Et(yt),Ie=new Ot(Qe,ce+"leave",Ue,p,Ye),Ie.target=wn,Ie.relatedTarget=Me,Qe=null,ws(Ye)===De&&(Ot=new Ot(ke,ce+"enter",yt,p,Ye),Ot.target=Me,Ot.relatedTarget=wn,Qe=Ot),wn=Qe,Ue&&yt)t:{for(Ot=Q_,ke=Ue,ce=yt,Me=0,Qe=ke;Qe;Qe=Ot(Qe))Me++;Qe=0;for(var _t=ce;_t;_t=Ot(_t))Qe++;for(;0<Me-Qe;)ke=Ot(ke),Me--;for(;0<Qe-Me;)ce=Ot(ce),Qe--;for(;Me--;){if(ke===ce||ce!==null&&ke===ce.alternate){Ot=ke;break t}ke=Ot(ke),ce=Ot(ce)}Ot=null}else Ot=null;Ue!==null&&Xw(Je,Ie,Ue,Ot,!1),yt!==null&&wn!==null&&Xw(Je,wn,yt,Ot,!0)}}e:{if(Ie=De?Et(De):window,Ue=Ie.nodeName&&Ie.nodeName.toLowerCase(),Ue==="select"||Ue==="input"&&Ie.type==="file")var un=hy;else if(fy(Ie))if(my)un=o_;else{un=r_;var kt=a_}else Ue=Ie.nodeName,!Ue||Ue.toLowerCase()!=="input"||Ie.type!=="checkbox"&&Ie.type!=="radio"?De&&ko(De.elementType)&&(un=hy):un=i_;if(un&&(un=un(l,De))){py(Je,un,p,Ye);break e}kt&&kt(l,Ie,De),l==="focusout"&&De&&Ie.type==="number"&&De.memoizedProps.value!=null&&ks(Ie,"number",Ie.value)}switch(kt=De?Et(De):window,l){case"focusin":(fy(kt)||kt.contentEditable==="true")&&(No=kt,Kp=De,Yl=null);break;case"focusout":Yl=Kp=No=null;break;case"mousedown":Qp=!0;break;case"contextmenu":case"mouseup":case"dragend":Qp=!1,Sy(Je,p,Ye);break;case"selectionchange":if(c_)break;case"keydown":case"keyup":Sy(Je,p,Ye)}var Ut;if(qp)e:{switch(l){case"compositionstart":var sn="onCompositionStart";break e;case"compositionend":sn="onCompositionEnd";break e;case"compositionupdate":sn="onCompositionUpdate";break e}sn=void 0}else jo?uy(l,p)&&(sn="onCompositionEnd"):l==="keydown"&&p.keyCode===229&&(sn="onCompositionStart");sn&&(oy&&p.locale!=="ko"&&(jo||sn!=="onCompositionStart"?sn==="onCompositionEnd"&&jo&&(Ut=Ul()):(Na=Ye,Ao="value"in Na?Na.value:Na.textContent,jo=!0)),kt=Md(De,sn),0<kt.length&&(sn=new ry(sn,l,null,p,Ye),Je.push({event:sn,listeners:kt}),Ut?sn.data=Ut:(Ut=dy(p),Ut!==null&&(sn.data=Ut)))),(Ut=ZT?e_(l,p):t_(l,p))&&(sn=Md(De,"onBeforeInput"),0<sn.length&&(kt=new ry("onBeforeInput","beforeinput",null,p,Ye),Je.push({event:kt,listeners:sn}),kt.data=Ut)),V_(Je,l,De,p,Ye)}Kw(Je,u)})}function yc(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,A=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||A===null||(w=Gr(l,p),w!=null&&g.unshift(yc(l,w,A)),w=Gr(l,u),w!=null&&g.push(yc(l,w,A))),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 Xw(l,u,p,g,w){for(var A=u._reactName,P=[];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=Gr(p,A),De!=null&&P.unshift(yc(p,De,re))):w||(De=Gr(p,A),De!=null&&P.push(yc(p,De,re)))),p=p.return}P.length!==0&&l.push({event:u,listeners:P})}var X_=/\r\n?/g,J_=/\u0000|\uFFFD/g;function Jw(l){return(typeof l=="string"?l:""+l).replace(X_,`
34
+ `).replace(J_,"")}function Zw(l,u){return u=Jw(u),Jw(l)===u}function vn(l,u,p,g,w,A){switch(p){case"children":typeof g=="string"?u==="body"||u==="textarea"&&g===""||ia(l,g):(typeof g=="number"||typeof g=="bigint")&&u!=="body"&&ia(l,""+g);break;case"className":Ca(l,"class",g);break;case"tabIndex":Ca(l,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ca(l,p,g);break;case"style":Bu(l,g,A);break;case"data":if(u!=="object"){Ca(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=qr(""+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 A=="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=qr(""+g),l.setAttribute(p,g);break;case"onClick":g!=null&&(l.onclick=ja);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=qr(""+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),gs(l,"popover",g);break;case"xlinkActuate":cs(l,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":cs(l,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":cs(l,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":cs(l,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":cs(l,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":cs(l,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":cs(l,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":cs(l,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":cs(l,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":gs(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=Fu.get(p)||p,gs(l,p,g))}}function wm(l,u,p,g,w,A){switch(p){case"style":Bu(l,g,A);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"?ia(l,g):(typeof g=="number"||typeof g=="bigint")&&ia(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=ja);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),A=l[Mt]||null,A=A!=null?A[p]:null,typeof A=="function"&&l.removeEventListener(u,A,w),typeof g=="function")){typeof A!="function"&&A!==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,""):gs(l,p,g)}}}function ps(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,A;for(A in p)if(p.hasOwnProperty(A)){var P=p[A];if(P!=null)switch(A){case"src":g=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,u));default:vn(l,u,A,P,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=A=P=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":P=Ye;break;case"checked":re=Ye;break;case"defaultChecked":De=Ye;break;case"value":A=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)}}Nn(l,A,G,re,De,P,w,!1);return;case"select":Kt("invalid",l),g=P=A=null;for(w in p)if(p.hasOwnProperty(w)&&(G=p[w],G!=null))switch(w){case"value":A=G;break;case"defaultValue":P=G;break;case"multiple":g=G;default:vn(l,u,w,G,p,null)}u=A,p=P,l.multiple=!!g,u!=null?Pn(l,!!g,u,!1):p!=null&&Pn(l,!!g,p,!0);return;case"textarea":Kt("invalid",l),A=w=g=null;for(P in p)if(p.hasOwnProperty(P)&&(G=p[P],G!=null))switch(P){case"value":g=G;break;case"defaultValue":w=G;break;case"children":A=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:vn(l,u,P,G,p,null)}Aa(l,g,w,A);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<xc.length;g++)Kt(xc[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(ko(u)){for(Ye in p)p.hasOwnProperty(Ye)&&(g=p[Ye],g!==void 0&&wm(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,A=null,P=null,G=null,re=null,De=null,Ye=null;for(Ue in p){var Je=p[Ue];if(p.hasOwnProperty(Ue)&&Je!=null)switch(Ue){case"checked":break;case"value":break;case"defaultValue":re=Je;default:g.hasOwnProperty(Ue)||vn(l,u,Ue,null,g,Je)}}for(var Ie in g){var Ue=g[Ie];if(Je=p[Ie],g.hasOwnProperty(Ie)&&(Ue!=null||Je!=null))switch(Ie){case"type":A=Ue;break;case"name":w=Ue;break;case"checked":De=Ue;break;case"defaultChecked":Ye=Ue;break;case"value":P=Ue;break;case"defaultValue":G=Ue;break;case"children":case"dangerouslySetInnerHTML":if(Ue!=null)throw Error(s(137,u));break;default:Ue!==Je&&vn(l,u,Ie,Ue,g,Je)}}At(l,P,G,re,De,Ye,A,w);return;case"select":Ue=P=G=Ie=null;for(A in p)if(re=p[A],p.hasOwnProperty(A)&&re!=null)switch(A){case"value":break;case"multiple":Ue=re;default:g.hasOwnProperty(A)||vn(l,u,A,null,g,re)}for(w in g)if(A=g[w],re=p[w],g.hasOwnProperty(w)&&(A!=null||re!=null))switch(w){case"value":Ie=A;break;case"defaultValue":G=A;break;case"multiple":P=A;default:A!==re&&vn(l,u,w,A,g,re)}u=G,p=P,g=Ue,Ie!=null?Pn(l,!!p,Ie,!1):!!g!=!!p&&(u!=null?Pn(l,!!p,u,!0):Pn(l,!!p,p?[]:"",!1));return;case"textarea":Ue=Ie=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(P in g)if(w=g[P],A=p[P],g.hasOwnProperty(P)&&(w!=null||A!=null))switch(P){case"value":Ie=w;break;case"defaultValue":Ue=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==A&&vn(l,u,P,w,g,A)}Us(l,Ie,Ue);return;case"option":for(var yt in p)if(Ie=p[yt],p.hasOwnProperty(yt)&&Ie!=null&&!g.hasOwnProperty(yt))switch(yt){case"selected":l.selected=!1;break;default:vn(l,u,yt,null,g,Ie)}for(re in g)if(Ie=g[re],Ue=p[re],g.hasOwnProperty(re)&&Ie!==Ue&&(Ie!=null||Ue!=null))switch(re){case"selected":l.selected=Ie&&typeof Ie!="function"&&typeof Ie!="symbol";break;default:vn(l,u,re,Ie,g,Ue)}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 Ot in p)Ie=p[Ot],p.hasOwnProperty(Ot)&&Ie!=null&&!g.hasOwnProperty(Ot)&&vn(l,u,Ot,null,g,Ie);for(De in g)if(Ie=g[De],Ue=p[De],g.hasOwnProperty(De)&&Ie!==Ue&&(Ie!=null||Ue!=null))switch(De){case"children":case"dangerouslySetInnerHTML":if(Ie!=null)throw Error(s(137,u));break;default:vn(l,u,De,Ie,g,Ue)}return;default:if(ko(u)){for(var wn in p)Ie=p[wn],p.hasOwnProperty(wn)&&Ie!==void 0&&!g.hasOwnProperty(wn)&&wm(l,u,wn,void 0,g,Ie);for(Ye in g)Ie=g[Ye],Ue=p[Ye],!g.hasOwnProperty(Ye)||Ie===Ue||Ie===void 0&&Ue===void 0||wm(l,u,Ye,Ie,g,Ue);return}}for(var ke in p)Ie=p[ke],p.hasOwnProperty(ke)&&Ie!=null&&!g.hasOwnProperty(ke)&&vn(l,u,ke,null,g,Ie);for(Je in g)Ie=g[Je],Ue=p[Je],!g.hasOwnProperty(Je)||Ie===Ue||Ie==null&&Ue==null||vn(l,u,Je,Ie,g,Ue)}function e0(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],A=w.transferSize,P=w.initiatorType,G=w.duration;if(A&&G&&e0(P)){for(P=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,Je=re.initiatorType;Ye&&e0(Je)&&(re=re.responseEnd,P+=Ye*(re<G?1:(G-De)/(re-De)))}if(--g,u+=8*(A+P)/(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 km=null,Sm=null;function Dd(l){return l.nodeType===9?l:l.ownerDocument}function t0(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 n0(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 Cm(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 Am=null;function tE(){var l=window.event;return l&&l.type==="popstate"?l===Am?!1:(Am=l,!0):(Am=null,!1)}var s0=typeof setTimeout=="function"?setTimeout:void 0,nE=typeof clearTimeout=="function"?clearTimeout:void 0,a0=typeof Promise=="function"?Promise:void 0,sE=typeof queueMicrotask=="function"?queueMicrotask:typeof a0<"u"?function(l){return a0.resolve(null).then(l).catch(aE)}:s0;function aE(l){setTimeout(function(){throw l})}function di(l){return l==="head"}function r0(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),el(u);return}g--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")g++;else if(p==="html")vc(l.ownerDocument.documentElement);else if(p==="head"){p=l.ownerDocument.head,vc(p);for(var A=p.firstChild;A;){var P=A.nextSibling,G=A.nodeName;A[Hs]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&A.rel.toLowerCase()==="stylesheet"||p.removeChild(A),A=P}}else p==="body"&&vc(l.ownerDocument.body);p=w}while(p);el(u)}function i0(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 jm(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":jm(p),Fa(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[Hs])switch(u){case"meta":if(!l.hasAttribute("itemprop"))break;return l;case"link":if(A=l.getAttribute("rel"),A==="stylesheet"&&l.hasAttribute("data-precedence"))break;if(A!==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(A=l.getAttribute("src"),(A!==(w.src==null?null:w.src)||l.getAttribute("type")!==(w.type==null?null:w.type)||l.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&A&&l.hasAttribute("async")&&!l.hasAttribute("itemprop"))break;return l;default:return l}}else if(u==="input"&&l.type==="hidden"){var A=w.name==null?null:""+w.name;if(w.type==="hidden"&&l.getAttribute("name")===A)return l}else return l;if(l=ha(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=ha(l.nextSibling),l===null))return null;return l}function o0(l,u){for(;l.nodeType!==8;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!u||(l=ha(l.nextSibling),l===null))return null;return l}function Nm(l){return l.data==="$?"||l.data==="$~"}function Tm(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 ha(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 _m=null;function l0(l){l=l.nextSibling;for(var u=0;l;){if(l.nodeType===8){var p=l.data;if(p==="/$"||p==="/&"){if(u===0)return ha(l.nextSibling);u--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||u++}l=l.nextSibling}return null}function c0(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 u0(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 vc(l){for(var u=l.attributes;u.length;)l.removeAttributeNode(u[0]);Fa(l)}var ma=new Map,d0=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=Zn(l);u!==null&&u.tag===5&&u.type==="form"?Tv(u):Ar.r(l)}var Xo=typeof document>"u"?null:document;function f0(l,u,p){var g=Xo;if(g&&typeof u=="string"&&u){var w=$t(u);w='link[rel="'+l+'"][href="'+w+'"]',typeof p=="string"&&(w+='[crossorigin="'+p+'"]'),d0.has(w)||(d0.add(w),l={rel:l,crossOrigin:p,href:u},g.querySelector(w)===null&&(u=g.createElement("link"),ps(u,"link",l),fn(u),g.head.appendChild(u)))}}function uE(l){Ar.D(l),f0("dns-prefetch",l,null)}function dE(l,u){Ar.C(l,u),f0("preconnect",l,u)}function fE(l,u,p){Ar.L(l,u,p);var g=Xo;if(g&&l&&u){var w='link[rel="preload"][as="'+$t(u)+'"]';u==="image"&&p&&p.imageSrcSet?(w+='[imagesrcset="'+$t(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(w+='[imagesizes="'+$t(p.imageSizes)+'"]')):w+='[href="'+$t(l)+'"]';var A=w;switch(u){case"style":A=Jo(l);break;case"script":A=Zo(l)}ma.has(A)||(l=m({rel:"preload",href:u==="image"&&p&&p.imageSrcSet?void 0:l,as:u},p),ma.set(A,l),g.querySelector(w)!==null||u==="style"&&g.querySelector(wc(A))||u==="script"&&g.querySelector(kc(A))||(u=g.createElement("link"),ps(u,"link",l),fn(u),g.head.appendChild(u)))}}function pE(l,u){Ar.m(l,u);var p=Xo;if(p&&l){var g=u&&typeof u.as=="string"?u.as:"script",w='link[rel="modulepreload"][as="'+$t(g)+'"][href="'+$t(l)+'"]',A=w;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Zo(l)}if(!ma.has(A)&&(l=m({rel:"modulepreload",href:l},u),ma.set(A,l),p.querySelector(w)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(kc(A)))return}g=p.createElement("link"),ps(g,"link",l),fn(g),p.head.appendChild(g)}}}function hE(l,u,p){Ar.S(l,u,p);var g=Xo;if(g&&l){var w=rs(g).hoistableStyles,A=Jo(l);u=u||"default";var P=w.get(A);if(!P){var G={loading:0,preload:null};if(P=g.querySelector(wc(A)))G.loading=5;else{l=m({rel:"stylesheet",href:l,"data-precedence":u},p),(p=ma.get(A))&&Em(l,p);var re=P=g.createElement("link");fn(re),ps(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(P,u,g)}P={type:"stylesheet",instance:P,count:1,state:G},w.set(A,P)}}}function mE(l,u){Ar.X(l,u);var p=Xo;if(p&&l){var g=rs(p).hoistableScripts,w=Zo(l),A=g.get(w);A||(A=p.querySelector(kc(w)),A||(l=m({src:l,async:!0},u),(u=ma.get(w))&&Mm(l,u),A=p.createElement("script"),fn(A),ps(A,"link",l),p.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(w,A))}}function gE(l,u){Ar.M(l,u);var p=Xo;if(p&&l){var g=rs(p).hoistableScripts,w=Zo(l),A=g.get(w);A||(A=p.querySelector(kc(w)),A||(l=m({src:l,async:!0,type:"module"},u),(u=ma.get(w))&&Mm(l,u),A=p.createElement("script"),fn(A),ps(A,"link",l),p.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(w,A))}}function p0(l,u,p,g){var w=(w=ee.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=Jo(p.href),p=rs(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=Jo(p.href);var A=rs(w).hoistableStyles,P=A.get(l);if(P||(w=w.ownerDocument||w,P={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(l,P),(A=w.querySelector(wc(l)))&&!A._p&&(P.instance=A,P.state.loading=5),ma.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},ma.set(l,p),A||bE(w,l,p,P.state))),u&&g===null)throw Error(s(528,""));return P}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=Zo(p),p=rs(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 Jo(l){return'href="'+$t(l)+'"'}function wc(l){return'link[rel="stylesheet"]['+l+"]"}function h0(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}),ps(u,"link",p),fn(u),l.head.appendChild(u))}function Zo(l){return'[src="'+$t(l)+'"]'}function kc(l){return"script[async]"+l}function m0(l,u,p){if(u.count++,u.instance===null)switch(u.type){case"style":var g=l.querySelector('style[data-href~="'+$t(p.href)+'"]');if(g)return u.instance=g,fn(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"),fn(g),ps(g,"style",w),Od(g,p.precedence,l),u.instance=g;case"stylesheet":w=Jo(p.href);var A=l.querySelector(wc(w));if(A)return u.state.loading|=4,u.instance=A,fn(A),A;g=h0(p),(w=ma.get(w))&&Em(g,w),A=(l.ownerDocument||l).createElement("link"),fn(A);var P=A;return P._p=new Promise(function(G,re){P.onload=G,P.onerror=re}),ps(A,"link",g),u.state.loading|=4,Od(A,p.precedence,l),u.instance=A;case"script":return A=Zo(p.src),(w=l.querySelector(kc(A)))?(u.instance=w,fn(w),w):(g=p,(w=ma.get(A))&&(g=m({},p),Mm(g,w)),l=l.ownerDocument||l,w=l.createElement("script"),fn(w),ps(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,A=w,P=0;P<g.length;P++){var G=g[P];if(G.dataset.precedence===u)A=G;else if(A!==w)break}A?A.parentNode.insertBefore(l,A.nextSibling):(u=p.nodeType===9?p.head:p,u.insertBefore(l,u.firstChild))}function Em(l,u){l.crossOrigin==null&&(l.crossOrigin=u.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=u.referrerPolicy),l.title==null&&(l.title=u.title)}function Mm(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 g0(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 A=p[w];if(!(A[Hs]||A[xt]||l==="link"&&A.getAttribute("rel")==="stylesheet")&&A.namespaceURI!=="http://www.w3.org/2000/svg"){var P=A.getAttribute(u)||"";P=l+P;var G=g.get(P);G?G.push(A):g.set(P,[A])}}return g}function b0(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 x0(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=Jo(g.href),A=u.querySelector(wc(w));if(A){u=A._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=A,fn(A);return}A=u.ownerDocument||u,g=h0(g),(w=ma.get(w))&&Em(g,w),A=A.createElement("link"),fn(A);var P=A;P._p=new Promise(function(G,re){P.onload=G,P.onerror=re}),ps(A,"link",g),p.instance=A}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 Dm=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 A=l.unsuspend;l.unsuspend=null,A()}},6e4+u);0<l.imgBytes&&Dm===0&&(Dm=62500*eE());var w=setTimeout(function(){if(l.waitingForImages=!1,l.count===0&&(l.stylesheets&&Bd(l,l.stylesheets),l.unsuspend)){var A=l.unsuspend;l.unsuspend=null,A()}},(l.imgBytes>Dm?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]"),A=0;A<w.length;A++){var P=w[A];(P.nodeName==="LINK"||P.getAttribute("media")!=="not all")&&(p.set(P.dataset.precedence,P),g=P)}g&&p.set(null,g)}w=u.instance,P=w.getAttribute("data-precedence"),A=p.get(P)||g,A===g&&p.set(null,w),p.set(P,w),this.count++,g=Pd.bind(this),w.addEventListener("load",g),w.addEventListener("error",g),A?A.parentNode.insertBefore(w,A.nextSibling):(l=l.nodeType===9?l.head:l,l.insertBefore(w,l.firstChild)),u.state.loading|=4}}var Sc={$$typeof:j,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function kE(l,u,p,g,w,A,P,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=be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=be(0),this.hiddenUpdates=be(null),this.identifierPrefix=g,this.onUncaughtError=w,this.onCaughtError=A,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=re,this.incompleteTransitions=new Map}function y0(l,u,p,g,w,A,P,G,re,De,Ye,Je){return l=new kE(l,u,p,P,re,De,Ye,Je,G),u=1,A===!0&&(u|=24),A=qs(3,null,null,u),l.current=A,A.stateNode=l,u=dh(),u.refCount++,l.pooledCache=u,u.refCount++,A.memoizedState={element:g,isDehydrated:p,cache:u},mh(A),l}function v0(l){return l?(l=Eo,l):Eo}function w0(l,u,p,g,w,A){w=v0(w),g.context===null?g.context=w:g.pendingContext=w,g=ei(u),g.payload={element:p},A=A===void 0?null:A,A!==null&&(g.callback=A),p=ti(l,g,u),p!==null&&(Ps(p,l,u),tc(p,l,u))}function k0(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var p=l.retryLane;l.retryLane=p!==0&&p<u?p:u}}function Rm(l,u){k0(l,u),(l=l.alternate)&&k0(l,u)}function S0(l){if(l.tag===13||l.tag===31){var u=Pi(l,67108864);u!==null&&Ps(u,l,67108864),Rm(l,67108864)}}function C0(l){if(l.tag===13||l.tag===31){var u=Qs();u=Lt(u);var p=Pi(l,u);p!==null&&Ps(p,l,u),Rm(l,u)}}var Fd=!0;function SE(l,u,p,g){var w=F.T;F.T=null;var A=W.p;try{W.p=2,Om(l,u,p,g)}finally{W.p=A,F.T=w}}function CE(l,u,p,g){var w=F.T;F.T=null;var A=W.p;try{W.p=8,Om(l,u,p,g)}finally{W.p=A,F.T=w}}function Om(l,u,p,g){if(Fd){var w=Lm(g);if(w===null)vm(l,u,g,zd,p),j0(l,g);else if(jE(w,l,u,p,g))g.stopPropagation();else if(j0(l,g),u&4&&-1<AE.indexOf(l)){for(;w!==null;){var A=Zn(w);if(A!==null)switch(A.tag){case 3:if(A=A.stateNode,A.current.memoizedState.isDehydrated){var P=nt(A.pendingLanes);if(P!==0){var G=A;for(G.pendingLanes|=2,G.entangledLanes|=2;P;){var re=1<<31-me(P);G.entanglements[1]|=re,P&=~re}Ua(A),(pn&6)===0&&(kd=ut()+500,bc(0))}}break;case 31:case 13:G=Pi(A,2),G!==null&&Ps(G,A,2),Cd(),Rm(A,2)}if(A=Lm(g),A===null&&vm(l,u,g,zd,p),A===w)break;w=A}w!==null&&g.stopPropagation()}else vm(l,u,g,null,p)}}function Lm(l){return l=zl(l),Pm(l)}var zd=null;function Pm(l){if(zd=null,l=ws(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 A0(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(ue()){case X:return 2;case ae:return 8;case we:case Z:return 32;case ve:return 268435456;default:return 32}default:return 32}}var Im=!1,fi=null,pi=null,hi=null,Cc=new Map,Ac=new Map,mi=[],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 j0(l,u){switch(l){case"focusin":case"focusout":fi=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":hi=null;break;case"pointerover":case"pointerout":Cc.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ac.delete(u.pointerId)}}function jc(l,u,p,g,w,A){return l===null||l.nativeEvent!==A?(l={blockedOn:u,domEventName:p,eventSystemFlags:g,nativeEvent:A,targetContainers:[w]},u!==null&&(u=Zn(u),u!==null&&S0(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 fi=jc(fi,l,u,p,g,w),!0;case"dragenter":return pi=jc(pi,l,u,p,g,w),!0;case"mouseover":return hi=jc(hi,l,u,p,g,w),!0;case"pointerover":var A=w.pointerId;return Cc.set(A,jc(Cc.get(A)||null,l,u,p,g,w)),!0;case"gotpointercapture":return A=w.pointerId,Ac.set(A,jc(Ac.get(A)||null,l,u,p,g,w)),!0}return!1}function N0(l){var u=ws(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,mt(l.priority,function(){C0(p)});return}}else if(u===31){if(u=c(p),u!==null){l.blockedOn=u,mt(l.priority,function(){C0(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=Lm(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=Zn(p),u!==null&&S0(u),l.blockedOn=p,!1;u.shift()}return!0}function T0(l,u,p){$d(l)&&p.delete(u)}function NE(){Im=!1,fi!==null&&$d(fi)&&(fi=null),pi!==null&&$d(pi)&&(pi=null),hi!==null&&$d(hi)&&(hi=null),Cc.forEach(T0),Ac.forEach(T0)}function Hd(l,u){l.blockedOn===u&&(l.blockedOn=null,Im||(Im=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,NE)))}var Ud=null;function _0(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(Pm(g||p)===null)continue;break}var A=Zn(p);A!==null&&(l.splice(u,3),u-=3,Lh(A,{pending:!0,data:w,method:p.method,action:g},g,w))}}))}function el(l){function u(re){return Hd(re,l)}fi!==null&&Hd(fi,l),pi!==null&&Hd(pi,l),hi!==null&&Hd(hi,l),Cc.forEach(u),Ac.forEach(u);for(var p=0;p<mi.length;p++){var g=mi[p];g.blockedOn===l&&(g.blockedOn=null)}for(;0<mi.length&&(p=mi[0],p.blockedOn===null);)N0(p),p.blockedOn===null&&mi.shift();if(p=(l.ownerDocument||l).$$reactFormReplay,p!=null)for(g=0;g<p.length;g+=3){var w=p[g],A=p[g+1],P=w[Mt]||null;if(typeof A=="function")P||_0(p);else if(P){var G=null;if(A&&A.hasAttribute("formAction")){if(w=A,P=A[Mt]||null)G=P.formAction;else if(Pm(w)!==null)continue}else G=P.action;typeof G=="function"?p[g+1]=G:(p.splice(g,3),g-=3),_0(p)}}}function E0(){function l(A){A.canIntercept&&A.info==="react-transition"&&A.intercept({handler:function(){return new Promise(function(P){return w=P})},focusReset:"manual",scroll:"manual"})}function u(){w!==null&&(w(),w=null),g||setTimeout(p,20)}function p(){if(!g&&!navigation.transition){var A=navigation.currentEntry;A&&A.url!=null&&navigation.navigate(A.url,{state:A.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 Bm(l){this._internalRoot=l}Wd.prototype.render=Bm.prototype.render=function(l){var u=this._internalRoot;if(u===null)throw Error(s(409));var p=u.current,g=Qs();w0(p,g,l,u,null,null)},Wd.prototype.unmount=Bm.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var u=l.containerInfo;w0(l.current,2,null,l,null,null),Cd(),u[kn]=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<mi.length&&u!==0&&u<mi[p].priority;p++);mi.splice(p,0,l),p===0&&N0(l)}};var M0=e.version;if(M0!=="19.2.4")throw Error(s(527,M0,"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:F,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 Tc.createRoot=function(l,u){if(!a(l))throw Error(s(299));var p=!1,g="",w=Bv,A=Fv,P=zv;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&&(A=u.onCaughtError),u.onRecoverableError!==void 0&&(P=u.onRecoverableError)),u=y0(l,1,!1,null,null,p,g,null,w,A,P,E0),l[kn]=u.current,ym(l),new Bm(u)},Tc.hydrateRoot=function(l,u,p){if(!a(l))throw Error(s(299));var g=!1,w="",A=Bv,P=Fv,G=zv,re=null;return p!=null&&(p.unstable_strictMode===!0&&(g=!0),p.identifierPrefix!==void 0&&(w=p.identifierPrefix),p.onUncaughtError!==void 0&&(A=p.onUncaughtError),p.onCaughtError!==void 0&&(P=p.onCaughtError),p.onRecoverableError!==void 0&&(G=p.onRecoverableError),p.formState!==void 0&&(re=p.formState)),u=y0(l,1,!0,u,p??null,g,w,re,A,P,G,E0),u.context=v0(null),p=u.current,g=Qs(),g=Lt(g),w=ei(g),w.callback=null,ti(p,w,g),p=g,u.current.lanes=p,_e(u,p),Ua(u),l[kn]=u.current,ym(l),new Wd(u)},Tc.version="19.2.4",Tc}var H0;function CM(){if(H0)return $m.exports;H0=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(),$m.exports=SM(),$m.exports}var AM=CM();const Ft=t=>typeof t=="string",_c=()=>{let t,e;const n=new Promise((s,a)=>{t=s,e=a});return n.resolve=t,n.reject=e,n},U0=t=>t==null?"":String(t),jM=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},NM=/###/g,W0=t=>t&&t.includes("###")?t.replace(NM,"."):t,q0=t=>!t||Ft(t),tu=(t,e,n)=>{const s=Ft(e)?e.split("."):e;let a=0;for(;a<s.length-1;){if(q0(t))return{};const r=W0(s[a]);!t[r]&&n&&(t[r]=new n),Object.prototype.hasOwnProperty.call(t,r)?t=t[r]:t={},++a}return q0(t)?{}:{obj:t,k:W0(s[a])}},V0=(t,e,n)=>{const{obj:s,k:a}=tu(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=tu(t,i,Object);for(;c.obj===void 0&&i.length;)r=`${i[i.length-1]}.${r}`,i=i.slice(0,i.length-1),c=tu(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}=tu(t,e,Object);a[r]=a[r]||[],a[r].push(n)},Lf=(t,e)=>{const{obj:n,k:s}=tu(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)},YA=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?Ft(t[s])||t[s]instanceof String||Ft(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):YA(t[s],e[s],n):t[s]=e[s]);return t},Ki=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),EM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},MM=t=>Ft(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},ob=(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},hu=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:(Ft(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 Ka=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 G0 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):Ft(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||!Ft(s)?d:ob((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),V0(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)(Ft(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?YA(d,s,r):d={...d,...s},V0(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 KA={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 QA=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===QA?t:(t.push(a),n=Proxy.revocable(s,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function ml(t,e){const{[QA]: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 Wm=t=>!Ft(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=Ka.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=Wm(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:Ft(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:Ft(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=ml(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]),e=e.map($=>typeof $=="function"?ml($,{...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,C=(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,_=a.count!==void 0&&!Ft(a.count),D=If.hasDefaultValue(a),E=_?this.pluralResolver.getSuffix(m,a.count,a):"",I=a.ordinal&&_?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",O=_&&!a.ordinal&&a.count===0,T=O&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${E}`]||a[`defaultValue${I}`]||a.defaultValue;let M=v;j&&!v&&D&&(M=T);const R=Wm(M),B=Object.prototype.toString.apply(M);if(j&&M&&R&&!k.includes(B)&&!(Ft(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=$?C:S;for(const F in M)if(Object.prototype.hasOwnProperty.call(M,F)){const W=`${L}${i}${F}`;D&&!v?U[F]=this.translate(W,{...a,defaultValue:Wm(T)?T[F]:void 0,joinArrays:!1,ns:d}):U[F]=this.translate(W,{...a,joinArrays:!1,ns:d}),U[F]===W&&(U[F]=M[F])}v=U}}else if(j&&Ft(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 F=(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 Q=this.resolve(c,{...a,keySeparator:!1});Q&&Q.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 Q=0;Q<Y.length;Q++)V.push(Y[Q]);else this.options.saveMissingTo==="all"?V=this.languageUtils.toResolveHierarchy(a.lng||this.language):V.push(a.lng||this.language);const z=(Q,K,q)=>{var de;const xe=D&&q!==v?q:F;this.options.missingKeyHandler?this.options.missingKeyHandler(Q,f,K,xe,W,a):(de=this.backendConnector)!=null&&de.saveMissing&&this.backendConnector.saveMissing(Q,f,K,xe,W,a),this.emit("missingKey",Q,f,K,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?V.forEach(Q=>{const K=this.pluralResolver.getSuffixes(Q,a);O&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!K.includes(`${this.options.pluralSeparator}zero`)&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(q=>{z([Q],c+q,a[`defaultValue${q}`]||T)})}):z(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=Ft(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&&!Ft(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=Ft(i)?[i]:i;return e!=null&&(c!=null&&c.length)&&s.applyPostProcessor!==!1&&(e=KA.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 Ft(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(d=>typeof d=="function"?ml(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&&!Ft(n.count),y=x&&!n.ordinal&&n.count===0,v=n.context!==void 0&&(Ft(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);m.forEach(C=>{var k,N;this.isValidLookup(s)||(c=C,!this.checkedLoadedFor[`${S[0]}-${C}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((N=this.utils)!=null&&N.hasLoadedNamespace(c))&&(this.checkedLoadedFor[`${S[0]}-${C}`]=!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 E;if(this.isValidLookup(s))return;i=j;const _=[h];if((E=this.i18nFormat)!=null&&E.addLookupKeys)this.i18nFormat.addLookupKeys(_,h,j,C,n);else{let I;x&&(I=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&&I.startsWith(T)&&_.push(h+I.replace(T,this.options.pluralSeparator)),_.push(h+I),y&&_.push(h+O)),v){const M=`${h}${this.options.contextSeparator||"_"}${n.context}`;_.push(M),x&&(n.ordinal&&I.startsWith(T)&&_.push(M+I.replace(T,this.options.pluralSeparator)),_.push(M+I),y&&_.push(M+O))}}let D;for(;D=_.pop();)this.isValidLookup(s)||(r=D,s=this.getResource(j,C,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&&!Ft(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 Y0{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ka.create("languageUtils")}getScriptPartFromCode(e){if(e=hu(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=hu(e),!e||!e.includes("-"))return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ft(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)),Ft(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 Ft(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))):Ft(e)&&r(this.formatLanguageCode(e)),s.forEach(i=>{a.includes(i)||r(this.formatLanguageCode(i))}),a}}const K0={zero:0,one:1,two:2,few:3,many:4,other:5},Q0={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class BM{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Ka.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=hu(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!"),Q0;if(!e.match(/-|_/))return Q0;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)=>K0[a]-K0[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 X0=(t,e,n,s=".",a=!0)=>{let r=_M(t,e,n);return!r&&a&&Ft(n)&&(r=ob(t,n,s),r===void 0&&(r=ob(e,n,s))),r},qm=t=>t.replace(/\$/g,"$$$$");class J0{constructor(e={}){var n;this.logger=Ka.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:C,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?Ki(r):i||"{{",this.suffix=c?Ki(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=h?"":m||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=x?Ki(x):y||Ki("$t("),this.nestingSuffix=v?Ki(v):S||Ki(")"),this.nestingOptionsSeparator=C||",",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=X0(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),C=S.shift().trim(),k=S.join(this.formatSeparator).trim();return this.format(X0(n,d,C,this.options.keySeparator,this.options.ignoreJSONStructure),k,s,{...a,...n,interpolationkey:C})};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=>qm(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?qm(this.escape(v)):qm(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=Ft(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!Ft(i)&&!this.useRawValueToEscape&&(i=U0(i));const C=v.safeValue(i);if(e=e.replace(r[0],C),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(`${Ki(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&&!Ft(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&&!Ft(r))return r;Ft(r)||(r=U0(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}},Z0=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(hu(s),a),e[i]=c),c(n)}},zM=t=>(e,n,s)=>t(hu(n),s)(e);class $M{constructor(e={}){this.logger=Ka.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?Z0: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()]=Z0(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=Ka.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();Ft(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ft(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(C=>c(null,C)).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 Vm=()=>({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]),Ft(t[1])&&(e.defaultValue=t[1]),Ft(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}),ek=t=>(Ft(t.ns)&&(t.ns=[t.ns]),Ft(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ft(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 nu extends mp{constructor(e={},n){if(super(),this.options=ek(e),this.services={},this.logger=Ka,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&&(Ft(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const s=Vm();this.options={...s,...this.options,...ek(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?Ka.init(a(this.modules.logger),this.options):Ka.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=$M;const h=new Y0(this.options);this.store=new G0(this.options.resources,this.options);const m=this.services;m.logger=Ka,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 J0(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=_c(),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=Ft(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=_c();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"&&KA.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=_c();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=Ft(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(d)?d:this.services.languageUtils.getBestMatchFromCodes(Ft(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=ml(d.keyPrefix,f));const h=this.options.keySeparator||".";let m;return d.keyPrefix&&Array.isArray(r)?m=r.map(x=>(typeof x=="function"&&(x=ml(x,f)),`${d.keyPrefix}${h}${x}`)):(typeof r=="function"&&(r=ml(r,f)),m=d.keyPrefix?`${d.keyPrefix}${h}${r}`:r),this.t(m,d)};return Ft(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=_c();return this.options.ns?(Ft(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=_c();Ft(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 Y0(Vm());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 nu(e,n);return s.createInstance=nu.createInstance,s}cloneInstance(e={},n=Vd){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},r=new nu(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 G0(c,a),r.services.resourceStore=r.store}if(e.interpolation){const d={...Vm().interpolation,...this.options.interpolation,...e.interpolation},f={...a,interpolation:d};r.services.interpolator=new J0(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 _n=nu.createInstance();_n.createInstance;_n.dir;_n.init;_n.loadResources;_n.reloadResources;_n.use;_n.changeLanguage;_n.getFixedT;_n.t;_n.exists;_n.setDefaultNamespace;_n.hasLoadedNamespace;_n.loadNamespaces;_n.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);uo(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)},tk={},lb=(t,e,n,s)=>{uo(n)&&tk[n]||(uo(n)&&(tk[n]=new Date),qM(t,e,n,s))},XA=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},cb=(t,e,n)=>{t.loadNamespaces(e,XA(t,n))},nk=(t,e,n,s)=>{if(uo(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return cb(t,n,s);n.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,XA(t,s))},VM=(t,e,n={})=>!e.languages||!e.languages.length?(lb(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}}),uo=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={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},QM=t=>KM[t],XM=t=>t.replace(YM,QM);let ub={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:XM,transDefaultProps:void 0};const JM=(t={})=>{ub={...ub,...t}},ZM=()=>ub;let JA;const eD=t=>{JA=t},tD=()=>JA,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 Gm={exports:{}},Ym={};/**
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 sk;function rD(){if(sk)return Ym;sk=1;var t=Yb();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,C=v[1];return r(function(){S.value=y,S.getSnapshot=x,d(S)&&C({inst:S})},[m,y,x]),a(function(){return d(S)&&C({inst:S}),m(function(){d(S)&&C({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 Ym.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,Ym}var ak;function iD(){return ak||(ak=1,Gm.exports=rD()),Gm.exports}var oD=iD();const lD=(t,e)=>{if(uo(e))return e;if(GM(e)&&uo(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=()=>()=>{},pt=(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||lb(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=b.useMemo(()=>{var B;return{...ZM(),...(B=r==null?void 0:r.options)==null?void 0:B.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=uo(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(B=>{if(!r)return uD;const{bindI18n:$,bindI18nStore:U}=i,L=()=>{x.current+=1,B()};return $&&r.on($,L),U&&r.store.on(U,L),()=>{$&&$.split(" ").forEach(F=>r.off(F,L)),U&&U.split(" ").forEach(F=>r.store.off(F,L))}},[r,i]),v=b.useRef(),S=b.useCallback(()=>{if(!r)return cD;const B=!!(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===B&&L.lng===$&&L.keyPrefix===d&&L.revision===U)return L;const W={t:r.getFixedT($,i.nsMode==="fallback"?m:m[0],d),ready:B,lng:$,keyPrefix:d,revision:U};return v.current=W,W},[r,m,d,i,e.lng]),[C,k]=b.useState(0),{t:N,ready:j}=oD.useSyncExternalStore(y,S,S);b.useEffect(()=>{if(r&&!j&&!c){const B=()=>k($=>$+1);e.lng?nk(r,e.lng,m,B):cb(r,m,B)}},[r,e.lng,m,j,c,C]);const _=r||{},D=b.useRef(null),E=b.useRef(),I=B=>{const $=Object.getOwnPropertyDescriptors(B);$.__original&&delete $.__original;const U=Object.create(Object.getPrototypeOf(B),$);if(!Object.prototype.hasOwnProperty.call(U,"__original"))try{Object.defineProperty(U,"__original",{value:B,writable:!1,enumerable:!1,configurable:!1})}catch{}return U},O=b.useMemo(()=>{const B=_,$=B==null?void 0:B.language;let U=B;B&&(D.current&&D.current.__original===B?E.current!==$?(U=I(B),D.current=U,E.current=$):U=D.current:(U=I(B),D.current=U,E.current=$));const L=!j&&!c?(...W)=>(lb(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,F=[L,U,j];return F.t=L,F.i18n=U,F.ready=j,F},[N,_,j,_.resolvedLanguage,_.language,_.languages]);if(r&&c&&!j)throw new Promise(B=>{const $=()=>B();e.lng?nk(r,e.lng,m,$):cb(r,m,$)});return O};function db(t){"@babel/helpers - typeof";return db=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},db(t)}function ZA(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":db(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 rk(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},ik={},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 ik)return;ik[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 ok(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 lk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ok(Object(n),!0).forEach(function(s){gD(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ok(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 fo(e)=="symbol"?e:e+""}function xD(t,e){if(fo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(fo(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fo(t){"@babel/helpers - typeof";return fo=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},fo(t)}var Si=typeof fetch=="function"?fetch:void 0;typeof global<"u"&&global.fetch?Si=global.fetch:typeof window<"u"&&window.fetch&&(Si=window.fetch);var mu;ZA()&&(typeof global<"u"&&global.XMLHttpRequest?mu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(mu=window.XMLHttpRequest));var Bf;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Bf=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Bf=window.ActiveXObject));typeof Si!="function"&&(Si=void 0);if(!Si&&!mu&&!Bf)try{vt(()=>import("./browser-ponyfill-DZOWXZ4K.js").then(t=>t.b),__vite__mapDeps([0,1])).then(function(t){Si=t.default}).catch(function(){})}catch{}var fb=function(e,n){if(n&&fo(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},ck=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):Si(e,n).then(r).catch(s)},uk=!1,yD=function(e,n,s,a){e.queryStringParams&&(n=fb(n,e.queryStringParams));var r=lk({},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=lk({method:s?"POST":"GET",body:s?e.stringify(s):void 0,headers:r},uk?{}:i),d=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{ck(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]}),ck(n,c,a,d),uk=!0}catch(h){a(h)}}},vD=function(e,n,s,a){s&&fo(s)==="object"&&(s=fb("",s).slice(1)),e.queryStringParams&&(n=fb(n,e.queryStringParams));try{var r=mu?new mu: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(){},Si&&n.indexOf("file:")!==0)return yD(e,n,s,a);if(ZA()||typeof ActiveXObject=="function")return vD(e,n,s,a);a(new Error("No fetch and no xhr implementation found!"))};function vl(t){"@babel/helpers - typeof";return vl=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},vl(t)}function dk(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 Km(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dk(Object(n),!0).forEach(function(s){ej(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dk(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,tj(s.key),s)}}function CD(t,e,n){return e&&SD(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ej(t,e,n){return(e=tj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tj(t){var e=AD(t,"string");return vl(e)=="symbol"?e:e+""}function AD(t,e){if(vl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(vl(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 ej({},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"}}},nj=(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=Km(Km(Km({},jD()),this.options||{}),a),this.allOptions=r,this.services&&this.options.reloadInterval){var i=setInterval(function(){return s.reload()},this.options.reloadInterval);vl(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=rk(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(C){return x.indexOf(C)>-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=rk(y,{lng:x,ns:s});c.options.request(c.options,v,d,function(S,C){f+=1,h.push(S),m.push(C),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)})})})}}}])})();nj.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 fk=/^[\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(!fk.test(s.domain))throw new TypeError("option domain is invalid");r+=`; Domain=${s.domain}`}if(s.path){if(!fk.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},pk={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 pk.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:s,cookieDomain:a,cookieOptions:r}=e;n&&typeof document<"u"&&pk.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 tl=null;const hk=()=>{if(tl!==null)return tl;try{if(tl=typeof window<"u"&&window.localStorage!==null,!tl)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{tl=!1}return tl};var LD={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&hk())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&hk()&&window.localStorage.setItem(n,t)}};let nl=null;const mk=()=>{if(nl!==null)return nl;try{if(nl=typeof window<"u"&&window.sessionStorage!==null,!nl)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{nl=!1}return nl};var PD={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&mk())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&mk()&&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 sj=!1;try{document.cookie,sj=!0}catch{}const aj=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];sj||aj.splice(1,1);const $D=()=>({order:aj,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class rj{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)}))}}rj.type="languageDetector";const Ff={idle:"#4aff9e",working:"#4a9eff",waiting:"#ff9e4a",waiting_permission:"#ffcc00",error:"#ff4a4a",offline:"#888888",orphaned:"#ff9e4a",default:"#888888"},pb={running:"#4aff9e",stopped:"#888888",error:"#ff4a4a",unknown:"#ffaa00",starting:"#4a9eff",stopping:"#ffaa00"},HD={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888888"},Iq=["#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 Qb(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 Xb(t){return Ff[t]??Ff.default}let kf=null;function ij(){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=ij(),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 gp(t){var f;const e=ij(),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 su(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:""}_n.use(nj).use(rj).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(_n)});const ft={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",AOP_TRACKING_BOARD_VISIBLE:"tide-aop-tracking-board-visible",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"},hb="tide-backend-url-change";function ta(t,e){try{const n=localStorage.getItem(t);return n===null?e:JSON.parse(n)}catch{return e}}function va(t,e=""){try{return localStorage.getItem(t)??e}catch{return e}}function _r(t,e=!1){try{const n=localStorage.getItem(t);return n===null?e:n==="true"}catch{return e}}function Jb(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 ya(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function er(t,e){try{localStorage.setItem(t,e)}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function Qa(t,e){try{localStorage.setItem(t,String(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function Zb(t,e){try{localStorage.setItem(t,String(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function gk(t){try{localStorage.removeItem(t)}catch(e){console.error(`Failed to remove from localStorage: ${t}`,e)}}function Sa(){const t=ex();return t?t.replace(/\/$/,""):`${window.location.protocol}//${window.location.host}`}function Ni(){return va(ft.AUTH_TOKEN,"")}function ex(){return va(ft.BACKEND_URL,"")}function GD(t){const e=t.trim();er(ft.BACKEND_URL,e),typeof window<"u"&&window.dispatchEvent(new CustomEvent(hb,{detail:e}))}function YD(t){if(typeof window>"u")return()=>{};const e=s=>{t(s.detail)},n=s=>{s.key===ft.BACKEND_URL&&t(s.newValue??"")};return window.addEventListener(hb,e),window.addEventListener("storage",n),()=>{window.removeEventListener(hb,e),window.removeEventListener("storage",n)}}function Dt(t){return`${Sa()}${t}`}async function Bt(t,e){const n=Ni(),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 mb(t){const e=Ni();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 ns(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 na=[],XD=new Set;function zf(){XD.forEach(t=>t())}function JD(t,e){const n=na.findIndex(s=>s.id===t);return n!==-1&&na.splice(n,1),na.push({id:t,close:e}),zf(),()=>{const s=na.findIndex(a=>a.id===t);s!==-1&&(na.splice(s,1),zf())}}function Sf(){return na.length===0?!1:(na.pop().close(),zf(),!0)}function ZD(t){const e=na.findIndex(n=>n.id===t);return e===-1?!1:e<na.length-1}function eR(...t){const e=new Set(t);for(;na.length>0;){const n=na[na.length-1];if(e.has(n.id))break;na.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 gu=5,Qm={0:0,1:4,2:8,3:14,4:25,5:50};let au=null,bk=!1;async function tR(){if(bk)return au;bk=!0;try{const t=await vt(()=>import("./index-Bu3B9Eke.js"),__vite__mapDeps([2,3,1,4]));au={Haptics:t.Haptics,ImpactStyle:t.ImpactStyle}}catch{}return au}tR();function $f(t){const e=Math.round(t),n=e<=0?0:e>=gu?gu:e;if(n!==0){if(au){const{Haptics:s,ImpactStyle:a}=au;if(n<=2&&typeof s.selectionChanged=="function"){s.selectionChanged().catch(()=>{navigator.vibrate&&navigator.vibrate(Qm[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(Qm[n])});return}}navigator.vibrate&&navigator.vibrate(Qm[n])}}function xk(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 C=S.touches[0];h.current={startX:C.clientX,startY:C.clientY,startTime:Date.now(),isTracking:!0,hasMovedEnough:!1}},[]),x=b.useCallback(S=>{if(!h.current.isTracking||S.touches.length!==1)return;const C=S.touches[0],k=C.clientX-h.current.startX;if(Math.abs(C.clientY-h.current.startY)>s){h.current.isTracking=!1,h.current.hasMovedEnough&&(d==null||d());return}const _=window.innerWidth*.4,D=Math.max(-1,Math.min(1,k/_));Math.abs(k)>=12&&(h.current.hasMovedEnough=!0,c==null||c(D))},[s,c,d]),y=b.useCallback(S=>{const C=h.current.isTracking,k=h.current.hasMovedEnough;if(!C)return;const N=S.changedTouches[0],j=N.clientX-h.current.startX,_=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&&_<=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 yk=8,nR=.93,vk=.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 C=n.current;if(C){const k=Math.round(C.clientHeight/2);C.style.paddingTop=`${k}px`,C.style.paddingBottom=`${k}px`}},[n]),y=b.useCallback(()=>{f.current=!1,h.current=null,i(!1),d(null);const C=n.current;C&&(C.style.paddingTop="",C.style.paddingBottom="")},[n]),v=b.useCallback(C=>{const k=n.current;if(!k)return;k.scrollTop+=C;const N=k.getBoundingClientRect(),j=N.top+N.height/2,_=N.left+N.width/2,D=document.elementFromPoint(_,j);let E=null;if(D){const I=D.closest("[data-agent-id]");I&&k.contains(I)&&(E=I.dataset.agentId)}if(E!==h.current&&(h.current=E,d(E),E)){const I=H.getState().settings.vibrationIntensity??1;$f(I)}},[n]),S=b.useCallback(()=>{const C=h.current;if(C){const k=H.getState().settings.vibrationIntensity??1,N=k<=0?0:Math.min(k+1,gu);$f(N),m.current(C)}y()},[y]);return b.useEffect(()=>{const C=e.current;if(!C||!s)return;const k=C.style.touchAction;C.style.touchAction="none";let N=!1,j=!1,_=0,D=0,E=0,I=0,O=0,T=0,M=0,R=0;const B=()=>{M&&(cancelAnimationFrame(M),M=0)},$=()=>{if(Math.abs(T)<vk){T=0;return}C.scrollTop+=T,T*=nR,M=requestAnimationFrame($)},U=V=>{if(B(),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,_=V.touches[0].clientX,D=V.touches[0].clientY,E=C.scrollTop,I=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 Q=(V.touches[0].clientY+V.touches[1].clientY)/2,K=R-Q;R=Q,v(K);return}if(f.current&&V.touches.length===1){V.preventDefault();const Q=V.touches[0].clientY,K=R-Q;R=Q,v(K);return}if(!N&&!j)return;const Y=V.touches[0].clientX,z=V.touches[0].clientY;if(N&&!j){const Q=Math.abs(Y-_),K=Math.abs(z-D);if(Q<yk&&K<yk)return;if(K>=Q)j=!0,N=!1,V.preventDefault();else{N=!1;return}}if(j){V.preventDefault();const Q=performance.now(),K=Q-O;C.scrollTop=E+(D-z),K>0&&(T=(I-z)/K*16),I=z,O=Q}},F=V=>{if(f.current&&V.touches.length===0){S();return}f.current||(j||N)&&V.touches.length===0&&(j&&Math.abs(T)>vk&&(M=requestAnimationFrame($)),j=!1,N=!1)},W=()=>{j=!1,N=!1,B(),f.current&&y()};return C.addEventListener("touchstart",U,{passive:!1}),C.addEventListener("touchmove",L,{passive:!1}),C.addEventListener("touchend",F,{passive:!0}),C.addEventListener("touchcancel",W,{passive:!0}),()=>{C.removeEventListener("touchstart",U),C.removeEventListener("touchmove",L),C.removeEventListener("touchend",F),C.removeEventListener("touchcancel",W),C.style.touchAction=k,B();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 C=[];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),C.push(()=>window.removeEventListener("focus",N),()=>document.removeEventListener("visibilitychange",j))}return v.__cleanupFns=C,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 Ec(){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(){Ze(this,"messages",new Map);Ze(this,"logs",[]);Ze(this,"maxMessagesPerAgent",200);Ze(this,"maxLogs",500);Ze(this,"enabled",!0);Ze(this,"listeners",new Set);Ze(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:Ec(),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:Ec(),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:Ec(),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:Ec(),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:Ec(),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 hs=new lR,bu={debug:(t,e,n)=>hs.debug(t,e,n),info:(t,e,n)=>hs.info(t,e,n),warn:(t,e,n)=>hs.warn(t,e,n),error:(t,e,n)=>hs.error(t,e,n)};/*! Capacitor: https://capacitorjs.com/ - MIT License */var wl;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(wl||(wl={}));class Xm 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 C;const k=async()=>(!C&&v in x?C=typeof x[v]=="function"?C=await x[v]():C=x[v]:e!==null&&!C&&"web"in x&&(C=typeof x.web=="function"?C=await x.web():C=x.web),C),N=(O,T)=>{var M,R;if(S){const B=S==null?void 0:S.methods.find($=>T===$.name);if(B)return B.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 Xm(`"${m}" plugin is not implemented on ${v}`,wl.Unimplemented)}},j=O=>{let T;const M=(...R)=>{const B=k().then($=>{const U=N($,O);if(U){const L=U(...R);return T=L==null?void 0:L.remove,L}else throw new Xm(`"${m}.${O}()" is not implemented on ${v}`,wl.Unimplemented)});return O==="addListener"&&(B.remove=async()=>T()),B};return M.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(M,"name",{value:O,writable:!1,configurable:!1}),M},_=j("addListener"),D=j("removeListener"),E=(O,T)=>{const M=_({eventName:O},T),R=async()=>{const $=await M;D({eventName:O,callbackId:$},T)},B=new Promise($=>M.then(()=>$({remove:R})));return B.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await R()},B},I=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]=I,f.set(m,{name:m,proxy:I,platforms:new Set([...Object.keys(x),...S?[v]:[]])}),I};return n.convertFileSrc||(n.convertFileSrc=m=>m),n.getPlatform=a,n.handleError=d,n.isNativePlatform=r,n.isPluginAvailable=i,n.registerPlugin=h,n.Exception=Xm,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:{}),Nu=Hf.registerPlugin;class tx{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,wl.Unimplemented)}unavailable(e="not available"){return new Hf.Exception(e,wl.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 wk=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),kk=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class fR extends tx{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=kk(a).trim(),r=kk(r).trim(),n[a]=r}),n}async setCookie(e){try{const n=wk(e.key),s=wk(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)}}}Nu("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 tx{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 Bq=Nu("CapacitorHttp",{web:()=>new bR});var Sk;(function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"})(Sk||(Sk={}));var Ck;(function(t){t.StatusBar="StatusBar",t.NavigationBar="NavigationBar"})(Ck||(Ck={}));class xR extends tx{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")}}Nu("SystemBars",{web:()=>new xR});var Ak;(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"})(Ak||(Ak={}));const nx=Nu("LocalNotifications",{web:()=>vt(()=>import("./web-D4vvRMYa.js"),__vite__mapDeps([5,3,1,4])).then(t=>new t.LocalNotificationsWeb)}),yR=Nu("ServerConfig");let vR=100;const wR="agent_alerts",gb="tide-notification-tap";function kR(){return typeof window<"u"&&window.innerWidth<=768&&"ontouchstart"in window}function oj(t){if(kR()){H.openTerminalOnMobile(t);return}if(document.querySelector(".commander-overlay")){H.requestCommanderExpand(t);return}H.selectAgent(t),H.setTerminalOpen(!0)}function Tu(){try{return Hf.isNativePlatform()}catch{return!1}}async function SR(){if(Tu())try{const t=await nx.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(Tu())try{const r=vR++;console.log("[Notifications] Scheduling native notification id="+r,e),await nx.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(gb,{detail:a}))}}}let Jm=!1;async function AR(t){const e=[];if(Jm)return()=>{};if(Jm=!0,t){const n=s=>{const a=s;a.detail&&t(a.detail)};window.addEventListener(gb,n),e.push(()=>window.removeEventListener(gb,n))}if(Tu())try{const n=await nx.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()),Jm=!1}}function jR(t,e){Tu()&&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 bp=()=>window.__tideWsState.ws,jk=t=>{window.__tideWsState.ws=t},NR=()=>window.__tideWsState.isConnecting,Mc=t=>{window.__tideWsState.isConnecting=t},bb=()=>window.__tideWsState.reconnectAttempts,xb=t=>{window.__tideWsState.reconnectAttempts=t},lj=()=>window.__tideWsState.reconnectTimeout,cj=t=>{window.__tideWsState.reconnectTimeout=t},Nk=10,sx="tide_ws_has_connected";function Tk(){return sessionStorage.getItem(sx)==="true"}function TR(t){sessionStorage.setItem(sx,"true")}function _R(){sessionStorage.removeItem(sx)}let uj=null;const ER=t=>{uj=t},_k=()=>uj,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 dj(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,yb={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(){Ze(this,"frames",[]);Ze(this,"lastFrameTime",0);Ze(this,"frameCount",0);Ze(this,"fps",0);Ze(this,"minFps",1/0);Ze(this,"maxFps",0);Ze(this,"fpsHistory",[]);Ze(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(){Ze(this,"snapshots",[]);Ze(this,"maxSnapshots",120);Ze(this,"intervalId",null);Ze(this,"leakThresholdMB",50);Ze(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 Dc=new LR;function Yc(t,e,n,s,a,r){}function fj(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 vb=ft.PENDING_MESSAGES,PR=300*1e3;function pj(){try{const t=localStorage.getItem(vb);if(!t)return[];const e=JSON.parse(t),n=Date.now();return e.filter(s=>n-s.queuedAt<PR)}catch{return[]}}function hj(t){try{t.length===0?localStorage.removeItem(vb):localStorage.setItem(vb,JSON.stringify(t))}catch{}}function Qd(t){const e=pj();e.push({message:t,queuedAt:Date.now()}),hj(e)}function IR(){var s;const t=pj();if(t.length===0)return 0;let e=0;const n=[];for(const a of t)BR(a.message)?e++:n.push(a);if(hj(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 ax(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=bp();if(!e||e.readyState!==WebSocket.OPEN)return!1;try{const n=JSON.stringify(t),s=ax(t);return console.log("[AgentDebugger] SENT - type:",t.type,"agentId:",s,"payload:",t.payload),s&&hs.captureSent(s,n),e.send(n),!0}catch{return!1}}function rx(t){var n,s,a,r,i,c,d,f,h,m;const e=bp();if(!e)return(n=_k())==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=_k())==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=ax(t);return console.log("[AgentDebugger] SENT - type:",t.type,"agentId:",y,"payload:",t.payload),y&&hs.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 Kc=new Set,FR=5e3;function Ek(t){if(!t.isDetached||!t.sessionId){Kc.delete(t.id);return}Kc.has(t.id)||(Kc.add(t.id),rx({type:"reattach_agent",payload:{agentId:t.id}}),setTimeout(()=>{Kc.delete(t.id)},FR))}function zR(t){var e,n,s,a,r,i,c,d,f,h,m,x,y,v,S,C,k,N,j,_,D,E,I,O;switch(yb.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)Ek(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),B=(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})${B?" ⚡ STATUS CHANGED":""}`),B&&console.log(`[Tide] 🔔 Status change for ${T.name}: ${R==null?void 0:R.status} → ${T.status}`),B&&(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),Ek(T),(i=Oe.onAgentUpdated)==null||i.call(Oe,T,$);break}case"agent_deleted":{const{id:T}=t.payload;Kc.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(bu.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;bu.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:B,isError:$}=t.payload;H.appendBossStreamingLogChunk(T,M,R,B,$);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),(C=Oe.onAgentCreated)==null||C.call(Oe,T),rx({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:B}=t.payload;console.log(`[WebSocket] Agent ${R} started task for boss ${T}: ${B.slice(0,50)}...`),H.handleAgentTaskStarted(T,M,R,B);break}case"agent_task_output":{const{bossId:T,subordinateId:M,output:R,isStreaming:B,timestamp:$,subagentName:U,toolName:L,toolInput:F,toolOutput:W}=t.payload;H.handleAgentTaskOutput(T,M,{text:R,isStreaming:B||!1,timestamp:$||Date.now(),subagentName:U,toolName:L,toolInput:F,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}`),(_=Oe.onCustomClassesSync)==null||_.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}`),(E=Oe.onAgentNotification)==null||E.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 B=[0,80,220,500,1e3];for(const $ of B)window.setTimeout(()=>{window.focus()},$);break}case"exec_task_started":{const{taskId:T,agentId:M,agentName:R,command:B,cwd:$}=t.payload;console.log(`[WebSocket] Exec task started: ${T} for agent ${R}: ${B.slice(0,50)}...`),H.handleExecTaskStarted(T,M,R,B,$);break}case"exec_task_output":{const{taskId:T,agentId:M,output:R,isError:B}=t.payload;H.handleExecTaskOutput(T,M,R,B);break}case"exec_task_completed":{const{taskId:T,agentId:M,exitCode:R,success:B}=t.payload;console.log(`[WebSocket] Exec task completed: ${T} for agent ${M}, success: ${B}`),H.handleExecTaskCompleted(T,M,R,B);break}case"subagent_started":{const T=t.payload;console.log(`[WebSocket] Subagent started: ${T.name} (${T.id}) for agent ${T.parentAgentId}`),H.addSubagent(T),(I=Oe.onSubagentStarted)==null||I.call(Oe,T);break}case"subagent_output":{const{subagentId:T,parentAgentId:M,text:R,timestamp:B}=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:B})}else R.startsWith("Using ")&&H.addSubagentActivity(T,M,{toolName:R.slice(6).trim(),description:"",timestamp:B});break}case"subagent_completed":{const{subagentId:T,parentAgentId:M,success:R,resultPreview:B,subagentName:$,durationMs:U,tokensUsed:L,toolUseCount:F}=t.payload;console.log(`[WebSocket] Subagent completed: ${T} for agent ${M}, success: ${R}`),(U||L||F)&&H.updateSubagentStats(T,M,{durationMs:U||0,tokensUsed:L||0,toolUseCount:F||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?"✅":"❌",z=U?` (${(U/1e3).toFixed(0)}s · ${((L||0)/1e3).toFixed(1)}K tokens · ${F||0} tools)`:"";H.addOutput(M,{text:`${Y} Subagent ${V} ${R?"completed":"failed"}${z}`,isStreaming:!1,timestamp:Date.now(),subagentName:V,toolOutput:B});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:B,serverVersion:$}=t.payload;H.setConnectionStatus(T,M,{connected:R,error:B,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:B}=t.payload;H.setTables(T,M,R,B),console.log(`[WebSocket] Received ${B.length} tables for ${R}`);break}case"table_schema":{const{buildingId:T,connectionId:M,database:R,table:B,columns:$,indexes:U,foreignKeys:L}=t.payload;H.setTableSchema(T,M,R,B,{columns:$,indexes:U||[],foreignKeys:L||[]}),console.log(`[WebSocket] Received schema for ${B}`);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:B,affectedRows:$,error:U}=t.payload;H.setSilentQueryResult(T,{query:M,requestId:R,success:B,affectedRows:$,error:U}),console.log(`[WebSocket] Silent query ${B?"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}}yb.end(`ws:${t.type}`)}ER(()=>xu());let Mk=!1;function mj(){const t=bp();t&&t.readyState===WebSocket.OPEN&&t.close(1e3,"Page unloading");const e=lj();e&&clearTimeout(e),window.__tideWsState&&(window.__tideWsState.ws=null,window.__tideWsState.reconnectTimeout=null,window.__tideWsState.isConnecting=!1,window.__tideWsState.reconnectAttempts=0),_R()}function $R(){Mk||(window.addEventListener("beforeunload",mj),Mk=!0)}function gj(){mj(),H.setConnected(!1),H.stopStatusPolling()}function HR(){gj(),xb(0),setTimeout(()=>xu(),100)}function xu(){$R();const t=lj();t&&(clearTimeout(t),cj(null));const e=bp();if(NR()||e&&e.readyState===WebSocket.CONNECTING)return;if(e&&e.readyState===WebSocket.OPEN){Tk()&&Oe.onReconnect&&Oe.onReconnect();return}xb(bb()+1),Mc(!0);const n=ex(),s=Ni(),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{Mc(!1),Dk();return}jk(i),i.onopen=()=>{var d,f,h;const c=Tk();Mc(!1),xb(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=ax(d);console.log("[AgentDebugger] RECEIVED - type:",d.type,"agentId:",f,"payload:",d.payload),f&&hs.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;Mc(!1),jk(null),H.setConnected(!1),H.stopStatusPolling();const c=bb();c<Nk?((d=Oe.onToast)==null||d.call(Oe,"warning","Disconnected",`Connection lost. Reconnecting... (attempt ${c+1}/${Nk})`),Dk()):(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=()=>{Mc(!1)},H.setSendMessage(rx)}function Dk(){const t=bb(),e=Math.min(1e3*Math.pow(2,t-1),3e4);cj(setTimeout(xu,e))}function UR(t,e){const n={position:t,target:e};ya(ft.CAMERA_STATE,n)}function WR(){return ta(ft.CAMERA_STATE,null)}function Fq(t,e,n){const s={posX:t,posZ:e,zoom:n};ya(ft.CAMERA_STATE_2D,s)}function zq(){return ta(ft.CAMERA_STATE_2D,null)}function Ml(){return{Authorization:`Bearer ${Ni()}`,"Content-Type":"application/json"}}async function qR(){const t=await fetch(`${Sa()}/api/workspaces`,{headers:Ml()});if(!t.ok)throw new Error(`Failed to fetch workspaces: ${t.statusText}`);return t.json()}async function VR(t,e){const n=await fetch(`${Sa()}/api/workspaces`,{method:"POST",headers:Ml(),body:JSON.stringify({name:t,areaIds:e})});if(!n.ok)throw new Error(`Failed to create workspace: ${n.statusText}`);return n.json()}async function Rk(t,e){const n=await fetch(`${Sa()}/api/workspaces/${t}`,{method:"PUT",headers:Ml(),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(`${Sa()}/api/workspaces/${t}`,{method:"DELETE",headers:Ml()});if(!e.ok)throw new Error(`Failed to delete workspace: ${e.statusText}`)}async function YR(){const t=await fetch(`${Sa()}/api/workspaces/active`,{headers:Ml()});if(!t.ok)throw new Error(`Failed to get active workspace: ${t.statusText}`);return(await t.json()).activeWorkspaceId??null}async function Ok(t){const e=await fetch(`${Sa()}/api/workspaces/active`,{method:"PUT",headers:Ml(),body:JSON.stringify({workspaceId:t})});if(!e.ok)throw new Error(`Failed to set active workspace: ${e.statusText}`)}const yu=new Set;let Xa=null,to=[],bj=!1;const wb=new Set;function Zm(t){bj=t,wb.forEach(e=>e(t))}const xj="tide-commander-active-workspace";function Lk(){return typeof window>"u"?null:localStorage.getItem(xj)||null}function eg(t){typeof window>"u"||localStorage.setItem(xj,t||"")}function Rc(){yu.forEach(t=>t())}function KR(){return Xa}function xp(t){return Xa?t?Xa.areaIds.includes(t):!1:!0}function $q(t){return Xa?Xa.areaIds.includes(t):!0}function ix(){const[,t]=b.useState(0);return b.useEffect(()=>{const e=()=>t(n=>n+1);return yu.add(e),()=>{yu.delete(e)}},[]),[Xa,to]}function QR(t){return yu.add(t),()=>{yu.delete(t)}}function XR(){const[t,e]=b.useState(bj);return b.useEffect(()=>{const n=s=>e(s);return wb.add(n),()=>{wb.delete(n)}},[]),t}const tg=new Map,yj=Ce.memo(function(){const{t:e}=pt("common"),n=rr(),[s,a]=b.useState([]),[r,i]=b.useState(()=>Lk()),[c,d]=b.useState(!1),[f,h]=b.useState(!1),[m,x]=b.useState(!0),[y,v]=b.useState(null),[S,C]=b.useState(""),[k,N]=b.useState([]),[j,_]=b.useState(!1),D=b.useRef(null);b.useEffect(()=>{let L=!1;return(async()=>{try{const F=Lk(),[W,V]=await Promise.all([qR(),YR()]);if(L)return;const Y=F&&W.some(z=>z.id===F)?F:V&&W.some(z=>z.id===V)?V:null;a(W),to=W,i(Y),eg(Y),Xa=W.find(z=>z.id===Y)??null,Rc()}catch(F){console.error("workspace error:",F)}finally{L||x(!1)}})(),()=>{L=!0}},[]),b.useEffect(()=>{if(!c&&!f)return;const L=F=>{D.current&&!D.current.contains(F.target)&&(d(!1),h(!1))};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[c,f]);const E=b.useMemo(()=>s.find(L=>L.id===r)??null,[s,r]),I=b.useCallback(async L=>{Zm(!0);const F=Date.now();if(r){const z=WR();z&&(tg.set(r,z),Rk(r,{cameraState:z}).then(Q=>{a(K=>{const q=K.map(xe=>xe.id===r?Q:xe);return to=q,q})}).catch(Q=>console.error("workspace error:",Q)))}i(L),eg(L),d(!1);const W=L?s.find(z=>z.id===L)??null:null;if(Xa=W,to=s,Rc(),L){const Q=(W==null?void 0:W.cameraState)??tg.get(L);Q&&(UR(Q.position,Q.target),tg.set(L,Q))}Ok(L).catch(z=>console.error("workspace error:",z));const V=Date.now()-F,Y=400;V<Y?setTimeout(()=>Zm(!1),Y-V):Zm(!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),F=[...s,L];a(F),to=F,Rc(),C(""),N([]),_(!1)}catch(L){console.error("workspace error:",L)}},[S,k,s]),M=b.useCallback(async()=>{if(!(!y||!S.trim()))try{const L=await Rk(y,{name:S.trim(),areaIds:k}),F=s.map(W=>W.id===y?L:W);a(F),to=F,y===r&&(Xa=L),Rc(),v(null),C(""),N([])}catch(L){console.error("workspace error:",L)}},[y,S,k,s,r]),R=b.useCallback(async L=>{try{await GR(L);const F=s.filter(W=>W.id!==L);a(F),to=F,r===L&&(i(null),eg(null),Xa=null,await Ok(null).catch(W=>console.error("workspace error:",W))),Rc()}catch(F){console.error("workspace error:",F)}},[s,r]),B=b.useCallback(L=>{v(L.id),C(L.name),N([...L.areaIds]),_(!1)},[]),$=b.useCallback(()=>{v(null),C(""),N([]),_(!0)},[]),U=b.useCallback(L=>{N(F=>F.includes(L)?F.filter(W=>W!==L):[...F,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:E?E.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:()=>I(null),children:e("agentBar.allWorkspaces",{defaultValue:"All"})}),s.map(L=>o.jsxs("button",{className:`workspace-switcher-option ${L.id===r?"active":""}`,onClick:()=>I(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:F=>C(F.target.value),className:"workspace-switcher-input",placeholder:"Workspace name",autoFocus:!0,onKeyDown:F=>{F.key==="Enter"&&M(),F.key==="Escape"&&v(null)}}),o.jsxs("div",{className:"workspace-switcher-area-list",children:[O.map(F=>o.jsxs("label",{className:"workspace-switcher-area-check",children:[o.jsx("input",{type:"checkbox",checked:k.includes(F.id),onChange:()=>U(F.id)}),o.jsx("span",{style:{color:F.color},children:F.name})]},F.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:()=>B(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=>C(L.target.value),className:"workspace-switcher-input",placeholder:"New workspace name",autoFocus:!0,onKeyDown:L=>{L.key==="Enter"&&T(),L.key==="Escape"&&_(!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:()=>_(!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 yp(){return typeof window<"u"?window.__tidePersistedScene??null:null}function vj(){return typeof window<"u"?window.__tidePersistedCanvas??null:null}function JR(){return typeof window<"u"?window.__tideWsConnected??!1:!1}function vu(t){typeof window<"u"&&(window.__tidePersistedScene=t)}function ru(t){typeof window<"u"&&(window.__tidePersistedCanvas=t)}function wj(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),gj(),MR(),window.__tideScene&&(window.__tideScene=null);const e=yp();e?(console.log("[App] Calling persistedScene.dispose()"),e.dispose(),vu(null)):console.log("[App] No persistedScene to dispose"),ru(null),wj(!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=yp();if(e){console.log("[App] Cleaning up stale persistedScene");try{e.dispose()}catch{}vu(null)}const n=document.getElementById("battlefield"),s=vj();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 Pk={showTrees:!0,showBushes:!0,showHouse:!0,showLamps:!0,showGrass:!0,showClouds:!0,fogDensity:1,floorStyle:"metal",brightness:1,skyColor:null,battlefieldSize:50},Ik={saturation:2,roughness:.5,metalness:-1,emissiveBoost:0,envMapIntensity:1,wireframe:!1,colorMode:"normal"},Bk={idleAnimation:"sit",workingAnimation:"sprint"},sO=0;function kj(){const t={characterScale:2,scale2d:.7,scale3d:.7,show2DTaskLabels:!0,gridVisible:!1,timeMode:"day",terrain:Pk,modelStyle:Ik,animations:Bk,fpsLimit:sO},e=ta(ft.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:{...Pk,...e.terrain},modelStyle:{...Ik,...e.modelStyle},animations:{...Bk,...e.animations},fpsLimit:e.fpsLimit??t.fpsLimit}}return t}function aO(t){ya(ft.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 Sj(){console.log("[Tide HMR] Manual scene refresh triggered");const t=yp();if(t){try{t.dispose()}catch(n){console.warn("[Tide HMR] Error disposing scene:",n)}vu(null)}ru(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=Sj);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 C=b.useRef(null),k=b.useRef(null),N=b.useRef(null),j=b.useRef(null),_=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 E=yp(),O=vj()===t.current;function T(){var R,B,$,U,L,F,W,V;(R=C.current)==null||R.setOnToast(a),(B=C.current)==null||B.setOnBuildingClick((Y,z)=>{H.selectBuilding(Y);const Q=H.getState().buildings.get(Y);(Q==null?void 0:Q.type)==="folder"&&Q.folderPath?H.openFileExplorer(Q.folderPath):(Q==null?void 0:Q.type)==="server"||(Q==null?void 0:Q.type)==="boss"||(Q==null?void 0:Q.type)==="database"?(k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f({buildingId:Y,screenPos:z,fromClick:!0}),k.current=null},150)):m(Y)}),($=C.current)==null||$.setOnContextMenu((Y,z,Q)=>{c.open(Y,z,Q)}),(U=C.current)==null||U.setOnAgentHover(()=>{}),(L=C.current)==null||L.setOnBuildingHover((Y,z)=>{const Q=h();if(Y&&z){const K=H.getState().buildings.get(Y);((K==null?void 0:K.type)==="server"||(K==null?void 0:K.type)==="boss"||(K==null?void 0:K.type)==="database")&&!(Q!=null&&Q.fromClick)&&f({buildingId:Y,screenPos:z,fromClick:!1})}else Q!=null&&Q.fromClick||f(null)}),(F=C.current)==null||F.setOnGroundClick(()=>{f(null)}),(W=C.current)==null||W.setOnAreaDoubleClick(Y=>{H.selectArea(Y),i.open()}),(V=C.current)==null||V.setOnBuildingDoubleClick(Y=>{var Q;k.current&&(clearTimeout(k.current),k.current=null),f(null);const z=H.getState().buildings.get(Y);(z==null?void 0:z.type)==="server"&&((Q=z.pm2)!=null&&Q.enabled)?x==null||x(Y):(z==null?void 0:z.type)==="boss"?y==null||y(Y):(z==null?void 0:z.type)==="database"?v==null||v(Y):(z==null?void 0:z.type)==="folder"&&z.folderPath?H.openFileExplorer(z.folderPath):m(Y)})}if(E)try{C.current=E,O?(console.log("[Tide] Reusing existing scene (StrictMode remount)"),E.ensureRenderLoopRunning()):(console.log("[Tide] Reattaching persisted scene to new canvas"),E.reattach(t.current,e.current),ru(t.current));const R=H.getState();E.syncAreas(),E.syncBuildings(),R.agents.size>0&&(console.log("[Tide] Re-syncing agents from store after remount:",R.agents.size),E.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(()=>{_.current=requestAnimationFrame(()=>{S==null||S(!1),_.current=null}),j.current=null})}else{const R=t.current,B=e.current,$=async()=>{if(D){console.log("[Tide] Effect cleaned up before scene init, skipping"),S==null||S(!1);return}if(!R.isConnected||!B.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-WQvF4y8-.js");return{SceneManager:W}},__vite__mapDeps([6,4,3,1]));if(D){S==null||S(!1);return}const L=new U(R,B);C.current=L,vu(L),ru(R);const F=kj();L.setCharacterScale(F.characterScale),L.setScale3D(F.scale3d),L.setTimeMode(F.timeMode),L.setTerrainConfig(F.terrain),L.setFloorStyle(F.terrain.floorStyle,!0),L.setGridVisible(F.gridVisible),L.setAgentModelStyle(F.modelStyle),L.setIdleAnimation(F.animations.idleAnimation),L.setWorkingAnimation(F.animations.workingAnimation),L.setFpsLimit(F.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 $())}dj({onAgentCreated:R=>{var B,$,U;(B=C.current)==null||B.addAgent(R),($=C.current)==null||$.refreshSelectionVisuals(),(U=window.__spawnModalSuccess)==null||U.call(window)},onAgentUpdated:(R,B)=>{var U;const $=H.getState().agents.get(R.id)||R;(U=C.current)==null||U.updateAgent($,B)},onAgentDeleted:R=>{var B;(B=C.current)==null||B.removeAgent(R)},onAgentsSync:R=>{var $;const B=Array.from(H.getState().agents.values());($=C.current)==null||$.syncAgents(B)},onAreasSync:()=>{var B,$;(B=C.current)==null||B.syncAreas();const R=Array.from(H.getState().agents.values());($=C.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 B;(B=window.__spawnModalDirNotFound)==null||B.call(window,R)},onToolUse:(R,B,$)=>{var U;(U=C.current)==null||U.showToolBubble(R,B,$)},onDelegation:(R,B)=>{var $;($=C.current)==null||$.showDelegationEffect(R,B)},onCustomClassesSync:R=>{var B,$;(B=C.current)==null||B.setCustomAgentClasses(R),($=C.current)==null||$.upgradeAgentModels()},onBuildingUpdated:R=>{var B;(B=C.current)==null||B.updateBuilding(R)},onSubagentStarted:R=>{var B;(B=C.current)==null||B.addSubagentEffect(R.id,R.parentAgentId,R.name,R.subagentType)},onSubagentCompleted:R=>{var U;const B=H.getSubagent(R)||H.getSubagentByToolUseId(R),$=(B==null?void 0:B.id)||R;(U=C.current)==null||U.completeSubagentEffect($),setTimeout(()=>{var L;(L=C.current)==null||L.removeSubagentEffect($)},3e4)}});const M=QR(()=>{if(C.current){C.current.syncAreas(),C.current.syncBuildings();const R=Array.from(H.getState().agents.values());C.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),_.current!==null&&(cancelAnimationFrame(_.current),_.current=null),H.getState().viewMode!=="3d"&&rO()&&C.current&&(console.log("[Tide] 3D canvas unmounted - disposing scene to free memory"),DR(),C.current.dispose(),C.current=null,vu(null),ru(null))}},[n,s]),C}function oO({showToast:t,showAgentNotification:e}){b.useEffect(()=>{dj({onToast:t,onReconnect:()=>{H.triggerReconnect()},onAgentNotification:a=>{e(a)}}),JR()||(xu(),wj(!0)),SR();let n;AR(a=>{a.type==="agent_notification"&&typeof a.agentId=="string"&&oj(a.agentId)}).then(a=>{n=a});const s=()=>{console.log("[Tide] App resumed from background, reconnecting..."),setTimeout(()=>xu(),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 It(t,e,n,s,a={},r="global"){return{id:t,name:e,description:n,key:s,modifiers:a,enabled:!0,context:r}}const ng=[It("toggle-commander","Toggle Commander","Open/close Commander View","k",{ctrl:!0}),It("toggle-commander-tab","Toggle Commander (Tab)","Open/close Commander View with Tab","Tab",{}),It("spawn-agent","Spawn Agent","Open new agent spawn modal","n",{alt:!0}),It("select-agent-1","Select Agent 1","Select first agent","1",{ctrl:!0}),It("select-agent-2","Select Agent 2","Select second agent","2",{ctrl:!0}),It("select-agent-3","Select Agent 3","Select third agent","3",{ctrl:!0}),It("select-agent-4","Select Agent 4","Select fourth agent","4",{ctrl:!0}),It("select-agent-5","Select Agent 5","Select fifth agent","5",{ctrl:!0}),It("select-agent-6","Select Agent 6","Select sixth agent","6",{ctrl:!0}),It("select-agent-7","Select Agent 7","Select seventh agent","7",{ctrl:!0}),It("select-agent-8","Select Agent 8","Select eighth agent","8",{ctrl:!0}),It("select-agent-9","Select Agent 9","Select ninth agent","9",{ctrl:!0}),It("delete-selected","Delete Selected","Remove selected agents","Delete",{}),It("delete-selected-backspace","Delete Selected (Backspace)","Remove selected agents","Backspace",{}),It("deselect-all","Deselect All","Clear agent selection","Escape",{}),It("open-terminal","Open Terminal","Open terminal for selected agent","Space",{}),It("dashboard-selector-toggle","Dashboard Selector","Enable dashboard card selector",",",{}),It("dashboard-vim-left","Dashboard Left","Move dashboard selector left","h",{}),It("dashboard-vim-down","Dashboard Down","Move dashboard selector down","j",{}),It("dashboard-vim-up","Dashboard Up","Move dashboard selector up","k",{}),It("dashboard-vim-right","Dashboard Right","Move dashboard selector right","l",{}),It("next-agent","Next Agent","Select next agent on battlefield","l",{alt:!0}),It("prev-agent","Previous Agent","Select previous agent on battlefield","h",{alt:!0}),It("next-working-agent","Next Working Agent","Select next working agent on battlefield","l",{alt:!0,shift:!0}),It("prev-working-agent","Previous Working Agent","Select previous working agent on battlefield","h",{alt:!0,shift:!0}),It("next-message","Next Message","Navigate to next message in terminal","j",{alt:!0}),It("prev-message","Previous Message","Navigate to previous message in terminal","k",{alt:!0}),It("page-down-messages","Page Down Messages","Jump down 10 messages in terminal","d",{alt:!0,shift:!0}),It("page-up-messages","Page Up Messages","Jump up 10 messages in terminal","u",{alt:!0}),It("next-agent-terminal","Next Agent (Terminal)","Switch to next agent in terminal","l",{alt:!0}),It("prev-agent-terminal","Previous Agent (Terminal)","Switch to previous agent in terminal","h",{alt:!0}),It("activate-message","Activate Message","Click on interactive element in selected message","Space",{}),It("toggle-file-explorer","Toggle File Explorer","Open/close file explorer","e",{alt:!0}),It("file-explorer-close-tab","Close File Tab","Close active file tab in explorer","w",{alt:!0}),It("toggle-spotlight","Toggle Spotlight","Open/close global search","p",{alt:!0}),It("open-database","Open Database","Open last used database query builder","d",{alt:!0}),It("toggle-2d-view","Cycle View Mode","Cycle between 3D, 2D, and Dashboard views","2",{alt:!0}),It("clear-context","Clear Context","Clear context of the selected agent","c",{alt:!0,shift:!0}),It("commander-close","Close Commander","Close Commander View","Escape",{},"commander"),It("commander-vim-left","Navigate Left","Move focus left (Vim H)","h",{alt:!0},"commander"),It("commander-vim-down","Navigate Down","Move focus down (Vim J)","j",{alt:!0},"commander"),It("commander-vim-up","Navigate Up","Move focus up (Vim K)","k",{alt:!0},"commander"),It("commander-vim-right","Navigate Right","Move focus right (Vim L)","l",{alt:!0},"commander"),It("commander-expand","Expand/Collapse","Toggle agent expansion","o",{alt:!0},"commander"),It("commander-new-agent","New Agent","Open spawn form in commander","n",{alt:!0},"commander"),It("commander-next-tab","Next Tab","Switch to next area tab","Tab",{},"commander"),It("commander-prev-tab","Previous Tab","Switch to previous area tab","Tab",{shift:!0},"commander"),It("toolbox-close","Close Toolbox","Close Settings panel","Escape",{},"toolbox")];function An(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 Hq(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 Uq(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,B,$,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(An(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(),(B=t.current)==null||B.refreshSelectionVisuals())}for(let L=1;L<=9;L++){const F=x.find(W=>W.id===`select-agent-${L}`);if(An(m,F)){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 C=x.find(L=>L.id==="spawn-agent");if(An(m,C)){m.preventDefault(),e.open();return}const k=x.find(L=>L.id==="toggle-commander-tab");if(An(m,k)&&!v){m.preventDefault(),n.toggle();return}const N=x.find(L=>L.id==="toggle-commander");if(An(m,N)){m.preventDefault(),n.toggle();return}const j=x.find(L=>L.id==="toggle-file-explorer");if(An(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"),F=H.getState();if(L){const W=F.buildings.get(L);if((W==null?void 0:W.type)==="database"){c(L);return}}for(const[W,V]of F.buildings)if(V.type==="database"){c(W);return}return}const _=x.find(L=>L.id==="toggle-spotlight");if(An(m,_)||m.altKey&&!m.ctrlKey&&!m.metaKey&&m.code==="KeyP"){console.log("[useKeyboardShortcuts] Spotlight shortcut matched!",{spotlightShortcut:_,altKey:m.altKey,code:m.code}),m.preventDefault(),a.toggle();return}const D=x.find(L=>L.id==="toggle-2d-view");if(An(m,D)){m.preventDefault();const L=H.getState().viewMode,F=L==="3d"?"2d":L==="2d"?"dashboard":"3d";H.setViewMode(F);return}const E=x.find(L=>L.id==="clear-context");if(An(m,E)){m.preventDefault();const L=H.getState(),F=L.selectedAgentIds.size===1?Array.from(L.selectedAgentIds)[0]:null;F&&H.clearContext(F);return}const I=x.find(L=>L.id==="next-working-agent"),O=x.find(L=>L.id==="prev-working-agent");if((An(m,I)||An(m,O))&&!v){const L=H.getState();if(L.terminalOpen)return;const F=Array.from(L.agents.values());let W=F.filter(Q=>L.agentsWithUnseenOutput.has(Q.id));if(W.length===0&&(W=F.filter(Q=>Q.status==="working")),W.length===0)return;m.preventDefault();const V=L.selectedAgentIds.size===1?Array.from(L.selectedAgentIds)[0]:null,Y=V?W.findIndex(Q=>Q.id===V):-1;let z;An(m,I)?z=Y===-1?0:(Y+1)%W.length:z=Y===-1?W.length-1:(Y-1+W.length)%W.length,H.selectAgent(W[z].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((An(m,T)||An(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 sg="agent-order-change";function mO(t){const e=b.useMemo(()=>new Set(t.map(d=>d.id)),[t]),[n,s]=b.useState(()=>ta(ft.AGENT_ORDER,[]));b.useEffect(()=>{const d=f=>{s(f.detail)};return window.addEventListener(sg,d),()=>{window.removeEventListener(sg,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),ya(ft.AGENT_ORDER,d),window.dispatchEvent(new CustomEvent(sg,{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([]),ya(ft.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 wa(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 Bt(Dt(`/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 Bt(Dt(`/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 C=!1;for(const{dirIndex:k,count:N}of y)S[k]!==N&&(S[k]=N,C=!0);C&&H.updateAreaLocal(x,{directoryGitCounts:S})}}catch{}};return e(),t.current=setInterval(e,gO),()=>{t.current&&(clearInterval(t.current),t.current=null)}},[])}const ag={historyLimit:500,hideCost:!0,showFPS:!1,powerSaving:!1,customAgentNames:[],experimental2DView:!1,experimentalVoiceAssistant:!1,experimentalTTS:!1,experimentalEchoPrompt:!1,externalEditorCommand:"",vibrationIntensity:1,tabTitle:"",tmuxMode:!1},Fk=90,rg=["simple","chat","advanced"],zk=55,$k=20,Hk=95,xO=200,yO=12e4,vO=5,ea=new Map;function wO(t){const e=ea.get(t);e&&(ea.delete(t),ea.set(t,e))}function kO(){for(;ea.size>vO;){const t=ea.keys().next().value;if(t!==void 0)ea.delete(t);else break}}function SO(t){ea.delete(t)}function CO(t){return t.trim().replace(/\r\n/g,`
43
+ `)}function kb(t,e){return`${t}:${CO(e)}`}function Uk(t,e,n,s){if(t.uuid&&e.has(t.uuid))return!1;const a=t.isUserPrompt?"user":"assistant",r=kb(a,t.text),i=t.timestamp||0,c=n.get(r);return c!==void 0&&Math.abs(i-c)<=yO?!1:i>s}function Cj({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),[C,k]=b.useState(!1),[N,j]=b.useState(0),_=b.useRef(!0),D=b.useRef(0),E=b.useRef(0),I=b.useRef(!1),O=b.useRef(!1),T=b.useRef(null),M=b.useRef(!1),R=b.useRef(null),B=b.useRef(null);b.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]),b.useEffect(()=>{if(!t||!e){c([]),E.current=0,k(!1),O.current=!1,j(0),f(!1),m(!1),y(de=>de+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,z=n>0,Q=Y||z,K=!Y&&!M.current&&e;T.current=t,M.current=e,R.current=V;let q;if(z){const de=H.getOutputs(t);de.length>0&&(q=de.map(ee=>({...ee})))}B.current&&(clearTimeout(B.current),B.current=null),z&&ea.delete(t),D.current+=1;const xe=D.current;if(m(!0),!z){const de=ea.get(t);de?(wO(t),c(de.messages),E.current=de.messages.length,k(de.hasMore),O.current=de.hasMore,j(de.totalCount)):(c([]),E.current=0,k(!1),O.current=!1,j(0))}!K&&!z&&(B.current=setTimeout(()=>{f(!0)},150)),Bt(Dt(`/api/agents/${t}/history?limit=${Fk}&offset=0`)).then(de=>{if(!de.ok)throw new Error(`HTTP ${de.status}: ${de.statusText}`);return de.json()}).then(de=>{if(xe!==D.current)return;const ee=Array.isArray(de.messages)?de.messages:[],fe=Array.isArray(de.subagents)?de.subagents:[];c(ee),E.current=ee.length;const je=de.hasMore||!1;if(k(je),O.current=je,j(de.totalCount||0),fe.length>0&&H.hydrateSubagentsFromHistory(t,fe),ea.set(t,{messages:ee,hasMore:je,totalCount:de.totalCount||0}),kO(),q&&q.length>0){const ge=ee.length>0?Math.max(...ee.map(J=>J.timestamp?new Date(J.timestamp).getTime():0)):0,Ee=new Set(ee.map(J=>J.uuid).filter(J=>typeof J=="string"&&J.length>0)),Be=new Map;for(const J of ee){if(J.type!=="user"&&J.type!=="assistant")continue;const ne=kb(J.type,J.content),Te=J.timestamp?new Date(J.timestamp).getTime():0,qe=Be.get(ne)??0;Te>qe&&Be.set(ne,Te)}const Ve=q.filter(J=>Uk(J,Ee,Be,ge));H.clearOutputs(t);for(const J of Ve)H.addOutput(t,J)}else if(ee.length>0){const ge=Math.max(...ee.map(ne=>ne.timestamp?new Date(ne.timestamp).getTime():0)),Ee=new Set(ee.map(ne=>ne.uuid).filter(ne=>typeof ne=="string"&&ne.length>0)),Be=new Map;for(const ne of ee){if(ne.type!=="user"&&ne.type!=="assistant")continue;const Te=kb(ne.type,ne.content),qe=ne.timestamp?new Date(ne.timestamp).getTime():0,at=Be.get(Te)??0;qe>at&&Be.set(Te,qe)}const Ve=H.getOutputs(t),J=Ve.filter(ne=>{const Te=Uk(ne,Ee,Be,ge);return Te||console.warn(`[HISTORY-DEDUP] Removing live output: uuid=${ne.uuid||"none"} ts=${ne.timestamp} lastHistTs=${ge} text="${ne.text.slice(0,80)}"`),Te});if(Ve.length!==J.length){console.warn(`[HISTORY-DEDUP] Cleared ${Ve.length-J.length}/${Ve.length} overlapping outputs for agent ${t}`),H.clearOutputs(t);for(const ne of J)H.addOutput(t,ne)}}if(!a.get(t)){for(let ge=ee.length-1;ge>=0;ge--)if(ee[ge].type==="user"){H.setLastPrompt(t,ee[ge].content);break}}}).catch(de=>{if(console.error("Failed to load history:",de),c([]),E.current=0,k(!1),O.current=!1,j(0),Q&&q&&q.length>0){H.clearOutputs(t);for(const ee of q)H.addOutput(t,ee)}}).finally(()=>{_.current&&xe===D.current&&(B.current&&(clearTimeout(B.current),B.current=null),f(!1),m(!1),y(de=>de+1))})},[t,e,n,s]);const $=b.useCallback(async()=>{if(!t||I.current||!O.current)return;const V=r.current;if(!V){console.warn("loadMoreHistory: outputScrollRef not connected");return}const Y=V.scrollHeight-V.scrollTop;I.current=!0,S(!0);const z=E.current;try{const K=await(await Bt(Dt(`/api/agents/${t}/history?limit=${Fk}&offset=${z}`))).json(),q=Array.isArray(K.subagents)?K.subagents:[];if(q.length>0&&H.hydrateSubagentsFromHistory(t,q),K.messages&&K.messages.length>0){if(!_.current)return;c(de=>{const ee=[...K.messages,...de];return E.current=ee.length,ee});const xe=K.hasMore||!1;O.current=xe,k(xe),requestAnimationFrame(()=>{requestAnimationFrame(()=>{_.current&&(r.current&&(r.current.scrollTop=r.current.scrollHeight-Y),I.current=!1,S(!1))})})}else{if(!_.current)return;I.current=!1,S(!1)}}catch(Q){if(console.error("Failed to load more history:",Q),!_.current)return;I.current=!1,S(!1)}},[t,r]),U=b.useCallback(V=>{if(!r.current||V.current)return;const{scrollTop:Y}=r.current;!I.current&&O.current&&Y<xO&&$()},[$,r]),L=b.useCallback(()=>{c([]),E.current=0,t&&ea.delete(t)},[t]),F=b.useRef(!1),W=b.useCallback(async()=>{var V,Y;if(!(!t||!O.current)&&!(I.current||F.current)){F.current=!0,I.current=!0,S(!0);try{const Q=await(await Bt(Dt(`/api/agents/${t}/history?limit=100000&offset=0`))).json();if(!_.current)return;const K=Array.isArray(Q.subagents)?Q.subagents:[];K.length>0&&H.hydrateSubagentsFromHistory(t,K),Q.messages&&Q.messages.length>0&&(c(Q.messages),E.current=Q.messages.length),O.current=!1,k(!1),j(Q.totalCount||((V=Q.messages)==null?void 0:V.length)||0),ea.set(t,{messages:Q.messages||[],hasMore:!1,totalCount:Q.totalCount||((Y=Q.messages)==null?void 0:Y.length)||0})}catch(z){console.error("Failed to load all history:",z)}finally{_.current&&(I.current=!1,F.current=!1,S(!1))}}},[t]);return{history:i,loadingHistory:d,fetchingHistory:h,historyLoadVersion:x,loadingMore:v,hasMore:C,totalCount:N,isMountedRef:_,loadMoreHistory:$,loadAllHistory:W,allLoaded:!C,handleScroll:U,clearHistory:L,hasCachedHistory:b.useCallback(V=>ea.has(V),[])}}function Oc(...t){}function AO(t){return(t.tokensUsed??0)===0&&(t.contextUsed??0)===0&&!t.contextStats&&!t.sessionId&&!t.currentTask&&!t.lastAssignedTask}function Wk(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,Wk(h,f)),(f.class==="boss"||f.isBoss)&&Oc("[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 v;const c=t().agents.get(r.id);let d=r;const f=r.trackingStatus,h=f!=null&&f!=="working";(c==null?void 0:c.status)!=="working"&&r.status==="working"&&!h&&(d={...r,trackingStatus:"working",trackingStatusDetail:void 0,trackingStatusTimestamp:r.trackingStatusTimestamp??Date.now()});const x=(c==null?void 0:c.status)!==d.status;x&&Oc(`[Store] Agent ${d.name} status update: ${c==null?void 0:c.status} → ${d.status}`);let y=!1;e(S=>{const C=new Map(S.agents);C.set(d.id,Wk(c,d)),S.agents=C,x&&(c==null?void 0:c.status)==="working"&&d.status==="idle"&&(S.terminalOpen&&S.selectedAgentIds.has(d.id)||(S.agentsWithUnseenOutput=new Set(S.agentsWithUnseenOutput),S.agentsWithUnseenOutput.add(d.id),Oc(`[Store] Agent ${d.name} completed work - marked as unseen`),y=!0))}),y&&a&&a(),n(),x&&Oc(`[Store] Agent ${d.name} status now in store: ${(v=t().agents.get(d.id))==null?void 0:v.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,C,k,N,j){Oc("[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:C,effort:N,opencodeModel:j,customInstructions:k?`${k.length} chars`:void 0});const _=d?{x:d.x,y:0,z:d.z}:void 0,D={type:"spawn_agent",payload:{name:r,class:i,cwd:c,position:_,sessionId:f,useChrome:h,permissionMode:m,initialSkillIds:x,provider:y,codexConfig:v,codexModel:S,opencodeModel:j,model:C,effort:N,customInstructions:k}},E=s();if(!E){console.error("[Store] sendMessage is not defined! WebSocket may not be connected");return}E(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,trackingStatus:void 0,trackingStatusDetail:void 0,trackingStatusTimestamp: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 Bt(Dt("/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 qk=200;function Vk(t){return t.length<=qk?t:t.slice(-qk)}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=Vk([...d,r]);bu.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=Vk(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()),C=(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=C,x!==0||y!==0)for(const j of N.assignedAgentIds){const _=k.agents.get(j);_&&(_.position={x:_.position.x+x,y:_.position.y,z:_.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 Aj="tide:bottom-pm2-log-retention",ig=5e3,EO=[1e3,2500,5e3,1e4,null];function jj(){if(typeof window>"u")return ig;try{const t=window.localStorage.getItem(Aj);if(!t)return ig;if(t==="unlimited")return null;const e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}catch{}return ig}function MO(t){if(!(typeof window>"u"))try{window.localStorage.setItem(Aj,t===null?"unlimited":String(t))}catch{}}function Nj(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=jj(),m=Nj(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,C){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:C}})},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 Gk(){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,Gk()),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},C=new Map(x.databaseState);C.set(i,S),x.databaseState=C}}),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)||Gk()},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 Bt(Dt("/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 Bt(Dt("/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 Bt(Dt(`/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 Bt(Dt(`/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 Bt(Dt(`/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,og=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 Yk(t,e,n){const s=og.get(t);s&&clearTimeout(s),og.set(t,setTimeout(()=>{og.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}`),Yk(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")&&Yk(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 lg={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 Qi(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 cg=[Qi("left-click-select","Select/Click","Select agents, click on buildings/areas","left",{},"primary-action"),Qi("left-drag-selection","Selection Box","Drag to select multiple agents","left",{},"selection-box"),Qi("right-click-context","Context Menu / Move","Show context menu or move selected agents","right",{},"context-menu"),Qi("alt-right-drag-pan","Camera Pan","Pan camera with Alt+Right-drag","right",{alt:!0},"camera-pan",1),Qi("middle-drag-orbit","Camera Orbit","Orbit camera with middle-drag","middle",{},"camera-orbit",1),Qi("shift-middle-drag-pan","Camera Pan (Alt)","Alternative pan with Shift+Middle-drag","middle",{shift:!0},"camera-pan",1),Qi("wheel-zoom","Zoom","Zoom camera with scroll wheel","middle",{},"camera-zoom",1)],Wq={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 qq(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 Vq(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 Gq(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 ss(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 La(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 ox(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 Ns(){const[,t]=b.useState({});return b.useEffect(()=>H.subscribe(()=>t({})),[]),H.getState()}function Dl(){return wt(b.useCallback(t=>t.agents,[]),La)}function Tj(){return wt(b.useCallback(t=>t.agents.size,[]))}function vp(){const t=Dl(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}function lx(t){return wt(b.useCallback(e=>t?e.agents.get(t):void 0,[t]))}function cx(){return wt(b.useCallback(t=>t.selectedAgentIds,[]),ox)}function qO(){return wt(b.useCallback(t=>t.lastSelectedAgentId,[]))}function VO(t){const e={working:[],"waiting-subordinates":[],"need-review":[],blocked:[],"can-clear-context":[]};return t.agents.forEach(n=>{n.trackingStatus&&n.trackingStatus in e&&e[n.trackingStatus].push(n)}),e}function GO(t,e){return ss(t.working,e.working)&&ss(t["waiting-subordinates"],e["waiting-subordinates"])&&ss(t["need-review"],e["need-review"])&&ss(t.blocked,e.blocked)&&ss(t["can-clear-context"],e["can-clear-context"])}function YO(){return wt(b.useCallback(t=>VO(t),[]),GO)}function _j(t){const e=b.useRef([]),n=b.useRef(0),s=wt(b.useCallback(a=>t&&a.agentOutputs.get(t)||e.current,[t]),ss);return s.length!==n.current&&(bu.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 KO(t){return wt(b.useCallback(e=>t?e.compactingAgents.has(t):!1,[t]))}function Ej(t){return wt(b.useCallback(e=>t?e.lastPrompts.get(t):void 0,[t]))}function ux(){return wt(b.useCallback(t=>t.lastPrompts,[]),La)}function Mj(){return wt(b.useCallback(t=>t.isConnected,[]))}function rr(){return wt(b.useCallback(t=>t.areas,[]),La)}function QO(){return wt(b.useCallback(t=>t.activeTool,[]))}function XO(){return wt(b.useCallback(t=>t.selectedAreaId,[]))}function dx(){return wt(b.useCallback(t=>t.buildings,[]),La)}function JO(){return wt(b.useCallback(t=>t.selectedBuildingIds,[]),ox)}function ZO(){return wt(b.useCallback(t=>t.supervisor,[]))}function Yq(){return wt(b.useCallback(t=>t.supervisor.lastReport,[]))}function eL(){return wt(b.useCallback(t=>t.supervisor.generatingReport,[]))}function tL(){return wt(b.useCallback(t=>t.permissionRequests,[]),La)}function Br(){return wt(b.useCallback(t=>t.settings,[]))}function Dj(){return wt(b.useCallback(t=>t.settings.hideCost,[]))}function Kq(){return wt(b.useCallback(t=>t.settings.customAgentNames,[]),ss)}function Qq(){return wt(b.useCallback(t=>t.shortcuts,[]),ss)}function Xq(){return wt(b.useCallback(t=>t.mouseControls,[]))}function Jq(){return wt(b.useCallback(t=>t.mouseControls.trackpad,[]))}function Rj(){return wt(b.useCallback(t=>t.terminalOpen,[]))}function Oj(){return wt(b.useCallback(t=>t.mobileView,[]))}function fx(){return wt(b.useCallback(t=>t.fileViewerPath,[]))}function nL(){return wt(b.useCallback(t=>t.fileViewerEditData,[]))}function sL(){return wt(b.useCallback(t=>t.fileViewerSearchRoot,[]))}function aL(){return wt(b.useCallback(t=>t.explorerFolderPath,[]))}function px(){return wt(b.useCallback(t=>t.contextModalAgentId,[]))}function Zq(){return wt(b.useCallback(t=>t.commanderExpandRequest,[]))}function hx(){return wt(b.useCallback(t=>t.toolExecutions,[]),ss)}function Lj(){return wt(b.useCallback(t=>t.fileChanges,[]),ss)}function Pj(){return wt(b.useCallback(t=>t.skills,[]),La)}function rL(){const t=Pj(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}function eV(t){return wt(b.useCallback(e=>t?e.skills.get(t):void 0,[t]))}function iL(t){const e=b.useRef([]),n=Dl(),s=Pj();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 oL(){return wt(b.useCallback(t=>t.customAgentClasses,[]),La)}function Pa(){const t=oL(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}function Ij(t){return wt(b.useCallback(e=>t?e.customAgentClasses.get(t):void 0,[t]))}function Bj(){return wt(b.useCallback(t=>t.reconnectCount,[]))}function Fj(){return wt(b.useCallback(t=>t.historyRefreshTrigger,[]))}function tV(){return wt(b.useCallback(t=>t.supervisor.globalUsage,[]))}function nV(){return wt(b.useCallback(t=>t.supervisor.refreshingUsage,[]))}function lL(t){const e=b.useRef(new Map);return wt(b.useCallback(n=>t&&n.agentTaskProgress.get(t)||e.current,[t]),La)}function cL(t){return wt(b.useCallback(e=>!t||!e.execTasks?[]:Array.from(e.execTasks.values()).filter(n=>n.agentId===t),[t]),ss)}function uL(){return wt(b.useCallback(t=>t.secrets,[]),La)}function sV(){const t=uL(),e=b.useRef([]),n=Array.from(t.values());return ss(e.current,n)||(e.current=n),e.current}const dL={connectionStatus:new Map,databases:new Map,tables:new Map,tableSchemas:new Map,queryResults:[],queryHistory:[],executingQuery:!1,activeConnectionId:null,activeDatabase:null,lastSilentQueryResult:null};function mx(t){return wt(b.useCallback(e=>(t?e.databaseState.get(t):void 0)??dL,[t]))}function fL(t){return wt(b.useCallback(e=>{if(!t)return[];const n=e.databaseState.get(t);return(n==null?void 0:n.queryResults)??[]},[t]),ss)}function aV(t){return wt(b.useCallback(e=>{if(!t)return[];const n=e.databaseState.get(t);return(n==null?void 0:n.queryHistory)??[]},[t]),ss)}function pL(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 rV(){return wt(t=>t.dockerContainersList,ss)}function hL(){return wt(t=>t.currentSnapshot)}function mL(){return wt(t=>t.snapshotsLoading)}function gL(){return wt(t=>t.snapshotsError)}function bL(){return wt(t=>t.subagents,La)}function xL(t){return wt(b.useCallback(e=>t?Array.from(e.subagents.values()).filter(n=>n.parentAgentId===t):[],[t]),ss)}function yL(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]),La)}function zj(){return wt(t=>t.viewMode)}function vL(){return wt(b.useCallback(t=>t.overviewPanelOpen,[]))}function wL(){return wt(b.useCallback(t=>t.trackingBoardVisible,[]))}function kL(){return wt(b.useCallback(t=>t.splitPaneAgentIds,[]))}function SL(){return wt(b.useCallback(t=>t.splitOrientation,[]))}function $j(){return wt(b.useCallback(t=>t.agentsWithUnseenOutput,[]),ox)}class Kk{constructor(){Ze(this,"state");Ze(this,"listeners",new Set);Ze(this,"sendMessage",null);Ze(this,"agentActions");Ze(this,"outputActions");Ze(this,"supervisorActions");Ze(this,"areaActions");Ze(this,"buildingActions");Ze(this,"permissionActions");Ze(this,"delegationActions");Ze(this,"skillActions");Ze(this,"execTaskActions");Ze(this,"secretActions");Ze(this,"databaseActions");Ze(this,"snapshotActions");Ze(this,"subagentActions");Ze(this,"workflowActions");Ze(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=va(ft.SCENE_VIEW_MODE,"3d");return i==="2d"||i==="3d"||i==="dashboard"?i:"3d"})(),overviewPanelOpen:_r(ft.AOP_OPEN,!1),trackingBoardVisible:_r(ft.AOP_TRACKING_BOARD_VISIBLE,!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=ta(ft.SETTINGS,null);if(e){const n={...ag,...e},s=Number(n.vibrationIntensity);return n.vibrationIntensity=Number.isFinite(s)?Math.max(0,Math.min(gu,Math.round(s))):ag.vibrationIntensity,n}return{...ag}}loadShortcuts(){const e=ta(ft.SHORTCUTS,null);return e?ng.map(s=>{const a=e.find(r=>r.id===s.id);return a?{...s,...a}:s}):[...ng]}loadMouseControls(){var n;const e=ta(ft.MOUSE_CONTROLS,null);return e?{bindings:cg.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:{...lg,...e.sensitivity},trackpad:{...Zd,...e.trackpad,sensitivity:{...Zd.sensitivity,...(n=e.trackpad)==null?void 0:n.sensitivity}}}:{bindings:[...cg],sensitivity:{...lg},trackpad:{...Zd}}}loadMobileView(){const e=va(ft.MOBILE_VIEW,"");return e==="terminal"||e==="3d"?e:typeof window<"u"&&window.innerWidth<=768&&"ontouchstart"in window?"3d":"terminal"}loadUnseenAgents(){const e=ta(ft.UNSEEN_AGENTS,[]);return new Set(e)}saveUnseenAgents(){const e=Array.from(this.state.agentsWithUnseenOutput);ya(ft.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,Qa(ft.AOP_OPEN,e),this.notify()}toggleTrackingBoard(){this.state.trackingBoardVisible=!this.state.trackingBoardVisible,Qa(ft.AOP_TRACKING_BOARD_VISIBLE,this.state.trackingBoardVisible),this.notify()}setTrackingBoardVisible(e){this.state.trackingBoardVisible=e,Qa(ft.AOP_TRACKING_BOARD_VISIBLE,e),this.notify()}loadSplitPaneAgentIds(){const e=ta(ft.SPLIT_PANE_AGENT_IDS,[]);return Array.isArray(e)?e:[]}saveSplitPaneAgentIds(){ya(ft.SPLIT_PANE_AGENT_IDS,this.state.splitPaneAgentIds)}loadSplitOrientation(){return va(ft.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",er(ft.SPLIT_PANE_ORIENTATION,this.state.splitOrientation),this.notify()}setMobileView(e){if(this.state.mobileView=e,er(ft.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,er(ft.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(gu,Math.round(s))):this.state.settings.vibrationIntensity}this.state.settings={...this.state.settings,...n},ya(ft.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=[...ng],this.saveShortcuts(),this.notify()}saveShortcuts(){ya(ft.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:[...cg],sensitivity:{...lg},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(){ya(ft.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 Qk=1;function CL(){return typeof window<"u"?(window.__tideStore&&window.__tideStoreVersion===Qk||(window.__tideStore=new Kk,window.__tideStoreVersion=Qk),window.__tideStore):new Kk}const H=CL(),Hj=b.createContext(null),AL={error:"❌",success:"✅",warning:"⚠️",info:"ℹ️"};let jL=0;function NL({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:++jL,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(Hj.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:AL[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 Uj(){const t=b.useContext(Hj);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const po={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"}},wp=po,iu={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:"🚀"}},ug={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:"🧠"}},Sb="<<<BOSS_CONTEXT_START>>>",Xk="<<<BOSS_CONTEXT_END>>>",TL={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"}},iV={"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"}},oV={"":{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)"}},lV={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"}},cV={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"}},_L={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}},Wj=b.createContext(null);function qj(t){const e=po[t];if(e)return e.icon;const s=H.getState().customAgentClasses.get(t);return s?s.icon:"🤖"}function EL(t){const e=po[t];if(e)return e.color;const s=H.getState().customAgentClasses.get(t);return s?s.color:"#888888"}const ML=3,Jk=80;function DL({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=qj(t.agentClass),m=EL(t.agentClass),x=b.useCallback(_=>{s.current={startX:_.touches[0].clientX,startY:_.touches[0].clientY,locked:!1},d.current=!1},[]),y=b.useCallback(_=>{const D=_.touches[0].clientX-s.current.startX,E=_.touches[0].clientY-s.current.startY;!s.current.locked&&(Math.abs(D)<10&&Math.abs(E)<10||(s.current.locked=!0,Math.abs(E)>Math.abs(D)))||D<0&&(d.current=!0,r(D))},[]),v=b.useCallback(()=>{a<-Jk?(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]),C=Math.min(Math.abs(a)/(Jk*1.5),1),k=i?0:1-C*.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:_=>{_.stopPropagation(),e(t.id)},children:"×"})]})}function RL({children:t}){const{t:e}=pt(["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>ML){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),!Tu()){const h=qj(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=>{oj(d.agentId),r(d.id)},[r]);return o.jsxs(Wj.Provider,{value:{showAgentNotification:i},children:[t,o.jsx("div",{id:"agent-notification-container",children:n.map(d=>o.jsx(DL,{notification:d,onDismiss:r,onClick:c},d.id))})]})}function OL(){const t=b.useContext(Wj);if(!t)throw new Error("useAgentNotification must be used within AgentNotificationProvider");return t}const LL={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"}},PL=["Alex","Sam","Jordan","Taylor","Casey","Morgan","Riley","Quinn","Avery","Blake","Cameron","Drew","Emery","Finley","Harper","Jamie","Kai","Logan","Max","Nico","Parker","Reese","Sage","Sky"],uV=PL,IL={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"},dV=[{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"}],fV=[{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"}],pV=3,hV=5,mV=1e3,gV=50,bV=1.2;function BL(t){return typeof t=="string"?t:"#"+t.toString(16).padStart(6,"0")}function Ia(t,e){const n=LL[t];if(n)return{icon:n.icon,color:BL(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 FL=2e5,zL=258400;function Lc(t){return Math.max(0,Math.min(100,t))}function Zk(t){const e=t.provider==="codex"||t.provider==="opencode"?zL:FL,n=Math.max(1,Math.round(t.contextLimit||e)),s=Math.max(0,Math.min(Math.round(t.contextUsed||0),n)),a=Lc(Number((s/n*100).toFixed(1))),r=t.contextStats;if(!r)return{totalTokens:s,contextWindow:n,usedPercent:a,freePercent:Lc(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=Lc(Number((r.usedPercent??c/i*100).toFixed(1)));return n!==i||s!==c?{totalTokens:s,contextWindow:n,usedPercent:a,freePercent:Lc(Number((100-a).toFixed(1)))}:{totalTokens:c,contextWindow:i,usedPercent:d,freePercent:Lc(Number((100-d).toFixed(1)))}}function $L(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 kp(t){if(t.contextStats){const n=Zk(t);return{remainingPercent:n.freePercent,usedPercent:n.usedPercent,hasData:!0,totalTokens:n.totalTokens,contextWindow:n.contextWindow,freeTokens:n.contextWindow-n.totalTokens}}const e=Zk(t);return{remainingPercent:e.freePercent,usedPercent:e.usedPercent,hasData:!1,totalTokens:e.totalTokens,contextWindow:e.contextWindow,freeTokens:e.contextWindow-e.totalTokens}}function Vj(t){return t<20?"#c85858":t<50?"#c89858":"#6a9a78"}const eS={working:0,waiting_permission:1,waiting:2,error:3,orphaned:4,idle:5,offline:6};function HL(t){return[...t].sort((e,n)=>{const s=eS[e.status]??5,a=eS[n.status]??5;return s!==a?s-a:(n.lastActivity||0)-(e.lastActivity||0)})}function UL(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 WL(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 tS(t,e){if(e===DE)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===nb||e===PA){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===nb)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 qL extends IA{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new QL(n)}),this.register(function(n){return new XL(n)}),this.register(function(n){return new i2(n)}),this.register(function(n){return new o2(n)}),this.register(function(n){return new l2(n)}),this.register(function(n){return new ZL(n)}),this.register(function(n){return new e2(n)}),this.register(function(n){return new t2(n)}),this.register(function(n){return new n2(n)}),this.register(function(n){return new KL(n)}),this.register(function(n){return new s2(n)}),this.register(function(n){return new JL(n)}),this.register(function(n){return new r2(n)}),this.register(function(n){return new a2(n)}),this.register(function(n){return new GL(n)}),this.register(function(n){return new c2(n)}),this.register(function(n){return new u2(n)})}load(e,n,s,a){const r=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const f=Zc.extractUrlBase(e);i=Zc.resolveURL(f,this.path)}else i=Zc.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))===Gj){try{i[Xt.KHR_BINARY_GLTF]=new d2(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 C2(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 YL;break;case Xt.KHR_DRACO_MESH_COMPRESSION:i[m]=new f2(r,this.dracoLoader);break;case Xt.KHR_TEXTURE_TRANSFORM:i[m]=new p2;break;case Xt.KHR_MESH_QUANTIZATION:i[m]=new h2;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 VL(){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 GL{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 Pr(16777215);d.color!==void 0&&h.setRGB(d.color[0],d.color[1],d.color[2],sr);const m=d.range!==void 0?d.range:0;switch(d.type){case"directional":f=new sb(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 YL{constructor(){this.name=Xt.KHR_MATERIALS_UNLIT}getMaterialType(){return pl}extendParams(e,n,s){const a=[];e.color=new Pr(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],sr),e.opacity=i[3]}r.baseColorTexture!==void 0&&a.push(s.assignTexture(e,"map",r.baseColorTexture,Mr))}return Promise.all(a)}}class KL{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 QL{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:ar}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 BA(c,c)}return Promise.all(r)}}class XL{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:ar}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 JL{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:ar}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 ZL{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:ar}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 Pr(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],sr)}return i.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(s.assignTexture(n,"sheenColorMap",i.sheenColorTexture,Mr)),i.sheenRoughnessTexture!==void 0&&r.push(s.assignTexture(n,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}}class e2{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:ar}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 t2{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:ar}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 Pr().setRGB(c[0],c[1],c[2],sr),Promise.all(r)}}class n2{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:ar}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 s2{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:ar}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 Pr().setRGB(c[0],c[1],c[2],sr),i.specularColorTexture!==void 0&&r.push(s.assignTexture(n,"specularColorMap",i.specularColorTexture,Mr)),Promise.all(r)}}class a2{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:ar}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 r2{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:ar}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 i2{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 o2{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 l2{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 c2{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 u2{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!==ga.TRIANGLES&&f.mode!==ga.TRIANGLE_STRIP&&f.mode!==ga.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,C=new ao,k=new FA,N=new ao(1,1,1),j=new LE(v.geometry,v.material,x);for(let _=0;_<x;_++)d.TRANSLATION&&C.fromBufferAttribute(d.TRANSLATION,_),d.ROTATION&&k.fromBufferAttribute(d.ROTATION,_),d.SCALE&&N.fromBufferAttribute(d.SCALE,_),j.setMatrixAt(_,S.compose(C,k,N));for(const _ in d)if(_==="_COLOR_0"){const D=d[_];j.instanceColor=new PE(D.array,D.itemSize,D.normalized)}else _!=="TRANSLATION"&&_!=="ROTATION"&&_!=="SCALE"&&v.geometry.setAttribute(_,d[_]);zA.prototype.copy.call(j,v),this.parser.assignFinalMaterial(j),y.push(j)}return h.isGroup?(h.clear(),h.add(...y),h):y[0]}))}}const Gj="glTF",Pc=12,nS={JSON:1313821514,BIN:5130562};class d2{constructor(e){this.name=Xt.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,Pc),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!==Gj)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-Pc,r=new DataView(e,Pc);let i=0;for(;i<a;){const c=r.getUint32(i,!0);i+=4;const d=r.getUint32(i,!0);if(i+=4,d===nS.JSON){const f=new Uint8Array(e,Pc+i,c);this.content=s.decode(f)}else if(d===nS.BIN){const f=Pc+i;this.body=e.slice(f,f+c)}i+=c}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class f2{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=Cb[h]||h.toLowerCase();c[m]=i[h]}for(const h in e.attributes){const m=Cb[h]||h.toLowerCase();if(i[h]!==void 0){const x=s.accessors[e.attributes[h]],y=gl[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],C=d[v];C!==void 0&&(S.normalized=C)}m(y)},c,f,sr,x)})})}}class p2{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 h2{constructor(){this.name=Xt.KHR_MESH_QUANTIZATION}}class Yj 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,C=-2*y+3*x,k=y-x,N=1-C,j=k-x+m;for(let _=0;_!==c;_++){const D=i[S+_+c],E=i[S+_+d]*h,I=i[v+_+c],O=i[v+_]*h;r[_]=N*D+j*E+C*I+k*O}return r}}const m2=new FA;class g2 extends Yj{interpolate_(e,n,s,a){const r=super.interpolate_(e,n,s,a);return m2.fromArray(r).normalize().toArray(r),r}}const ga={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},gl={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},sS={9728:HA,9729:ab,9984:HE,9985:$E,9986:zE,9987:$A},aS={33071:WE,33648:UE,10497:rb},dg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Cb={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"},bi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},b2={CUBICSPLINE:void 0,LINEAR:VA,STEP:aM},fg={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function x2(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new Kb({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:iM})),t.DefaultMaterial}function Xi(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 y2(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 v2(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 w2(t){let e;const n=t.extensions&&t.extensions[Xt.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+pg(n.attributes):e=t.indices+":"+pg(t.attributes)+":"+t.mode,t.targets!==void 0)for(let s=0,a=t.targets.length;s<a;s++)e+=":"+pg(t.targets[s]);return e}function pg(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 Ab(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 k2(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 S2=new Of;class C2{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new VL,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 Xi(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(Zc.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=dg[a.type],c=gl[a.componentType],d=a.normalized===!0,f=new c(a.count*i);return Promise.resolve(new eu(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=dg[a.type],f=gl[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,C;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)),C=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),C=new eu(S,d,v);if(a.sparse!==void 0){const k=dg.SCALAR,N=gl[a.sparse.indices.componentType],j=a.sparse.indices.byteOffset||0,_=a.sparse.values.byteOffset||0,D=new N(i[1],j,a.sparse.count*k),E=new f(i[2],_,a.sparse.count*d);c!==null&&(C=new eu(C.array.slice(),C.itemSize,C.normalized)),C.normalized=!1;for(let I=0,O=D.length;I<O;I++){const T=D[I];if(C.setX(T,E[I*d]),d>=2&&C.setY(T,E[I*d+1]),d>=3&&C.setZ(T,E[I*d+2]),d>=4&&C.setW(T,E[I*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}C.normalized=v}return C})}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=sS[x.magFilter]||ab,h.minFilter=sS[x.minFilter]||$A,h.wrapS=aS[x.wrapS]||rb,h.wrapT=aS[x.wrapT]||rb,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==HA&&h.minFilter!==ab,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 C=new R0(S);C.needsUpdate=!0,x(C)}),n.load(Zc.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||k2(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 Kb}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 Pr(1,1,1),c.opacity=1,Array.isArray(m.baseColorFactor)){const x=m.baseColorFactor;c.color.setRGB(x[0],x[1],x[2],sr),c.opacity=x[3]}m.baseColorTexture!==void 0&&f.push(n.assignTexture(c,"map",m.baseColorTexture,Mr)),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=UA);const h=r.alphaMode||fg.OPAQUE;if(h===fg.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,h===fg.MASK&&(c.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==pl&&(f.push(n.assignTexture(c,"normalMap",r.normalTexture)),c.normalScale=new BA(1,1),r.normalTexture.scale!==void 0)){const m=r.normalTexture.scale;c.normalScale.set(m,m)}if(r.occlusionTexture!==void 0&&i!==pl&&(f.push(n.assignTexture(c,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==pl){const m=r.emissiveFactor;c.emissive=new Pr().setRGB(m[0],m[1],m[2],sr)}return r.emissiveTexture!==void 0&&i!==pl&&f.push(n.assignTexture(c,"emissiveMap",r.emissiveTexture,Mr)),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&&Xi(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 rS(d,c,n)})}const i=[];for(let c=0,d=e.length;c<d;c++){const f=e[c],h=w2(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=rS(new WA,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?x2(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],C=i[y];let k;const N=f[y];if(C.mode===ga.TRIANGLES||C.mode===ga.TRIANGLE_STRIP||C.mode===ga.TRIANGLE_FAN||C.mode===void 0)k=r.isSkinnedMesh===!0?new YE(S,N):new ul(S,N),k.isSkinnedMesh===!0&&k.normalizeSkinWeights(),C.mode===ga.TRIANGLE_STRIP?k.geometry=tS(k.geometry,PA):C.mode===ga.TRIANGLE_FAN&&(k.geometry=tS(k.geometry,nb));else if(C.mode===ga.LINES)k=new KE(S,N);else if(C.mode===ga.LINE_STRIP)k=new QE(S,N);else if(C.mode===ga.LINE_LOOP)k=new XE(S,N);else if(C.mode===ga.POINTS)k=new JE(S,N);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+C.mode);Object.keys(k.geometry.morphAttributes).length>0&&v2(k,r),k.name=n.createUniqueName(r.name||"mesh_"+e),Tr(k,r),C.extensions&&Xi(a,k,C),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&&Xi(a,m[0],r),m[0];const x=new Fm;r.extensions&&Xi(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 qA(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,C=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",C)),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],C=m[4],k=[];for(let N=0,j=x.length;N<j;N++){const _=x[N],D=y[N],E=v[N],I=S[N],O=C[N];if(_===void 0)continue;_.updateMatrix&&_.updateMatrix();const T=s._createAnimationTracks(_,D,E,I,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,S2)});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 Fm:f.length===1?h=f[0]:h=new zA,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&&Xi(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 Fm;s.name&&(r.name=a.createUniqueName(s.name)),Tr(r,s),s.extensions&&Xi(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 R0)&&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=[];bi[r.path]===bi.weights?e.traverse(function(x){x.morphTargetInfluences&&d.push(x.name?x.name:x.uuid)}):d.push(c);let f;switch(bi[r.path]){case bi.weights:f=L0;break;case bi.rotation:f=P0;break;case bi.position:case bi.scale:f=O0;break;default:switch(s.itemSize){case 1:f=L0;break;case 2:case 3:default:f=O0;break}break}const h=a.interpolation!==void 0?b2[a.interpolation]:VA,m=this._getArrayFromAccessor(s);for(let x=0,y=d.length;x<y;x++){const v=new f(d[x]+"."+bi[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=Ab(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 P0?g2:Yj;return new a(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function A2(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 ao(d[0],d[1],d[2]),new ao(f[0],f[1],f[2])),c.normalized){const h=Ab(gl[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 ao,d=new ao;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=Ab(gl[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 rS(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=Cb[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 ib.workingColorSpace!==sr&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ib.workingColorSpace}" not supported.`),Tr(t,e),A2(t,e,n),Promise.all(a).then(function(){return e.targets!==void 0?y2(t,e.targets,n):t})}const hg=new WeakMap;class j2 extends IA{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,Mr,s).catch(s)}decodeDracoFile(e,n,s,a,r=sr,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(hg.has(e)){const d=hg.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)}),hg.set(e,{key:s,promise:c}),c}_createGeometry(e){const n=new WA;e.index&&n.setIndex(new eu(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 eu(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!==Mr)return;const s=new Pr;for(let a=0,r=e.count;a<r;a++)s.fromBufferAttribute(e,a),ib.toWorkingColorSpace(s,Mr),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=N2.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 N2(){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 C in h){const k=self[m[C]];let N,j;if(f.useUniqueIDs)j=h[C],N=c.GetAttributeByUniqueId(x,j);else{if(j=c.GetAttributeId(x,i[h[C]]),j===-1)continue;N=c.GetAttribute(x,j)}const _=a(i,c,x,C,k,N);C==="color"&&(_.vertexColorSpace=f.vertexColorSpace),S.attributes.push(_)}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,C=r(i,h),k=i._malloc(S);c.GetAttributeDataArrayForAllPoints(d,m,C,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 T2=(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 _=k.charCodeAt(j);N[j]=_>96?_-97:_>64?_-39:_+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,_,D,E){var I=r.exports.sbrk,O=j+3&-4,T=I(O*_),M=I(D.length),R=new Uint8Array(r.exports.memory.buffer);R.set(D,M);var B=k(T,j,_,M,D.length);if(B==0&&E&&E(T,O,_),N.set(R.subarray(T,T+j*_)),I(T-I(0)),B!=0)throw new Error("Malformed buffer data: "+B)}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 _=j.data;N.pending-=_.count,N.requests[_.id][_.action](_.value),delete N.requests[_.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()+C.toString(),j=new Blob([N],{type:"text/javascript"}),_=URL.createObjectURL(j),D=0;D<k;++D)m[D]=y(_);URL.revokeObjectURL(_)}function S(k,N,j,_,D){for(var E=m[0],I=1;I<m.length;++I)m[I].pending<E.pending&&(E=m[I]);return new Promise(function(O,T){var M=new Uint8Array(j),R=x++;E.pending+=k,E.requests[R]={resolve:O,reject:T},E.object.postMessage({id:R,count:k,size:N,source:M,mode:_,filter:D},[M.buffer])})}function C(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(_){self.postMessage({id:N.id,count:N.count,action:"reject",value:_})}})}return{ready:i,supported:!0,useWorkers:function(k){v(k)},decodeVertexBuffer:function(k,N,j,_,D){d(r.exports.meshopt_decodeVertexBuffer,k,N,j,_,r.exports[f[D]])},decodeIndexBuffer:function(k,N,j,_){d(r.exports.meshopt_decodeIndexBuffer,k,N,j,_)},decodeIndexSequence:function(k,N,j,_){d(r.exports.meshopt_decodeIndexSequence,k,N,j,_)},decodeGltfBuffer:function(k,N,j,_,D,E){d(r.exports[h[D]],k,N,j,_,r.exports[f[E]])},decodeGltfBufferAsync:function(k,N,j,_,D){return m.length>0?S(k,N,j,h[_],f[D]):i.then(function(){var E=new Uint8Array(k*N);return d(r.exports[h[_]],E,k,N,j,r.exports[f[D]]),E})}}})();const _2={idle:"idle",working:"walk",waiting:"sit",waiting_permission:"idle",error:"emote-no",offline:"static",orphaned:"idle"},iS={idle:4915102,working:4890367,waiting:16752202,waiting_permission:16763904,error:16730698,offline:8947848,orphaned:16752202};function Kj({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),C=b.useRef(new Map),k=b.useRef(null),N=b.useRef(null),j=b.useRef(0),_=b.useRef(new uM),[D,E]=b.useState(!1),[I,O]=b.useState(!1),T=b.useRef(!1),M=b.useRef(0),R=b.useRef(new ao),B=b.useRef(!1),$=b.useRef({x:0,y:0}),U=b.useRef({x:0,y:0});b.useEffect(()=>{const F=h.current;if(!F)return;O(!1);const W=new dM;W.background=new Pr(1710628),x.current=W;const V=new qA(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),F.appendChild(Y.domElement),m.current=Y;const z=new pM(16777215,1);W.add(z);const Q=new sb(16777215,1.5);Q.position.set(2,3,2),W.add(Q);const K=new sb(4890367,.6);K.position.set(-2,1,-1),W.add(K);const q=new hM(1,32),xe=new Kb({color:2763322,roughness:.8}),de=new ul(q,xe);de.rotation.x=-Math.PI/2,de.position.y=0,W.add(de);const ee=new mM(.35,.42,32),fe=new pl({color:iS.idle,side:UA,transparent:!0,opacity:.8}),je=new ul(ee,fe);je.rotation.x=-Math.PI/2,je.position.y=.01,W.add(je),N.current=je,E(!0);const ge=ne=>{B.current=!0,$.current={x:ne.clientX,y:ne.clientY},F.style.cursor="grabbing"},Ee=ne=>{if(!B.current||!v.current)return;const Te=ne.clientX-$.current.x,qe=ne.clientY-$.current.y;U.current.y+=Te*.01,U.current.x+=qe*.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:ne.clientX,y:ne.clientY}},Be=()=>{B.current=!1,F.style.cursor="grab"},Ve=()=>{B.current=!1,F.style.cursor="grab"};F.addEventListener("mousedown",ge),window.addEventListener("mousemove",Ee),window.addEventListener("mouseup",Be),F.addEventListener("mouseleave",Ve),F.style.cursor="grab";const J=()=>{j.current=requestAnimationFrame(J);const ne=_.current.getDelta();if(S.current)S.current.update(ne);else if(v.current&&!T.current){M.current+=ne;const Te=M.current,Se=Math.sin(Te*1.5)*.02,he=Math.sin(Te*.8)*.01;v.current.position.set(R.current.x+he,R.current.y+Se,R.current.z)}m.current&&x.current&&y.current&&m.current.render(x.current,y.current)};return J(),()=>{if(cancelAnimationFrame(j.current),F.removeEventListener("mousedown",ge),window.removeEventListener("mousemove",Ee),window.removeEventListener("mouseup",Be),F.removeEventListener("mouseleave",Ve),v.current&&x.current&&(x.current.remove(v.current),v.current.traverse(ne=>{var Te,qe;ne instanceof ul&&((Te=ne.geometry)==null||Te.dispose(),Array.isArray(ne.material)?ne.material.forEach(at=>{at.map&&at.map.dispose(),at.dispose()}):ne.material&&(ne.material.map&&((qe=ne.material.map)==null||qe.dispose()),ne.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(ne=>{var Te;ne instanceof ul&&((Te=ne.geometry)==null||Te.dispose(),ne.material instanceof wf&&ne.material.dispose())}),x.current.clear()),S.current=null,k.current=null,C.current.clear(),m.current){try{const Te=m.current.getContext().getExtension("WEBGL_lose_context");Te&&Te.loseContext()}catch{}m.current.dispose(),F.contains(m.current.domElement)&&F.removeChild(m.current.domElement),m.current=null}x.current=null,y.current=null,E(!1)}},[d,f]),b.useEffect(()=>{if(!D||!x.current)return;const F=new qL,W=new j2;W.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.7/"),F.setDRACOLoader(W),F.setMeshoptDecoder(T2);let V=null;const Y=z=>{v.current&&x.current&&(x.current.remove(v.current),v.current=null,S.current=null,k.current=null);const Q=z.scene;Q.scale.setScalar(a);const K=(r==null?void 0:r.x)??0,q=(r==null?void 0:r.y)??0,xe=(r==null?void 0:r.z)??0;if(Q.position.set(K,xe,q),Q.visible=!0,U.current={x:0,y:0},Q.rotation.set(0,0,0),Q.traverse(de=>{if(de instanceof ul&&(de.castShadow=!0,de.receiveShadow=!0,de.material)){const ee=de.material;ee.map&&(ee.map.colorSpace=Mr)}}),x.current)if(x.current.add(Q),v.current=Q,R.current.copy(Q.position),z.animations.length>0){T.current=!0;const de=new gM(Q);S.current=de,C.current.clear();for(const ee of z.animations)C.current.set(ee.name.toLowerCase(),ee);if(i!==""){const ee=i?C.current.get(i.toLowerCase())||z.animations[0]:C.current.get("idle")||z.animations[0];if(ee){const fe=de.clipAction(ee);fe.reset().play(),k.current=fe}}}else T.current=!1,S.current=null,C.current.clear()};if(n)V=URL.createObjectURL(n),console.log("[ModelPreview] Loading custom model from file:",n.name,"blob URL:",V),F.load(V,z=>{console.log("[ModelPreview] Successfully loaded custom model file, animations:",z.animations.length),Y(z)},void 0,z=>{console.error("[ModelPreview] Failed to load custom model file:",z)});else if(s){const z=mb(s);console.log("[ModelPreview] Loading custom model from URL:",s),F.load(z,Q=>{console.log("[ModelPreview] Successfully loaded custom model URL, animations:",Q.animations.length),Y(Q)},void 0,Q=>{console.error("[ModelPreview] Failed to load custom model URL:",s,Q)})}else{const z=e||(t?IL[t]:void 0)||"character-male-a.glb";F.load(`/assets/characters/${z}`,Y,void 0,Q=>{console.error("[ModelPreview] Failed to load model:",z,Q)})}return()=>{V&&URL.revokeObjectURL(V),W.dispose()}},[t,e,n,s,a,r,D]);const L=F=>{if(!S.current)return;const W=_2[F],V=C.current.get(W);if(!V){const z=C.current.get("idle");if(z){const Q=S.current.clipAction(z);Q.reset().play(),k.current=Q}return}const Y=S.current.clipAction(V);F==="working"?Y.timeScale=1.5:F==="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 F=N.current.material;F.color.setHex(iS[c]),c==="working"?F.opacity=.6+Math.sin(Date.now()*.005)*.4:F.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 F=i?i.toLowerCase():"idle",W=C.current.get(F);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]),I?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 E2({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,C]=b.useState(!1),k=b.useRef(null),N=b.useRef(null),j=b.useRef(null),_=b.useCallback(async R=>{if(!R){h([]);return}C(!0);try{const B=new URLSearchParams({path:R,dirs:r?"true":"false",limit:"15"}),$=await Bt(Dt(`/api/files/autocomplete?${B}`));if($.ok){const U=await $.json();h(U.suggestions||[]),x(-1)}}catch(B){console.error("Failed to fetch path suggestions:",B)}finally{C(!1)}},[r]);b.useEffect(()=>(j.current&&clearTimeout(j.current),t&&y?j.current=setTimeout(()=>{_(t)},150):h([]),()=>{j.current&&clearTimeout(j.current)}),[t,y,_]);const D=R=>{e(R.target.value),v(!0)},E=b.useCallback(R=>{var $;const B=R.isDirectory?R.path+"/":R.path;e(B),v(R.isDirectory),x(-1),($=k.current)==null||$.focus(),R.isDirectory&&_(B)},[e,_]),I=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(B=>B<f.length-1?B+1:B);break;case"ArrowUp":R.preventDefault(),x(B=>B>0?B-1:-1);break;case"Tab":if(R.preventDefault(),f.length>0){const B=m>=0?m:0;E(f[B])}break;case"Enter":R.preventDefault(),m>=0&&f[m]?E(f[m]):n&&(v(!1),n());break;case"Escape":R.preventDefault(),v(!1),x(-1);break}},O=()=>{v(!0),t&&_(t)},T=()=>{setTimeout(()=>{v(!1),x(-1)},200)};b.useEffect(()=>{if(m>=0&&N.current){const B=N.current.querySelectorAll(".folder-input-suggestion")[m];B&&B.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:I,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,B)=>o.jsxs("div",{className:`folder-input-suggestion ${B===m?"selected":""}`,onClick:()=>E(R),onMouseEnter:()=>x(B),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 Qj({agent:t,isOpen:e,onClose:n}){const{t:s}=pt(["terminal","common","tools"]),a=rL(),r=Pa(),[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}),[C,k]=b.useState(t.model||"sonnet"),[N,j]=b.useState(t.effort),[_,D]=b.useState(t.codexModel||"gpt-5.3-codex"),[E,I]=b.useState(t.opencodeModel||"minimax/MiniMax-M1-80k"),[O,T]=b.useState(t.useChrome||!1),[M,R]=b.useState(t.cwd),[B,$]=b.useState(new Set),[U,L]=b.useState(""),[F,W]=b.useState(!1),[V,Y]=b.useState("");b.useMemo(()=>a.filter(J=>J.enabled&&(J.assignedAgentIds.includes(t.id)||J.assignedAgentClasses.includes(t.class))),[a,t.id,t.class]),b.useEffect(()=>{const J=a.filter(ne=>ne.assignedAgentIds.includes(t.id)).map(ne=>ne.id);$(new Set(J))},[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"),I(t.opencodeModel||"minimax/MiniMax-M1-80k"),T(t.useChrome||!1),R(t.cwd);const J=a.filter(ne=>ne.assignedAgentIds.includes(t.id)).map(ne=>ne.id);$(new Set(J))}},[e,t,a]);const z=b.useMemo(()=>a.filter(J=>J.enabled),[a]),Q=b.useMemo(()=>{if(!U.trim())return z;const J=U.toLowerCase();return z.filter(ne=>ne.name.toLowerCase().includes(J)||ne.description.toLowerCase().includes(J)||ne.slug.toLowerCase().includes(J))},[z,U]),K=b.useMemo(()=>z.filter(J=>J.assignedAgentClasses.includes(d)),[z,d]),q=b.useCallback(J=>{$(ne=>{const Te=new Set(ne);return Te.has(J)?Te.delete(J):Te.add(J),Te})},[]),xe=b.useMemo(()=>{const J=r.find(ne=>ne.id===d);if(J!=null&&J.model)return J.model},[r,d]),de=b.useMemo(()=>{const J=r.find(ne=>ne.id===d);if(J!=null&&J.customModelPath)return Dt(`/api/custom-models/${J.id}`)},[r,d]),ee=b.useMemo(()=>{const J=r.find(ne=>ne.id===d);return J==null?void 0:J.modelScale},[r,d]),fe=b.useMemo(()=>r.find(J=>J.id===d),[r,d]);b.useEffect(()=>{fe&&(Y(fe.instructions||""),W(!1))},[fe==null?void 0:fe.id]);const je=b.useMemo(()=>r.find(ne=>ne.id===d)?"scout":d,[r,d]),ge=b.useMemo(()=>{const J=i.trim();if(J&&J!==t.name||d!==t.class||h!==t.permissionMode||x!==(t.provider||"claude")||x==="claude"&&C!==(t.model||"sonnet")||x==="claude"&&N!==(t.effort||void 0)||x==="codex"&&_!==(t.codexModel||"gpt-5.3-codex")||x==="codex"&&JSON.stringify(v||{})!==JSON.stringify(t.codexConfig||{})||x==="opencode"&&E!==(t.opencodeModel||"minimax/MiniMax-M1-80k")||O!==(t.useChrome||!1)||M!==t.cwd)return!0;const ne=a.filter(qe=>qe.assignedAgentIds.includes(t.id)).map(qe=>qe.id).sort().join(","),Te=Array.from(B).sort().join(",");return ne!==Te},[i,d,h,x,C,N,_,v,E,O,M,B,t,a]),Ee=()=>{const J=i.trim(),ne={};J&&J!==t.name&&H.renameAgent(t.id,J),d!==t.class&&(ne.class=d),h!==t.permissionMode&&(ne.permissionMode=h),x!==(t.provider||"claude")&&(ne.provider=x),x==="codex"&&JSON.stringify(v||{})!==JSON.stringify(t.codexConfig||{})&&(ne.codexConfig=v),x==="codex"&&_!==(t.codexModel||"gpt-5.3-codex")&&(ne.codexModel=_),x==="opencode"&&E!==(t.opencodeModel||"minimax/MiniMax-M1-80k")&&(ne.opencodeModel=E),x==="claude"&&C!==(t.model||"sonnet")&&(ne.model=C),x==="claude"&&N!==(t.effort||void 0)&&(ne.effort=N),O!==(t.useChrome||!1)&&(ne.useChrome=O),M!==t.cwd&&(ne.cwd=M);const Te=a.filter(at=>at.assignedAgentIds.includes(t.id)).map(at=>at.id).sort().join(","),qe=Array.from(B).sort().join(",");Te!==qe&&(ne.skillIds=Array.from(B)),Object.keys(ne).length>0&&H.updateAgentProperties(t.id,ne),n()},{handleMouseDown:Be,handleClick:Ve}=wa(n);return e?o.jsx("div",{className:"modal-overlay visible",onMouseDown:Be,onClick:Ve,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(Kj,{agentClass:je,modelFile:xe,customModelUrl:de,modelScale:ee,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(J=>o.jsxs("button",{className:`class-chip ${d===J.id?"selected":""}`,onClick:()=>f(J.id),title:J.description,children:[o.jsx("span",{className:"class-chip-icon",children:J.icon}),o.jsx("span",{className:"class-chip-name",children:J.name})]},J.id)),Object.entries(po).filter(([J])=>J!=="boss").map(([J,ne])=>o.jsxs("button",{className:`class-chip ${d===J?"selected":""}`,onClick:()=>f(J),title:ne.description,children:[o.jsx("span",{className:"class-chip-icon",children:ne.icon}),o.jsx("span",{className:"class-chip-name",children:J.charAt(0).toUpperCase()+J.slice(1)})]},J))]})]})]}),fe&&o.jsxs("div",{className:"custom-class-notice",children:[o.jsxs("div",{className:"custom-class-notice-header",onClick:()=>W(!F),style:{cursor:"pointer"},children:[o.jsx("span",{children:"📋"}),o.jsx("span",{children:fe.instructions?s("terminal:spawn.hasCustomInstructions"):"Add custom instructions"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:11,opacity:.6},children:F?"▲":"▼"})]}),!F&&fe.instructions&&o.jsx("div",{className:"custom-class-notice-info",children:s("terminal:spawn.instructionsInjected",{count:fe.instructions.length})}),F&&o.jsxs("div",{className:"custom-class-instructions-editor",children:[o.jsx("textarea",{value:V,onChange:J=>Y(J.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(fe.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(fe.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:J=>c(J.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(iu).map(J=>o.jsxs("button",{className:`spawn-select-btn ${h===J?"selected":""}`,onClick:()=>m(J),title:iu[J].description,children:[o.jsx("span",{children:J==="bypass"?"⚡":"🔐"}),o.jsx("span",{children:iu[J].label})]},J))})]})]}),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(J=>o.jsxs("button",{className:`spawn-select-btn ${C===J?"selected":""}`,onClick:()=>k(J),title:tf[J].description,children:[o.jsx("span",{children:tf[J].icon}),o.jsx("span",{children:tf[J].label})]},J))}):x==="codex"?o.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(ef).map(J=>o.jsxs("button",{className:`spawn-select-btn ${_===J?"selected":""}`,onClick:()=>D(J),title:ef[J].description,children:[o.jsx("span",{children:ef[J].icon}),o.jsx("span",{children:ef[J].label})]},J))}):x==="opencode"?o.jsx("input",{type:"text",className:"spawn-input",value:E,onChange:J=>I(J.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(ug).map(J=>o.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${N===J?"selected":""}`,onClick:()=>j(J),title:ug[J].description,children:o.jsx("span",{children:ug[J].label})},J))]})]})]}),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:J=>S(ne=>({...ne,fullAuto:J.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:J=>S(ne=>({...ne,search:J.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:J=>S(ne=>({...ne,sandbox:J.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:J=>S(ne=>({...ne,approvalMode:J.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:J=>S(ne=>({...ne,profile:J.target.value||void 0}))})]})]})}),x==="claude"&&(C!==(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:J=>T(J.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(E2,{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"),")"]})]}),z.length>6&&o.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:s("terminal:spawn.filterSkills"),value:U,onChange:J=>L(J.target.value)}),o.jsx("div",{className:"skills-chips-compact",children:z.length===0?o.jsx("div",{className:"skills-empty",children:s("terminal:spawn.noEnabledSkills")}):Q.length===0?o.jsx("div",{className:"skills-empty",children:s("terminal:spawn.noSkillsMatch",{query:U})}):Q.map(J=>{const ne=K.includes(J),qe=B.has(J.id)||ne;return o.jsxs("button",{className:`skill-chip ${qe?"selected":""} ${ne?"class-based":""}`,onClick:()=>!ne&&q(J.id),title:ne?s("terminal:spawn.assignedViaClass"):J.name,children:[qe&&o.jsx("span",{className:"skill-check",children:"✓"}),o.jsx("span",{className:"skill-chip-name",children:J.name}),J.builtin&&o.jsx("span",{className:"skill-chip-badge builtin",children:"TC"}),ne&&o.jsx("span",{className:"skill-chip-badge",children:"class"})]},J.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:Ee,disabled:!ge,children:s("common:buttons2.saveChanges")})]})]})}):null}const M2=Object.freeze(Object.defineProperty({__proto__:null,AgentEditModal:Qj},Symbol.toStringTag,{value:"Module"}));var Rl=LA();const D2=ju(Rl);function ir({children:t}){return typeof document>"u"?null:Rl.createPortal(t,document.body)}function Ic(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function oS(t){return`${t.toFixed(1)}%`}function R2(t){return t>=80?"#ff4a4a":t>=60?"#ff9e4a":t>=40?"#ffd700":"#4aff9e"}const O2={systemPrompt:"#4a9eff",systemTools:"#9e4aff",messages:"#4aff9e",freeSpace:"rgba(255,255,255,0.1)",autocompactBuffer:"#ff9e4a"},L2={systemPrompt:"terminal:context.systemPrompt",systemTools:"terminal:context.systemTools",messages:"terminal:context.messagesCategory",freeSpace:"terminal:context.freeSpace",autocompactBuffer:"terminal:context.autocompactBuffer"},P2={systemPrompt:"terminal:context.systemPromptDesc",systemTools:"terminal:context.systemToolsDesc",messages:"terminal:context.messagesDesc",freeSpace:"terminal:context.freeSpaceDesc",autocompactBuffer:"terminal:context.autocompactBufferDesc"};function Xj({agent:t,isOpen:e,onClose:n,onRefresh:s}){const{t:a}=pt(["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(L2[v]),description:a(P2[v]),color:O2[v]})):[],[r]),m=b.useMemo(()=>h.filter(v=>v.key!=="freeSpace"),[h]),{handleMouseDown:x,handleClick:y}=wa(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:Ic(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:R2(r.usedPercent)},children:[Ic(r.totalTokens)," / ",Ic(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}: ${Ic(v.tokens)} (${oS(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:Ic(v.tokens)}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:oS(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 I2=b.memo(function({tokensUsed:e,createdAt:n}){const{t:s}=pt(["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)})]})]})}),Jj=b.memo(function({contextInfo:e,onClick:n}){const{t:s}=pt(["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:Vj(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")})]})}),B2=b.memo(function({lastActivity:e}){const{t:n}=pt(["common"]);return o.jsxs("div",{className:"unit-idle-timer",title:n("unitPanel.timeSinceActivity"),style:{color:Qb(e)},children:["⏱ ",gp(e)]})}),F2=b.memo(function({task:e}){const{t:n}=pt(["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})]})}),z2=b.memo(function({cwd:e}){const{t:n}=pt(["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})]})}),$2=b.memo(function({text:e,maxLength:n=150}){const{t:s}=pt(["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})]})}),H2=b.memo(function({text:e,maxLength:n=200}){const{t:s}=pt(["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 U2({agent:t,onFocusAgent:e,onKillAgent:n,onCallSubordinates:s,onOpenAreaExplorer:a}){var ge,Ee;const{t:r}=pt(["common"]),i=Ns(),c=Pa(),{showToast:d}=Uj(),f=i.agents.get(t.id)||t,h=Ia(f.class,c),m=c.find(Be=>Be.id===f.class),x=m==null?void 0:m.model,y=m!=null&&m.customModelPath?Dt(`/api/custom-models/${m.id}`):void 0,v=m==null?void 0:m.modelScale,[S,C]=b.useState(!1),[k,N]=b.useState(f.name),j=b.useRef(null),[,_]=b.useState(0),[D,E]=b.useState(!0),[I,O]=b.useState(!1),[T,M]=b.useState([]),[R,B]=b.useState(null),[$,U]=b.useState(!1),[L,F]=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 Be=setInterval(()=>{_(Ve=>Ve+1)},15e3);return()=>clearInterval(Be)}},[f.status]),b.useEffect(()=>{f.permissionMode==="interactive"&&Bt(Dt("/api/remembered-patterns")).then(Be=>Be.json()).then(M).catch(Be=>console.error("Failed to fetch remembered patterns:",Be))},[f.permissionMode]);const Y=b.useMemo(()=>kp(f),[f.contextStats,f.contextUsed,f.contextLimit]),z=H.getAreaForAgent(f.id),Q=i.agentOutputs.get(f.id)||[],K=Q.length>0?Q[Q.length-1]:null,q=i.lastPrompts.get(f.id),xe=async(Be,Ve)=>{try{(await Bt(Dt(`/api/remembered-patterns/${Be}/${encodeURIComponent(Ve)}`),{method:"DELETE"})).ok&&M(ne=>ne.filter(Te=>!(Te.tool===Be&&Te.pattern===Ve)))}catch(J){console.error("Failed to remove pattern:",J)}},de=async()=>{if(confirm(r("confirm.clearPatterns")))try{(await Bt(Dt("/api/remembered-patterns"),{method:"DELETE"})).ok&&M([])}catch(Be){console.error("Failed to clear patterns:",Be)}},ee=()=>{confirm(r("confirm.terminateAgent"))&&n(f.id)},fe=()=>{const Be=k.trim();Be&&Be!==f.name?H.renameAgent(f.id,Be):N(f.name),C(!1)},je=Be=>{Be.key==="Enter"?fe():Be.key==="Escape"&&(N(f.name),C(!1))};return o.jsxs("div",{className:"unit-panel",children:[o.jsx("div",{className:"unit-model-preview",children:o.jsx(Kj,{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:Be=>N(Be.target.value),onBlur:fe,onKeyDown:je}):o.jsx("div",{className:"unit-name unit-name-editable",onClick:()=>C(!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(B2,{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:()=>B("collapse"),title:r("unitPanel.collapseContext"),disabled:f.status!=="idle",children:"📦"}),o.jsx("button",{className:"unit-action-icon warning",onClick:()=>B("clear"),title:r("unitPanel.clearContext"),children:"🧹"}),o.jsx("button",{className:"unit-action-icon danger",onClick:ee,title:r("unitPanel.killAgent"),children:"☠️"})]})]}),z&&o.jsxs("div",{className:"unit-area",children:[o.jsx("span",{className:"unit-area-dot",style:{background:z.color}}),o.jsx("span",{className:"unit-area-name",children:z.name})]}),q&&o.jsx($2,{text:q.text}),K&&o.jsx(H2,{text:K.text}),o.jsx(I2,{tokensUsed:f.tokensUsed,createdAt:f.createdAt}),o.jsx(Jj,{contextInfo:Y,onClick:()=>F(!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(F2,{task:f.currentTask}),o.jsx(z2,{cwd:f.cwd}),o.jsx(W2,{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:(ge=iu[f.permissionMode])==null?void 0:ge.description,children:[o.jsx("span",{className:"unit-permission-mode-icon",children:f.permissionMode==="bypass"?"⚡":"🔐"}),o.jsx("span",{className:"unit-permission-mode-label",children:((Ee=iu[f.permissionMode])==null?void 0:Ee.label)||f.permissionMode})]})]}),f.permissionMode==="interactive"&&o.jsx(q2,{patterns:T,showPatterns:I,onToggle:()=>O(!I),onRemovePattern:xe,onClearAll:de}),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 Be=f.provider==="codex"?`codex resume ${f.sessionId}`:f.provider==="opencode"?`opencode resume ${f.sessionId}`:`claude --resume ${f.sessionId}`;try{await navigator.clipboard.writeText(Be),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:()=>E(!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((Be,Ve)=>o.jsx(Zj,{entry:Be,defaultExpanded:Ve===0},Be.id))})]}),(f.isBoss||f.class==="boss")&&o.jsx(G2,{agent:f}),f.bossId&&o.jsx(K2,{agentId:f.id,bossId:f.bossId}),f.class!=="boss"&&!f.isBoss&&!f.bossId&&o.jsx(Q2,{agentId:f.id}),R&&o.jsx(V2,{action:R,agentName:f.name,onClose:()=>B(null),onConfirm:()=>{R==="collapse"?H.collapseContext(f.id):H.clearContext(f.id),B(null)}}),o.jsx(Qj,{agent:f,isOpen:$,onClose:()=>U(!1)}),o.jsx(Xj,{agent:f,isOpen:L,onClose:()=>F(!1),onRefresh:()=>{H.refreshAgentContext(f.id)}})]})}const W2=b.memo(function({currentAgentId:e}){const{t:n}=pt(["common"]),s=Ns(),a=Pa(),[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=Ia(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)})})]})}),q2=b.memo(function({patterns:e,showPatterns:n,onToggle:s,onRemovePattern:a,onClearAll:r}){const{t:i}=pt(["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")})]})})]})}),V2=b.memo(function({action:e,agentName:n,onClose:s,onConfirm:a}){const{t:r}=pt(["common"]),{handleMouseDown:i,handleClick:c}=wa(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")})]})]})})}),Zj=b.memo(function({entry:e,defaultExpanded:n=!1,agent:s,onAgentClick:a}){var k;const{t:r}=pt(["common"]),[i,c]=b.useState(n),d=Ns(),f=Pa(),{analysis:h}=e,m=d.settings.hideCost,x=su(h.statusDescription,m),y=su(h.recentWorkSummary,m),v=(k=h.concerns)==null?void 0:k.map(N=>su(N,m)).filter(N=>N.length>0),S=s?Ia(s.class,f):null,C=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:C,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))})]})]})]})}),G2=b.memo(function({agent:e}){const{t:n}=pt(["common"]),s=Ns(),a=Pa(),[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=wp.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=Ia(v.class,a),C=kp(v),k=Math.max(0,Math.min(100,Math.round(C.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:_=>{_.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(Y2,{decision:v},v.id))]})]})]})}),Y2=b.memo(function({decision:e}){const{t:n}=pt(["common"]),[s,a]=b.useState(!1),i=Ns().agents.get(e.selectedAgentId),c=i?wp[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(", ")]})]})]})}),K2=b.memo(function({agentId:e,bossId:n}){const{t:s}=pt(["common"]),r=Ns().agents.get(n);if(!r)return null;const i=wp.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:"✕"})]})}),Q2=b.memo(function({agentId:e}){const{t:n}=pt(["common"]),s=Ns(),[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=wp.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 lS({onOpenAreaExplorer:t}){const{t:e}=pt(["common"]),n=Ns(),s=Array.from(n.agents.values()),a=Array.from(n.areas.values()),[r,i]=b.useState(""),[c,d]=b.useState(()=>{const I=va(ft.COMMANDER_FILTERS,"all");return I==="working"?"active":I||"all"}),f=b.useRef(null),h=b.useMemo(()=>s.map(I=>I.id).sort().join(","),[s]),m=b.useRef(new Set);b.useEffect(()=>{for(const I of s){if(m.current.has(I.id))continue;H.getAgentSupervisorHistory(I.id).length===0&&!H.isLoadingHistoryForAgent(I.id)&&(m.current.add(I.id),H.requestAgentSupervisorHistory(I.id))}},[h]);const x=n.agentsWithUnseenOutput,y=b.useMemo(()=>{const I={all:0,active:0,idle:0,error:0,waiting:0};for(const O of s)I.all++,(O.status==="working"||x.has(O.id))&&I.active++,O.status==="idle"&&!x.has(O.id)&&I.idle++,(O.status==="error"||O.status==="orphaned"||O.status==="offline")&&I.error++,(O.status==="waiting"||O.status==="waiting_permission")&&I.waiting++;return I},[s,x]),v=b.useMemo(()=>{const I=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(I){const R=O.name.toLowerCase().includes(I),B=((T=O.taskLabel)==null?void 0:T.toLowerCase().includes(I))||!1,$=O.class.toLowerCase().includes(I),U=((M=O.currentTool)==null?void 0:M.toLowerCase().includes(I))||!1;return R||B||$||U}return!0})},[s,r,c,x]),S=b.useMemo(()=>HL(v),[v]),C=UL(S,I=>H.getAreaForAgent(I));if(!r&&c==="all")for(const I of a)C.has(I.id)||C.set(I.id,[]);const k=WL(Array.from(C.keys()),I=>n.areas.get(I)),N=b.useCallback(I=>{d(I),er(ft.COMMANDER_FILTERS,I)},[]),j=b.useCallback(()=>{var I;i(""),(I=f.current)==null||I.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 _=r||c!=="all",D=v.length,E=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:E}),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:I=>i(I.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(I=>{const O=y[I];return I!=="all"&&O===0?null:o.jsxs("button",{className:`agents-filter-chip ${I} ${c===I?"selected":""}`,onClick:()=>N(I),children:[e(`agentsList.filter_${I}`),o.jsx("span",{className:"agents-filter-chip-count",children:O})]},I)})}),_&&o.jsxs("div",{className:"agents-filter-info",children:[e("agentsList.showing",{count:D,total:E}),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(I=>{const O=C.get(I),T=I?n.areas.get(I):null;return _&&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(X2,{agent:M,area:T,searchQuery:r},M.id))})]},I||"unassigned")}),_&&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(J2,{agents:s})]})]})}const X2=b.memo(function({agent:e,area:n,searchQuery:s=""}){const a=Ns(),r=Pa(),i=Ia(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?Qb(e.lastActivity):void 0,y=kp(e),v=Vj(y.remainingPercent),S=e.provider==="codex"?"CX":e.provider==="opencode"?"OC":"CL",C=e.provider==="codex"?"OpenAI Codex":e.provider==="opencode"?"OpenCode":"Claude",k=N=>{if(!s.trim())return N;const j=s.trim(),_=N.toLowerCase().indexOf(j.toLowerCase());return _===-1?N:o.jsxs(o.Fragment,{children:[N.slice(0,_),o.jsx("span",{className:"agents-search-highlight",children:N.slice(_,_+j.length)}),N.slice(_+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:C,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:gp(e.lastActivity),children:["⏱ ",$L(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}`})]})}),J2=b.memo(function({agents:e}){const{t:n}=pt(["common"]),s=Ns(),[a,r]=b.useState(()=>_r(ft.GLOBAL_SUPERVISOR_COLLAPSED)),i=()=>{const h=!a;r(h),Qa(ft.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(Zj,{entry:m,agent:h,onAgentClick:d,defaultExpanded:!1},m.id))})]})}),Z2=b.memo(function({agents:e}){const{t:n}=pt(["common"]),s=Pa(),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(eP,{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")})})]})}),eP=b.memo(function({agent:e,customClasses:n}){const s=Ia(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 cS({onFocusAgent:t,onKillAgent:e,onCallSubordinates:n,onOpenAreaExplorer:s}){const a=Ns(),r=H.getSelectedAgents();if(a.selectedAgentIds.size===0)return o.jsx(lS,{onOpenAreaExplorer:s});if(a.selectedAgentIds.size===1){const i=r[0];return i?o.jsx(U2,{agent:i,onFocusAgent:t,onKillAgent:e,onCallSubordinates:n,onOpenAreaExplorer:s}):o.jsx(lS,{onOpenAreaExplorer:s})}return o.jsx(Z2,{agents:r})}function tP(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aP={};function uS(t,e){return(aP.jsx?sP:nP).test(t)}const rP=/[ \t\n\f\r]/g;function iP(t){return typeof t=="object"?t.type==="text"?dS(t.value):!1:dS(t)}function dS(t){return t.replace(rP,"")===""}class _u{constructor(e,n,s){this.normal=n,this.property=e,s&&(this.space=s)}}_u.prototype.normal={};_u.prototype.property={};_u.prototype.space=void 0;function eN(t,e){const n={},s={};for(const a of t)Object.assign(n,a.property),Object.assign(s,a.normal);return new _u(n,s,e)}function jb(t){return t.toLowerCase()}class $s{constructor(e,n){this.attribute=n,this.property=e}}$s.prototype.attribute="";$s.prototype.booleanish=!1;$s.prototype.boolean=!1;$s.prototype.commaOrSpaceSeparated=!1;$s.prototype.commaSeparated=!1;$s.prototype.defined=!1;$s.prototype.mustUseProperty=!1;$s.prototype.number=!1;$s.prototype.overloadedBoolean=!1;$s.prototype.property="";$s.prototype.spaceSeparated=!1;$s.prototype.space=void 0;let oP=0;const Wt=yo(),Xn=yo(),Nb=yo(),rt=yo(),Tn=yo(),bl=yo(),Xs=yo();function yo(){return 2**++oP}const Tb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Wt,booleanish:Xn,commaOrSpaceSeparated:Xs,commaSeparated:bl,number:rt,overloadedBoolean:Nb,spaceSeparated:Tn},Symbol.toStringTag,{value:"Module"})),mg=Object.keys(Tb);class gx extends $s{constructor(e,n,s,a){let r=-1;if(super(e,n),fS(this,"space",a),typeof s=="number")for(;++r<mg.length;){const i=mg[r];fS(this,mg[r],(s&Tb[i])===Tb[i])}}}gx.prototype.defined=!0;function fS(t,e,n){n&&(t[e]=n)}function Ol(t){const e={},n={};for(const[s,a]of Object.entries(t.properties)){const r=new gx(s,t.transform(t.attributes||{},s),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(s)&&(r.mustUseProperty=!0),e[s]=r,n[jb(s)]=s,n[jb(r.attribute)]=s}return new _u(e,n,t.space)}const tN=Ol({properties:{ariaActiveDescendant:null,ariaAtomic:Xn,ariaAutoComplete:null,ariaBusy:Xn,ariaChecked:Xn,ariaColCount:rt,ariaColIndex:rt,ariaColSpan:rt,ariaControls:Tn,ariaCurrent:null,ariaDescribedBy:Tn,ariaDetails:null,ariaDisabled:Xn,ariaDropEffect:Tn,ariaErrorMessage:null,ariaExpanded:Xn,ariaFlowTo:Tn,ariaGrabbed:Xn,ariaHasPopup:null,ariaHidden:Xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tn,ariaLevel:rt,ariaLive:null,ariaModal:Xn,ariaMultiLine:Xn,ariaMultiSelectable:Xn,ariaOrientation:null,ariaOwns:Tn,ariaPlaceholder:null,ariaPosInSet:rt,ariaPressed:Xn,ariaReadOnly:Xn,ariaRelevant:null,ariaRequired:Xn,ariaRoleDescription:Tn,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 nN(t,e){return e in t?t[e]:e}function sN(t,e){return nN(t,e.toLowerCase())}const lP=Ol({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bl,acceptCharset:Tn,accessKey:Tn,action:null,allow:null,allowFullScreen:Wt,allowPaymentRequest:Wt,allowUserMedia:Wt,alt:null,as:null,async:Wt,autoCapitalize:null,autoComplete:Tn,autoFocus:Wt,autoPlay:Wt,blocking:Tn,capture:null,charSet:null,checked:Wt,cite:null,className:Tn,cols:rt,colSpan:null,content:null,contentEditable:Xn,controls:Wt,controlsList:Tn,coords:rt|bl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Wt,defer:Wt,dir:null,dirName:null,disabled:Wt,download:Nb,draggable:Xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Wt,formTarget:null,headers:Tn,height:rt,hidden:Nb,high:rt,href:null,hrefLang:null,htmlFor:Tn,httpEquiv:Tn,id:null,imageSizes:null,imageSrcSet:null,inert:Wt,inputMode:null,integrity:null,is:null,isMap:Wt,itemId:null,itemProp:Tn,itemRef:Tn,itemScope:Wt,itemType:Tn,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:Tn,placeholder:null,playsInline:Wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Wt,referrerPolicy:null,rel:Tn,required:Wt,reversed:Wt,rows:rt,rowSpan:rt,sandbox:Tn,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:Tn,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:sN}),cP=Ol({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:Xs,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:Tn,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:bl,g2:bl,glyphName:bl,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:Xs,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:Tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:rt,pointsAtY:rt,pointsAtZ:rt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xs,rev:Xs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xs,requiredFeatures:Xs,requiredFonts:Xs,requiredFormats:Xs,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:Xs,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:Xs,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:Xs,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:nN}),aN=Ol({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()}}),rN=Ol({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sN}),iN=Ol({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),uP={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"},dP=/[A-Z]/g,pS=/-[a-z]/g,fP=/^data[-\w.:]+$/i;function pP(t,e){const n=jb(e);let s=e,a=$s;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&fP.test(e)){if(e.charAt(4)==="-"){const r=e.slice(5).replace(pS,mP);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=e.slice(4);if(!pS.test(r)){let i=r.replace(dP,hP);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}a=gx}return new a(s,e)}function hP(t){return"-"+t.toLowerCase()}function mP(t){return t.charAt(1).toUpperCase()}const gP=eN([tN,lP,aN,rN,iN],"html"),bx=eN([tN,cP,aN,rN,iN],"svg");function bP(t){return t.join(" ").trim()}var sl={},gg,hS;function xP(){if(hS)return gg;hS=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(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var N=1,j=1;function _(U){var L=U.match(e);L&&(N+=L.length);var F=U.lastIndexOf(d);j=~F?U.length-F:j+U.length}function D(){var U={line:N,column:j};return function(L){return L.position=new E(U),T(),L}}function E(U){this.start=U,this.end={line:N,column:j},this.source=k.source}E.prototype.content=C;function I(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=C,!k.silent)throw L}function O(U){var L=U.exec(C);if(L){var F=L[0];return _(F),C=C.slice(F.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!=C.charAt(0)||h!=C.charAt(1))){for(var L=2;m!=C.charAt(L)&&(h!=C.charAt(L)||f!=C.charAt(L+1));)++L;if(L+=2,m===C.charAt(L-1))return I("End of comment missing");var F=C.slice(2,L-2);return j+=2,_(F),C=C.slice(L),j+=2,U({type:x,comment:F})}}function B(){var U=D(),L=O(s);if(L){if(R(),!O(a))return I("property missing ':'");var F=O(r),W=U({type:y,property:S(L[0].replace(t,m)),value:F?S(F[0].replace(t,m)):m});return O(i),W}}function $(){var U=[];M(U);for(var L;L=B();)L!==!1&&(U.push(L),M(U));return U}return T(),$()}function S(C){return C?C.replace(c,m):m}return gg=v,gg}var mS;function yP(){if(mS)return sl;mS=1;var t=sl&&sl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(sl,"__esModule",{value:!0}),sl.default=n;const e=t(xP());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 sl}var Bc={},gS;function vP(){if(gS)return Bc;gS=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.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 Bc.camelCase=d,Bc}var Fc,bS;function wP(){if(bS)return Fc;bS=1;var t=Fc&&Fc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},e=t(yP()),n=vP();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,Fc=s,Fc}var kP=wP();const SP=ju(kP),oN=lN("end"),xx=lN("start");function lN(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 CP(t){const e=xx(t),n=oN(t);if(e&&n)return{start:e,end:n}}function ou(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?xS(t.position):"start"in t||"end"in t?xS(t):"line"in t||"column"in t?_b(t):""}function _b(t){return yS(t&&t.line)+":"+yS(t&&t.column)}function xS(t){return _b(t&&t.start)+"-"+_b(t&&t.end)}function yS(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=ou(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 yx={}.hasOwnProperty,AP=new Map,jP=/[A-Z]/g,NP=new Set(["table","tbody","thead","tfoot","tr"]),TP=new Set(["td","th"]),cN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _P(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=IP(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=PP(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"?bx:gP,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},r=uN(a,t,void 0);return r&&typeof r!="string"?r:a.create(t,a.Fragment,{children:r||void 0},void 0)}function uN(t,e,n){if(e.type==="element")return EP(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return MP(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return RP(t,e,n);if(e.type==="mdxjsEsm")return DP(t,e);if(e.type==="root")return OP(t,e,n);if(e.type==="text")return LP(t,e)}function EP(t,e,n){const s=t.schema;let a=s;e.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=bx,t.schema=a),t.ancestors.push(e);const r=fN(t,e.tagName,!1),i=BP(t,e);let c=wx(t,e);return NP.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!iP(d):!0})),dN(t,i,r,e),vx(i,c),t.ancestors.pop(),t.schema=s,t.create(e,r,i,n)}function MP(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)}wu(t,e.position)}function DP(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);wu(t,e.position)}function RP(t,e,n){const s=t.schema;let a=s;e.name==="svg"&&s.space==="html"&&(a=bx,t.schema=a),t.ancestors.push(e);const r=e.name===null?t.Fragment:fN(t,e.name,!0),i=FP(t,e),c=wx(t,e);return dN(t,i,r,e),vx(i,c),t.ancestors.pop(),t.schema=s,t.create(e,r,i,n)}function OP(t,e,n){const s={};return vx(s,wx(t,e)),t.create(e,t.Fragment,s,n)}function LP(t,e){return e.value}function dN(t,e,n,s){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=s)}function vx(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function PP(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 IP(t,e){return n;function n(s,a,r,i){const c=Array.isArray(r.children),d=xx(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 BP(t,e){const n={};let s,a;for(a in e.properties)if(a!=="children"&&yx.call(e.properties,a)){const r=zP(t,a,e.properties[a]);if(r){const[i,c]=r;t.tableCellAlignToStyle&&i==="align"&&typeof c=="string"&&TP.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 FP(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 wu(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 wu(t,e.position);else r=s.value===null?!0:s.value;n[a]=r}return n}function wx(t,e){const n=[];let s=-1;const a=t.passKeys?new Map:AP;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=uN(t,r,i);c!==void 0&&n.push(c)}return n}function zP(t,e,n){const s=pP(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?tP(n):bP(n)),s.property==="style"){let a=typeof n=="object"?n:$P(t,String(n));return t.stylePropertyNameCase==="css"&&(a=HP(a)),["style",a]}return[t.elementAttributeNameCase==="react"&&s.space?uP[s.property]||s.property:s.attribute,n]}}function $P(t,e){try{return SP(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=cN+"#cannot-parse-style-attribute",a}}function fN(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=uS(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=uS(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(s.type==="Literal"){const a=s.value;return yx.call(t.components,a)?t.components[a]:a}if(t.evaluater)return t.evaluater.evaluateExpression(s);wu(t)}function wu(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=cN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function HP(t){const e={};let n;for(n in t)yx.call(t,n)&&(e[UP(n)]=t[n]);return e}function UP(t){let e=t.replace(jP,WP);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function WP(t){return"-"+t.toLowerCase()}const bg={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"]},qP={};function kx(t,e){const n=qP,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pN(t,s,a)}function pN(t,e,n){if(VP(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 vS(t.children,e,n)}return Array.isArray(t)?vS(t,e,n):""}function vS(t,e,n){const s=[];let a=-1;for(;++a<t.length;)s[a]=pN(t[a],e,n);return s.join("")}function VP(t){return!!(t&&typeof t=="object")}const wS=document.createElement("i");function Sx(t){const e="&"+t+";";wS.innerHTML=e;const n=wS.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function sa(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 ba(t,e){return t.length>0?(sa(t,t.length,0,e),t):e}const kS={}.hasOwnProperty;function hN(t){const e={};let n=-1;for(;++n<t.length;)GP(e,t[n]);return e}function GP(t,e){let n;for(n in e){const a=(kS.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let i;if(r)for(i in r){kS.call(a,i)||(a[i]=[]);const c=r[i];YP(a[i],Array.isArray(c)?c:c?[c]:[])}}}function YP(t,e){let n=-1;const s=[];for(;++n<e.length;)(e[n].add==="after"?t:s).push(e[n]);sa(t,0,0,s)}function mN(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 Ma(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const As=Ti(/[A-Za-z]/),ys=Ti(/[\dA-Za-z]/),KP=Ti(/[#-'*+\--9=?A-Z^-~]/);function qf(t){return t!==null&&(t<32||t===127)}const Eb=Ti(/\d/),QP=Ti(/[\dA-Fa-f]/),XP=Ti(/[!-/:-@[-`{-~]/);function Rt(t){return t!==null&&t<-2}function jn(t){return t!==null&&(t<0||t===32)}function Zt(t){return t===-2||t===-1||t===32}const Sp=Ti(new RegExp("\\p{P}|\\p{S}","u")),ho=Ti(/\s/);function Ti(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ll(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 JP={tokenize:ZP};function ZP(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 Rt(c)?(t.consume(c),t.exit("chunkText"),r):(t.consume(c),i)}}const eI={tokenize:tI},SS={tokenize:nI};function tI(t){const e=this,n=[];let s=0,a,r,i;return c;function c(j){if(s<n.length){const _=n[s];return e.containerState=_[1],t.attempt(_[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.events.length;let D=_,E;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){E=e.events[D][1].end;break}k(s);let I=_;for(;I<e.events.length;)e.events[I][1].end={...E},I++;return sa(e.events,D+1,0,e.events.slice(_)),e.events.length=I,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(SS,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(SS,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){C(t.exit("chunkFlow"),!0),k(0),t.consume(j);return}return Rt(j)?(t.consume(j),C(t.exit("chunkFlow")),s=0,e.interrupt=void 0,c):(t.consume(j),S)}function C(j,_){const D=e.sliceStream(j);if(_&&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 E=a.events.length;for(;E--;)if(a.events[E][1].start.offset<i&&(!a.events[E][1].end||a.events[E][1].end.offset>i))return;const I=e.events.length;let O=I,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),E=I;E<e.events.length;)e.events[E][1].end={...M},E++;sa(e.events,O+1,0,e.events.slice(I)),e.events.length=E}}function k(j){let _=n.length;for(;_-- >j;){const D=n[_];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 nI(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 kl(t){if(t===null||jn(t)||ho(t))return 1;if(Sp(t))return 2}function Cp(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 Mb={name:"attention",resolveAll:sI,tokenize:aI};function sI(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};CS(m,-d),CS(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=ba(f,[["enter",t[s][1],e],["exit",t[s][1],e]])),f=ba(f,[["enter",a,e],["enter",i,e],["exit",i,e],["enter",r,e]]),f=ba(f,Cp(e.parser.constructs.insideSpan.null,t.slice(s+1,n),e)),f=ba(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=ba(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,sa(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 aI(t,e){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=kl(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=kl(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 CS(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const rI={name:"autolink",tokenize:iI};function iI(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 As(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):KP(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 Eu={partial:!0,tokenize:oI};function oI(t,e,n){return s;function s(r){return Zt(r)?on(t,a,"linePrefix")(r):a(r)}function a(r){return r===null||Rt(r)?e(r):n(r)}}const gN={continuation:{tokenize:cI},exit:uI,name:"blockQuote",tokenize:lI};function lI(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 cI(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(gN,e,n)(i)}}function uI(t){t.exit("blockQuote")}const bN={name:"characterEscape",tokenize:dI};function dI(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 XP(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}const xN={name:"characterReference",tokenize:fI};function fI(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=QP,h):(t.enter("characterReferenceValue"),r=7,i=Eb,h(m))}function h(m){if(m===59&&a){const x=t.exit("characterReferenceValue");return i===ys&&!Sx(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 AS={partial:!0,tokenize:hI},jS={concrete:!0,name:"codeFenced",tokenize:pI};function pI(t,e,n){const s=this,a={partial:!0,tokenize:D};let r=0,i=0,c;return d;function d(E){return f(E)}function f(E){const I=s.events[s.events.length-1];return r=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,c=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(E)}function h(E){return E===c?(i++,t.consume(E),h):i<3?n(E):(t.exit("codeFencedFenceSequence"),Zt(E)?on(t,m,"whitespace")(E):m(E))}function m(E){return E===null||Rt(E)?(t.exit("codeFencedFence"),s.interrupt?e(E):t.check(AS,S,_)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===null||Rt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(E)):Zt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),on(t,y,"whitespace")(E)):E===96&&E===c?n(E):(t.consume(E),x)}function y(E){return E===null||Rt(E)?m(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===null||Rt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(E)):E===96&&E===c?n(E):(t.consume(E),v)}function S(E){return t.attempt(a,_,C)(E)}function C(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),k}function k(E){return r>0&&Zt(E)?on(t,N,"linePrefix",r+1)(E):N(E)}function N(E){return E===null||Rt(E)?t.check(AS,S,_)(E):(t.enter("codeFlowValue"),j(E))}function j(E){return E===null||Rt(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),j)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,I,O){let T=0;return M;function M(L){return E.enter("lineEnding"),E.consume(L),E.exit("lineEnding"),R}function R(L){return E.enter("codeFencedFence"),Zt(L)?on(E,B,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):B(L)}function B(L){return L===c?(E.enter("codeFencedFenceSequence"),$(L)):O(L)}function $(L){return L===c?(T++,E.consume(L),$):T>=i?(E.exit("codeFencedFenceSequence"),Zt(L)?on(E,U,"whitespace")(L):U(L)):O(L)}function U(L){return L===null||Rt(L)?(E.exit("codeFencedFence"),I(L)):O(L)}}}function hI(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 xg={name:"codeIndented",tokenize:gI},mI={partial:!0,tokenize:bI};function gI(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):Rt(f)?t.attempt(mI,i,d)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||Rt(f)?(t.exit("codeFlowValue"),i(f)):(t.consume(f),c)}function d(f){return t.exit("codeIndented"),e(f)}}function bI(t,e,n){const s=this;return a;function a(i){return s.parser.lazy[s.now().line]?n(i):Rt(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):Rt(i)?a(i):n(i)}}const xI={name:"codeText",previous:vI,resolve:yI,tokenize:wI};function yI(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 vI(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wI(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)):Rt(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||Rt(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 kI{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&&zc(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),zc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),zc(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);zc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);zc(this.left,n.reverse())}}}function zc(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 yN(t){const e={};let n=-1,s,a,r,i,c,d,f;const h=new kI(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,SI(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 sa(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!f}function SI(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 C=[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,C.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):C.pop(),x=C.length;x--;){const k=c.slice(C[x],C[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 CI={resolve:jI,tokenize:NI},AI={partial:!0,tokenize:TI};function jI(t){return yN(t),t}function NI(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):Rt(c)?t.check(AI,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 TI(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||Rt(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 vN(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||Rt(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||jn(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?C:S)}function C(k){return k===40||k===41||k===92?(t.consume(k),S):S(k)}}function wN(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):Rt(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||Rt(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 kN(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):Rt(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||Rt(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 lu(t,e){let n;return s;function s(a){return Rt(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 _I={name:"definition",tokenize:MI},EI={partial:!0,tokenize:DI};function MI(t,e,n){const s=this;let a;return r;function r(y){return t.enter("definition"),i(y)}function i(y){return wN.call(s,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return a=Ma(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 jn(y)?lu(t,f)(y):f(y)}function f(y){return vN(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return t.attempt(EI,m,m)(y)}function m(y){return Zt(y)?on(t,x,"whitespace")(y):x(y)}function x(y){return y===null||Rt(y)?(t.exit("definition"),s.parser.defined.push(a),e(y)):n(y)}}function DI(t,e,n){return s;function s(c){return jn(c)?lu(t,a)(c):n(c)}function a(c){return kN(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||Rt(c)?e(c):n(c)}}const RI={name:"hardBreakEscape",tokenize:OI};function OI(t,e,n){return s;function s(r){return t.enter("hardBreakEscape"),t.consume(r),a}function a(r){return Rt(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}const LI={name:"headingAtx",resolve:PI,tokenize:II};function PI(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"},sa(t,s,n-s+1,[["enter",a,e],["enter",r,e],["exit",r,e],["exit",a,e]])),t}function II(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||jn(h)?(t.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(t.enter("atxHeadingSequence"),d(h)):h===null||Rt(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||jn(h)?(t.exit("atxHeadingText"),c(h)):(t.consume(h),f)}}const BI=["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"],NS=["pre","script","style","textarea"],FI={concrete:!0,name:"htmlFlow",resolveTo:HI,tokenize:UI},zI={partial:!0,tokenize:qI},$I={partial:!0,tokenize:WI};function HI(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 UI(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:z):As(q)?(t.consume(q),i=String.fromCharCode(q),C):n(q)}function x(q){return q===45?(t.consume(q),a=2,y):q===91?(t.consume(q),a=5,c=0,v):As(q)?(t.consume(q),a=4,s.interrupt?e:z):n(q)}function y(q){return q===45?(t.consume(q),s.interrupt?e:z):n(q)}function v(q){const xe="CDATA[";return q===xe.charCodeAt(c++)?(t.consume(q),c===xe.length?s.interrupt?e:B:v):n(q)}function S(q){return As(q)?(t.consume(q),i=String.fromCharCode(q),C):n(q)}function C(q){if(q===null||q===47||q===62||jn(q)){const xe=q===47,de=i.toLowerCase();return!xe&&!r&&NS.includes(de)?(a=1,s.interrupt?e(q):B(q)):BI.includes(i.toLowerCase())?(a=6,xe?(t.consume(q),k):s.interrupt?e(q):B(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),C):n(q)}function k(q){return q===62?(t.consume(q),s.interrupt?e:B):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||As(q)?(t.consume(q),_):Zt(q)?(t.consume(q),j):M(q)}function _(q){return q===45||q===46||q===58||q===95||ys(q)?(t.consume(q),_):D(q)}function D(q){return q===61?(t.consume(q),E):Zt(q)?(t.consume(q),D):j(q)}function E(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(t.consume(q),d=q,I):Zt(q)?(t.consume(q),E):O(q)}function I(q){return q===d?(t.consume(q),d=null,T):q===null||Rt(q)?n(q):(t.consume(q),I)}function O(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||jn(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||Rt(q)?B(q):Zt(q)?(t.consume(q),R):n(q)}function B(q){return q===45&&a===2?(t.consume(q),F):q===60&&a===1?(t.consume(q),W):q===62&&a===4?(t.consume(q),Q):q===63&&a===3?(t.consume(q),z):q===93&&a===5?(t.consume(q),Y):Rt(q)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(zI,K,$)(q)):q===null||Rt(q)?(t.exit("htmlFlowData"),$(q)):(t.consume(q),B)}function $(q){return t.check($I,U,K)(q)}function U(q){return t.enter("lineEnding"),t.consume(q),t.exit("lineEnding"),L}function L(q){return q===null||Rt(q)?$(q):(t.enter("htmlFlowData"),B(q))}function F(q){return q===45?(t.consume(q),z):B(q)}function W(q){return q===47?(t.consume(q),i="",V):B(q)}function V(q){if(q===62){const xe=i.toLowerCase();return NS.includes(xe)?(t.consume(q),Q):B(q)}return As(q)&&i.length<8?(t.consume(q),i+=String.fromCharCode(q),V):B(q)}function Y(q){return q===93?(t.consume(q),z):B(q)}function z(q){return q===62?(t.consume(q),Q):q===45&&a===2?(t.consume(q),z):B(q)}function Q(q){return q===null||Rt(q)?(t.exit("htmlFlowData"),K(q)):(t.consume(q),Q)}function K(q){return t.exit("htmlFlow"),e(q)}}function WI(t,e,n){const s=this;return a;function a(i){return Rt(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 qI(t,e,n){return s;function s(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(Eu,e,n)}}const VI={name:"htmlText",tokenize:GI};function GI(t,e,n){const s=this;let a,r,i;return c;function c(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),d}function d(z){return z===33?(t.consume(z),f):z===47?(t.consume(z),D):z===63?(t.consume(z),j):As(z)?(t.consume(z),O):n(z)}function f(z){return z===45?(t.consume(z),h):z===91?(t.consume(z),r=0,v):As(z)?(t.consume(z),N):n(z)}function h(z){return z===45?(t.consume(z),y):n(z)}function m(z){return z===null?n(z):z===45?(t.consume(z),x):Rt(z)?(i=m,W(z)):(t.consume(z),m)}function x(z){return z===45?(t.consume(z),y):m(z)}function y(z){return z===62?F(z):z===45?x(z):m(z)}function v(z){const Q="CDATA[";return z===Q.charCodeAt(r++)?(t.consume(z),r===Q.length?S:v):n(z)}function S(z){return z===null?n(z):z===93?(t.consume(z),C):Rt(z)?(i=S,W(z)):(t.consume(z),S)}function C(z){return z===93?(t.consume(z),k):S(z)}function k(z){return z===62?F(z):z===93?(t.consume(z),k):S(z)}function N(z){return z===null||z===62?F(z):Rt(z)?(i=N,W(z)):(t.consume(z),N)}function j(z){return z===null?n(z):z===63?(t.consume(z),_):Rt(z)?(i=j,W(z)):(t.consume(z),j)}function _(z){return z===62?F(z):j(z)}function D(z){return As(z)?(t.consume(z),E):n(z)}function E(z){return z===45||ys(z)?(t.consume(z),E):I(z)}function I(z){return Rt(z)?(i=I,W(z)):Zt(z)?(t.consume(z),I):F(z)}function O(z){return z===45||ys(z)?(t.consume(z),O):z===47||z===62||jn(z)?T(z):n(z)}function T(z){return z===47?(t.consume(z),F):z===58||z===95||As(z)?(t.consume(z),M):Rt(z)?(i=T,W(z)):Zt(z)?(t.consume(z),T):F(z)}function M(z){return z===45||z===46||z===58||z===95||ys(z)?(t.consume(z),M):R(z)}function R(z){return z===61?(t.consume(z),B):Rt(z)?(i=R,W(z)):Zt(z)?(t.consume(z),R):T(z)}function B(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),a=z,$):Rt(z)?(i=B,W(z)):Zt(z)?(t.consume(z),B):(t.consume(z),U)}function $(z){return z===a?(t.consume(z),a=void 0,L):z===null?n(z):Rt(z)?(i=$,W(z)):(t.consume(z),$)}function U(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||jn(z)?T(z):(t.consume(z),U)}function L(z){return z===47||z===62||jn(z)?T(z):n(z)}function F(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function W(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),V}function V(z){return Zt(z)?on(t,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):Y(z)}function Y(z){return t.enter("htmlTextData"),i(z)}}const Cx={name:"labelEnd",resolveAll:XI,resolveTo:JI,tokenize:ZI},YI={tokenize:eB},KI={tokenize:tB},QI={tokenize:nB};function XI(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&&sa(t,0,t.length,n),t}function JI(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=ba(c,t.slice(r+1,r+s+3)),c=ba(c,[["enter",h,e]]),c=ba(c,Cp(e.parser.constructs.insideSpan.null,t.slice(r+s+4,i-3),e)),c=ba(c,[["exit",h,e],t[i-2],t[i-1],["exit",f,e]]),c=ba(c,t.slice(i+1)),c=ba(c,[["exit",d,e]]),sa(t,r,t.length,c),t}function ZI(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(Ma(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(YI,h,i?h:m)(x):x===91?t.attempt(KI,h,i?f:m)(x):i?h(x):m(x)}function f(x){return t.attempt(QI,h,m)(x)}function h(x){return e(x)}function m(x){return r._balanced=!0,n(x)}}function eB(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 jn(m)?lu(t,r)(m):r(m)}function r(m){return m===41?h(m):vN(t,i,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function i(m){return jn(m)?lu(t,d)(m):h(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?kN(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function f(m){return jn(m)?lu(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 tB(t,e,n){const s=this;return a;function a(c){return wN.call(s,t,r,i,"reference","referenceMarker","referenceString")(c)}function r(c){return s.parser.defined.includes(Ma(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function i(c){return n(c)}}function nB(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 sB={name:"labelStartImage",resolveAll:Cx.resolveAll,tokenize:aB};function aB(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 rB={name:"labelStartLink",resolveAll:Cx.resolveAll,tokenize:iB};function iB(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 yg={name:"lineEnding",tokenize:oB};function oB(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:lB};function lB(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||Rt(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 Is={continuation:{tokenize:fB},exit:hB,name:"list",tokenize:dB},cB={partial:!0,tokenize:mB},uB={partial:!0,tokenize:pB};function dB(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:Eb(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 Eb(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(Eu,s.interrupt?n:h,t.attempt(cB,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 fB(t,e,n){const s=this;return s.containerState._closeFlow=void 0,t.check(Eu,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(uB,e,i)(c))}function i(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,on(t,t.attempt(Is,e,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function pB(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 hB(t){t.exit(this.containerState.type)}function mB(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 TS={name:"setextUnderline",resolveTo:gB,tokenize:bB};function gB(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 bB(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||Rt(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const xB={tokenize:yB};function yB(t){const e=this,n=t.attempt(Eu,s,t.attempt(this.parser.constructs.flowInitial,a,on(t,t.attempt(this.parser.constructs.flow,a,t.attempt(CI,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 vB={resolveAll:CN()},wB=SN("string"),kB=SN("text");function SN(t){return{resolveAll:CN(t==="text"?SB: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 CN(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 SB(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 CB={42:Is,43:Is,45:Is,48:Is,49:Is,50:Is,51:Is,52:Is,53:Is,54:Is,55:Is,56:Is,57:Is,62:gN},AB={91:_I},jB={[-2]:xg,[-1]:xg,32:xg},NB={35:LI,42:Cf,45:[TS,Cf],60:FI,61:TS,95:Cf,96:jS,126:jS},TB={38:xN,92:bN},_B={[-5]:yg,[-4]:yg,[-3]:yg,33:sB,38:xN,42:Mb,60:[rI,VI],91:rB,92:[RI,bN],93:Cx,95:Mb,96:xI},EB={null:[Mb,vB]},MB={null:[42,95]},DB={null:[]},RB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:MB,contentInitial:AB,disable:DB,document:CB,flow:NB,flowInitial:jB,insideSpan:EB,string:TB,text:_B},Symbol.toStringTag,{value:"Module"}));function OB(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:I(D),check:I(E),consume:N,enter:j,exit:_,interrupt:I(E,{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=ba(i,R),C(),i[i.length-1]!==null?[]:(O(e,0),f.events=Cp(r,f.events,f),f.events)}function x(R,B){return PB(y(R),B)}function y(R){return LB(i,R)}function v(){const{_bufferIndex:R,_index:B,line:$,column:U,offset:L}=s;return{_bufferIndex:R,_index:B,line:$,column:U,offset:L}}function S(R){a[R.line]=R.column,M()}function C(){let R;for(;s._index<i.length;){const B=i[s._index];if(typeof B=="string")for(R=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===R&&s._bufferIndex<B.length;)k(B.charCodeAt(s._bufferIndex));else k(B)}}function k(R){h=h(R)}function N(R){Rt(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,B){const $=B||{};return $.type=R,$.start=v(),f.events.push(["enter",$,f]),c.push($),$}function _(R){const B=c.pop();return B.end=v(),f.events.push(["exit",B,f]),B}function D(R,B){O(R,B.from)}function E(R,B){B.restore()}function I(R,B){return $;function $(U,L,F){let W,V,Y,z;return Array.isArray(U)?K(U):"tokenize"in U?K([U]):Q(U);function Q(ee){return fe;function fe(je){const ge=je!==null&&ee[je],Ee=je!==null&&ee.null,Be=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(Ee)?Ee:Ee?[Ee]:[]];return K(Be)(je)}}function K(ee){return W=ee,V=0,ee.length===0?F:q(ee[V])}function q(ee){return fe;function fe(je){return z=T(),Y=ee,ee.partial||(f.currentConstruct=ee),ee.name&&f.parser.constructs.disable.null.includes(ee.name)?de():ee.tokenize.call(B?Object.assign(Object.create(f),B):f,d,xe,de)(je)}}function xe(ee){return R(Y,z),L}function de(ee){return z.restore(),++V<W.length?q(W[V]):F}}}function O(R,B){R.resolveAll&&!r.includes(R)&&r.push(R),R.resolve&&sa(f.events,B,f.events.length-B,R.resolve(f.events.slice(B),f)),R.resolveTo&&(f.events=R.resolveTo(f.events,f))}function T(){const R=v(),B=f.previous,$=f.currentConstruct,U=f.events.length,L=Array.from(c);return{from:U,restore:F};function F(){s=R,f.previous=B,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 LB(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 PB(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 IB(t){const s={constructs:hN([RB,...(t||{}).extensions||[]]),content:a(JP),defined:[],document:a(eI),flow:a(xB),lazy:{},string:a(wB),text:a(kB)};return s;function a(r){return i;function i(c){return OB(s,r,c)}}}function BB(t){for(;!yN(t););return t}const _S=/[\0\t\n\r]/g;function FB(){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(_S.lastIndex=m,f=_S.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 zB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $B(t){return t.replace(zB,HB)}function HB(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),r=a===120||a===88;return mN(n.slice(r?2:1),r?16:10)}return Sx(n)||t}const AN={}.hasOwnProperty;function UB(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),WB(n)(BB(IB(n).document().write(FB()(t,e,!0))))}function WB(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(Fe),autolinkProtocol:T,autolinkEmail:T,atxHeading:r(Te),blockQuote:r(Ee),characterEscape:T,characterReference:T,codeFenced:r(Be),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(Be,i),codeText:r(Ve,i),codeTextData:T,data:T,codeFlowValue:T,definition:r(J),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(ne),hardBreakEscape:r(qe),hardBreakTrailing:r(qe),htmlFlow:r(at,i),htmlFlowData:T,htmlText:r(at,i),htmlTextData:T,image:r(Se),label:i,link:r(Fe),listItem:r(he),listItemValue:x,listOrdered:r(ie,m),listUnordered:r(ie),paragraph:r(We),reference:q,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(Te),strong:r(st),thematicBreak:r(ue)},exit:{atxHeading:d(),atxHeadingSequence:D,autolink:d(),autolinkEmail:ge,autolinkProtocol:je,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:ee,characterReference:fe,codeFenced:d(C),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:M,codeIndented:d(k),codeText:d(L),codeTextData:M,data:M,definition:d(),definitionDestinationString:_,definitionLabelString:N,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(B),hardBreakTrailing:d(B),htmlFlow:d($),htmlFlowData:M,htmlText:d(U),htmlTextData:M,image:d(W),label:Y,labelText:V,lineEnding:R,link:d(F),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:xe,resourceDestinationString:z,resourceTitleString:Q,resource:K,setextHeading:d(O),setextHeadingLineSequence:I,setextHeadingText:E,strong:d(),thematicBreak:d()}};jN(e,(t||{}).mdastExtensions||[]);const n={};return s;function s(X){let ae={type:"root",children:[]};const we={stack:[ae],tokenStack:[],config:e,enter:c,exit:f,buffer:i,resume:h,data:n},Z=[];let ve=-1;for(;++ve<X.length;)if(X[ve][1].type==="listOrdered"||X[ve][1].type==="listUnordered")if(X[ve][0]==="enter")Z.push(ve);else{const He=Z.pop();ve=a(X,He,ve)}for(ve=-1;++ve<X.length;){const He=e[X[ve][0]];AN.call(He,X[ve][1].type)&&He[X[ve][1].type].call(Object.assign({sliceSerialize:X[ve][2].sliceSerialize},we),X[ve][1])}if(we.tokenStack.length>0){const He=we.tokenStack[we.tokenStack.length-1];(He[1]||ES).call(we,void 0,He[0])}for(ae.position={start:xi(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:xi(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},ve=-1;++ve<e.transforms.length;)ae=e.transforms[ve](ae)||ae;return ae}function a(X,ae,we){let Z=ae-1,ve=-1,He=!1,Pe,oe,Le,le;for(;++Z<=we;){const me=X[Z];switch(me[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{me[0]==="enter"?ve++:ve--,le=void 0;break}case"lineEndingBlank":{me[0]==="enter"&&(Pe&&!le&&!ve&&!Le&&(Le=Z),le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:le=void 0}if(!ve&&me[0]==="enter"&&me[1].type==="listItemPrefix"||ve===-1&&me[0]==="exit"&&(me[1].type==="listUnordered"||me[1].type==="listOrdered")){if(Pe){let se=Z;for(oe=void 0;se--;){const Re=X[se];if(Re[1].type==="lineEnding"||Re[1].type==="lineEndingBlank"){if(Re[0]==="exit")continue;oe&&(X[oe][1].type="lineEndingBlank",He=!0),Re[1].type="lineEnding",oe=se}else if(!(Re[1].type==="linePrefix"||Re[1].type==="blockQuotePrefix"||Re[1].type==="blockQuotePrefixWhitespace"||Re[1].type==="blockQuoteMarker"||Re[1].type==="listItemIndent"))break}Le&&(!oe||Le<oe)&&(Pe._spread=!0),Pe.end=Object.assign({},oe?X[oe][1].start:me[1].end),X.splice(oe||Z,0,["exit",Pe,me[2]]),Z++,we++}if(me[1].type==="listItemPrefix"){const se={type:"listItem",_spread:!1,start:Object.assign({},me[1].start),end:void 0};Pe=se,X.splice(Z,0,["enter",se,me[2]]),Z++,we++,Le=void 0,le=!0}}}return X[ae][1]._spread=He,we}function r(X,ae){return we;function we(Z){c.call(this,X(Z),Z),ae&&ae.call(this,Z)}}function i(){this.stack.push({type:"fragment",children:[]})}function c(X,ae,we){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([ae,we||void 0]),X.position={start:xi(ae.start),end:void 0}}function d(X){return ae;function ae(we){X&&X.call(this,we),f.call(this,we)}}function f(X,ae){const we=this.stack.pop(),Z=this.tokenStack.pop();if(Z)Z[0].type!==X.type&&(ae?ae.call(this,X,Z[0]):(Z[1]||ES).call(this,X,Z[0]));else throw new Error("Cannot close `"+X.type+"` ("+ou({start:X.start,end:X.end})+"): it’s not open");we.position.end=xi(X.end)}function h(){return kx(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(X){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function y(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=X}function v(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=X}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.value=X.replace(/(\r?\n|\r)$/g,"")}function N(X){const ae=this.resume(),we=this.stack[this.stack.length-1];we.label=ae,we.identifier=Ma(this.sliceSerialize(X)).toLowerCase()}function j(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.title=X}function _(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.url=X}function D(X){const ae=this.stack[this.stack.length-1];if(!ae.depth){const we=this.sliceSerialize(X).length;ae.depth=we}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function I(X){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function T(X){const we=this.stack[this.stack.length-1].children;let Z=we[we.length-1];(!Z||Z.type!=="text")&&(Z=ut(),Z.position={start:xi(X.start),end:void 0},we.push(Z)),this.stack.push(Z)}function M(X){const ae=this.stack.pop();ae.value+=this.sliceSerialize(X),ae.position.end=xi(X.end)}function R(X){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=ae.children[ae.children.length-1];we.position.end=xi(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ae.type)&&(T.call(this,X),M.call(this,X))}function B(){this.data.atHardBreak=!0}function $(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.value=X}function U(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.value=X}function L(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.value=X}function F(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ae,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function W(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ae,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function V(X){const ae=this.sliceSerialize(X),we=this.stack[this.stack.length-2];we.label=$B(ae),we.identifier=Ma(ae).toLowerCase()}function Y(){const X=this.stack[this.stack.length-1],ae=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Z=X.children;we.children=Z}else we.alt=ae}function z(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.url=X}function Q(){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.title=X}function K(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function xe(X){const ae=this.resume(),we=this.stack[this.stack.length-1];we.label=ae,we.identifier=Ma(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function de(X){this.data.characterReferenceType=X.type}function ee(X){const ae=this.sliceSerialize(X),we=this.data.characterReferenceType;let Z;we?(Z=mN(ae,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Z=Sx(ae);const ve=this.stack[this.stack.length-1];ve.value+=Z}function fe(X){const ae=this.stack.pop();ae.position.end=xi(X.end)}function je(X){M.call(this,X);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(X)}function ge(X){M.call(this,X);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(X)}function Ee(){return{type:"blockquote",children:[]}}function Be(){return{type:"code",lang:null,meta:null,value:""}}function Ve(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ne(){return{type:"emphasis",children:[]}}function Te(){return{type:"heading",depth:0,children:[]}}function qe(){return{type:"break"}}function at(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function Fe(){return{type:"link",title:null,url:"",children:[]}}function ie(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function he(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function We(){return{type:"paragraph",children:[]}}function st(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function ue(){return{type:"thematicBreak"}}}function xi(t){return{line:t.line,column:t.column,offset:t.offset}}function jN(t,e){let n=-1;for(;++n<e.length;){const s=e[n];Array.isArray(s)?jN(t,s):qB(t,s)}}function qB(t,e){let n;for(n in e)if(AN.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 ES(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ou({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ou({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ou({start:e.start,end:e.end})+") is still open")}function VB(t){const e=this;e.parser=n;function n(s){return UB(s,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function GB(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 YB(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
51
+ `}]}function KB(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 QB(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function XB(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function JB(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",s=String(e.identifier).toUpperCase(),a=Ll(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 ZB(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 eF(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function NN(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 tF(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return NN(t,e);const a={src:Ll(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 nF(t,e){const n={src:Ll(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 sF(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 aF(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return NN(t,e);const a={href:Ll(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 rF(t,e){const n={href:Ll(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 iF(t,e,n){const s=t.all(e),a=n?oF(n):TN(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 oF(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=TN(n[s])}return e}function TN(t){const e=t.spread;return e??t.children.length>1}function lF(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 cF(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function uF(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function dF(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function fF(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=xx(e.children[1]),d=oN(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 pF(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 hF(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const MS=9,DS=32;function mF(t){const e=String(t),n=/\r?\n|\r/g;let s=n.exec(e),a=0;const r=[];for(;s;)r.push(RS(e.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(e);return r.push(RS(e.slice(a),a>0,!1)),r.join("")}function RS(t,e,n){let s=0,a=t.length;if(e){let r=t.codePointAt(s);for(;r===MS||r===DS;)s++,r=t.codePointAt(s)}if(n){let r=t.codePointAt(a-1);for(;r===MS||r===DS;)a--,r=t.codePointAt(a-1)}return a>s?t.slice(s,a):""}function gF(t,e){const n={type:"text",value:mF(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function bF(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const xF={blockquote:GB,break:YB,code:KB,delete:QB,emphasis:XB,footnoteReference:JB,heading:ZB,html:eF,imageReference:tF,image:nF,inlineCode:sF,linkReference:aF,link:rF,listItem:iF,list:lF,paragraph:cF,root:uF,strong:dF,table:fF,tableCell:hF,tableRow:pF,text:gF,thematicBreak:bF,toml:nf,yaml:nf,definition:nf,footnoteDefinition:nf};function nf(){}const _N=-1,Ap=0,cu=1,Vf=2,Ax=3,jx=4,Nx=5,Tx=6,EN=7,MN=8,OS=typeof self=="object"?self:globalThis,yF=(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 Ap:case _N:return n(i,a);case cu:{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 Ax:return n(new Date(i),a);case jx:{const{source:c,flags:d}=i;return n(new RegExp(c,d),a)}case Nx:{const c=n(new Map,a);for(const[d,f]of i)c.set(s(d),s(f));return c}case Tx:{const c=n(new Set,a);for(const d of i)c.add(s(d));return c}case EN:{const{name:c,message:d}=i;return n(new OS[c](d),a)}case MN: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 OS[r](i),a)};return s},LS=t=>yF(new Map,t)(0),al="",{toString:vF}={},{keys:wF}=Object,$c=t=>{const e=typeof t;if(e!=="object"||!t)return[Ap,e];const n=vF.call(t).slice(8,-1);switch(n){case"Array":return[cu,al];case"Object":return[Vf,al];case"Date":return[Ax,al];case"RegExp":return[jx,al];case"Map":return[Nx,al];case"Set":return[Tx,al];case"DataView":return[cu,n]}return n.includes("Array")?[cu,n]:n.includes("Error")?[EN,n]:[Vf,n]},sf=([t,e])=>t===Ap&&(e==="function"||e==="symbol"),kF=(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]=$c(i);switch(c){case Ap:{let h=i;switch(d){case"bigint":c=MN,h=i.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return a([_N],i)}return a([c,h],i)}case cu:{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 wF(i))(t||!sf($c(i[x])))&&h.push([r(x),r(i[x])]);return m}case Ax:return a([c,i.toISOString()],i);case jx:{const{source:h,flags:m}=i;return a([c,{source:h,flags:m}],i)}case Nx:{const h=[],m=a([c,h],i);for(const[x,y]of i)(t||!(sf($c(x))||sf($c(y))))&&h.push([r(x),r(y)]);return m}case Tx:{const h=[],m=a([c,h],i);for(const x of i)(t||!sf($c(x)))&&h.push(r(x));return m}}const{message:f}=i;return a([c,{name:d,message:f}],i)};return r},PS=(t,{json:e,lossy:n}={})=>{const s=[];return kF(!(e||n),!!e,new Map,s)(t),s},Gf=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?LS(PS(t,e)):structuredClone(t):(t,e)=>LS(PS(t,e));function SF(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 CF(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function AF(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||SF,s=t.options.footnoteBackLabel||CF,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=Ll(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 C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const N=C.children[C.children.length-1];N&&N.type==="text"?N.value+=" ":C.children.push({type:"text",value:" "}),C.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 jp=(function(t){if(t==null)return _F;if(typeof t=="function")return Np(t);if(typeof t=="object")return Array.isArray(t)?jF(t):NF(t);if(typeof t=="string")return TF(t);throw new Error("Expected function, string, or object as test")});function jF(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=jp(t[n]);return Np(s);function s(...a){let r=-1;for(;++r<e.length;)if(e[r].apply(this,a))return!0;return!1}}function NF(t){const e=t;return Np(n);function n(s){const a=s;let r;for(r in t)if(a[r]!==e[r])return!1;return!0}}function TF(t){return Np(e);function e(n){return n&&n.type===t}}function Np(t){return e;function e(n,s,a){return!!(EF(n)&&t.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function _F(){return!0}function EF(t){return t!==null&&typeof t=="object"&&"type"in t}const DN=[],MF=!0,Db=!1,DF="skip";function RN(t,e,n,s){let a;typeof e=="function"&&typeof n!="function"?(s=n,n=e):a=e;const r=jp(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=DN,v,S,C;if((!e||r(d,f,h[h.length-1]||void 0))&&(y=RF(n(d,h)),y[0]===Db))return y;if("children"in d&&d.children){const k=d;if(k.children&&y[0]!==DF)for(S=(s?k.children.length:-1)+i,C=h.concat(k);S>-1&&S<k.children.length;){const N=k.children[S];if(v=c(N,S,C)(),v[0]===Db)return v;S=typeof v[1]=="number"?v[1]:S+i}}return y}}}function RF(t){return Array.isArray(t)?t:typeof t=="number"?[MF,t]:t==null?DN:[t]}function _x(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),RN(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 Rb={}.hasOwnProperty,OF={};function LF(t,e){const n=e||OF,s=new Map,a=new Map,r=new Map,i={...xF,...n.handlers},c={all:f,applyData:IF,definitionById:s,footnoteById:a,footnoteCounts:r,footnoteOrder:[],handlers:i,one:d,options:n,patch:PF,wrap:FF};return _x(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(Rb.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,...C}=h,k=Gf(C);return k.children=c.all(h),k}return Gf(h)}return(c.options.unknownHandler||BF)(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=IS(v.value)),!Array.isArray(v)&&v.type==="element")){const S=v.children[0];S&&S.type==="text"&&(S.value=IS(S.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function PF(t,e){t.position&&(e.position=CP(t))}function IF(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 BF(t,e){const n=e.data||{},s="value"in e&&!(Rb.call(n,"hProperties")||Rb.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 FF(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 IS(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function BS(t,e){const n=LF(t,e),s=n.one(t,void 0),a=AF(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 zF(t,e){return t&&"run"in t?async function(n,s){const a=BS(n,{file:s,...e});await t.run(a,s)}:function(n,s){return BS(n,{file:s,...t||e})}}function FS(t){if(t)throw t}var vg,zS;function $F(){if(zS)return vg;zS=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 vg=function d(){var f,h,m,x,y,v,S=arguments[0],C=1,k=arguments.length,N=!1;for(typeof S=="boolean"&&(N=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(f=arguments[C],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},vg}var HF=$F();const wg=ju(HF);function Ob(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 UF(){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?WF(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 WF(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 Wa={basename:qF,dirname:VF,extname:GF,join:YF,sep:"/"};function qF(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Mu(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 VF(t){if(Mu(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 GF(t){Mu(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 YF(...t){let e=-1,n;for(;++e<t.length;)Mu(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":KF(n)}function KF(t){Mu(t);const e=t.codePointAt(0)===47;let n=QF(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function QF(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 Mu(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const XF={cwd:JF};function JF(){return"/"}function Lb(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function ZF(t){if(typeof t=="string")t=new URL(t);else if(!Lb(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 e8(t)}function e8(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 kg=["history","path","basename","stem","extname","dirname"];class ON{constructor(e){let n;e?Lb(e)?n={path:e}:typeof e=="string"||t8(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":XF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<kg.length;){const r=kg[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)kg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Wa.basename(this.path):void 0}set basename(e){Cg(e,"basename"),Sg(e,"basename"),this.path=Wa.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Wa.dirname(this.path):void 0}set dirname(e){$S(this.basename,"dirname"),this.path=Wa.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Wa.extname(this.path):void 0}set extname(e){if(Sg(e,"extname"),$S(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=Wa.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Lb(e)&&(e=ZF(e)),Cg(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Wa.basename(this.path,this.extname):void 0}set stem(e){Cg(e,"stem"),Sg(e,"stem"),this.path=Wa.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 Sg(t,e){if(t&&t.includes(Wa.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Wa.sep+"`")}function Cg(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function $S(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function t8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const n8=(function(t){const s=this.constructor.prototype,a=s[t],r=function(){return a.apply(r,arguments)};return Object.setPrototypeOf(r,s),r}),s8={}.hasOwnProperty;class Ex extends n8{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=UF()}copy(){const e=new Ex;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];e.use(...s)}return e.data(wg(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Ng("data",this.frozen),this.namespace[e]=n,this):s8.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ng("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 Ag("parse",s),s(String(n),n)}process(e,n){const s=this;return this.freeze(),Ag("process",this.parser||this.Parser),jg("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);i8(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(),Ag("processSync",this.parser||this.Parser),jg("processSync",this.compiler||this.Compiler),this.process(e,a),US("processSync","process",n),s;function a(r,i){n=!0,FS(r),s=i}}run(e,n,s){HS(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),US("runSync","run",s),a;function r(i,c){FS(i),a=c,s=!0}}stringify(e,n){this.freeze();const s=af(n),a=this.compiler||this.Compiler;return jg("stringify",a),HS(e),a(e,s)}use(e,...n){const s=this.attachers,a=this.namespace;if(Ng("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=wg(!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];Ob(S)&&Ob(y)&&(y=wg(!0,S,y)),s[x]=[f,y,...v]}}}}const a8=new Ex().freeze();function Ag(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function jg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ng(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 HS(t){if(!Ob(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function US(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function af(t){return r8(t)?t:new ON(t)}function r8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function i8(t){return typeof t=="string"||o8(t)}function o8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const l8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",WS=[],qS={allowDangerousHtml:!0},c8=/^(https?|ircs?|mailto|xmpp)$/i,u8=[{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 Dr(t){const e=d8(t),n=f8(t);return p8(e.runSync(e.parse(n),n),t)}function d8(t){const e=t.rehypePlugins||WS,n=t.remarkPlugins||WS,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...qS}:qS;return a8().use(VB).use(n).use(zF,s).use(e)}function f8(t){const e=t.children||"",n=new ON;return typeof e=="string"&&(n.value=e),n}function p8(t,e){const n=e.allowedElements,s=e.allowElement,a=e.components,r=e.disallowedElements,i=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||h8;for(const h of u8)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+l8+h.id,void 0);return _x(t,f),_P(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 bg)if(Object.hasOwn(bg,y)&&Object.hasOwn(h.properties,y)){const v=h.properties[y],S=bg[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 h8(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||c8.test(t.slice(0,e))?t:""}function VS(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 m8(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function g8(t,e,n){const a=jp((n||{}).ignore||[]),r=b8(e);let i=-1;for(;++i<r.length;)RN(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 C=m.children.indexOf(f);let k=!1,N=[];x.lastIndex=0;let j=x.exec(f.value);for(;j;){const _=j.index,D={index:j.index,input:j.input,stack:[...h,f]};let E=y(...j,D);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?x.lastIndex=_+1:(v!==_&&N.push({type:"text",value:f.value.slice(v,_)}),Array.isArray(E)?N.push(...E):E&&N.push(E),v=_+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(C,1,...N)):N=[f],C+N.length}}function b8(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([x8(a[0]),y8(a[1])])}return e}function x8(t){return typeof t=="string"?new RegExp(m8(t),"g"):t}function y8(t){return typeof t=="function"?t:function(){return t}}const Tg="phrasing",_g=["autolink","link","image","label"];function v8(){return{transforms:[N8],enter:{literalAutolink:k8,literalAutolinkEmail:Eg,literalAutolinkHttp:Eg,literalAutolinkWww:Eg},exit:{literalAutolink:j8,literalAutolinkEmail:A8,literalAutolinkHttp:S8,literalAutolinkWww:C8}}}function w8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:_g},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tg,notInConstruct:_g},{character:":",before:"[ps]",after:"\\/",inConstruct:Tg,notInConstruct:_g}]}}function k8(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Eg(t){this.config.enter.autolinkProtocol.call(this,t)}function S8(t){this.config.exit.autolinkProtocol.call(this,t)}function C8(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 A8(t){this.config.exit.autolinkEmail.call(this,t)}function j8(t){this.exit(t)}function N8(t){g8(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,T8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),_8]],{ignore:["link","linkReference"]})}function T8(t,e,n,s,a){let r="";if(!LN(a)||(/^w/i.test(e)&&(n=e+n,e="",r="http://"),!E8(n)))return!1;const i=M8(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 _8(t,e,n,s){return!LN(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function E8(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 M8(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=VS(t,"(");let r=VS(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 LN(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||ho(n)||Sp(n))&&(!e||n!==47)}PN.peek=z8;function D8(){this.buffer()}function R8(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function O8(){this.buffer()}function L8(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function P8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ma(this.sliceSerialize(t)).toLowerCase(),n.label=e}function I8(t){this.exit(t)}function B8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ma(this.sliceSerialize(t)).toLowerCase(),n.label=e}function F8(t){this.exit(t)}function z8(){return"["}function PN(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 $8(){return{enter:{gfmFootnoteCallString:D8,gfmFootnoteCall:R8,gfmFootnoteDefinitionLabelString:O8,gfmFootnoteDefinition:L8},exit:{gfmFootnoteCallString:P8,gfmFootnoteCall:I8,gfmFootnoteDefinitionLabelString:B8,gfmFootnoteDefinition:F8}}}function H8(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:PN},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?IN:U8))),f(),d}}function U8(t,e,n){return e===0?t:IN(t,e,n)}function IN(t,e,n){return(n?"":" ")+t}const W8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];BN.peek=K8;function q8(){return{canContainEols:["delete"],enter:{strikethrough:G8},exit:{strikethrough:Y8}}}function V8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:W8}],handlers:{delete:BN}}}function G8(t){this.enter({type:"delete",children:[]},t)}function Y8(t){this.exit(t)}function BN(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 K8(){return"~"}function Q8(t){return t.length}function X8(t,e){const n=e||{},s=(n.align||[]).concat(),a=n.stringLength||Q8,r=[],i=[],c=[],d=[];let f=0,h=-1;for(;++h<t.length;){const S=[],C=[];let k=-1;for(t[h].length>f&&(f=t[h].length);++k<t[h].length;){const N=J8(t[h][k]);if(n.alignDelimiters!==!1){const j=a(N);C[k]=j,(d[k]===void 0||j>d[k])&&(d[k]=j)}S.push(N)}i[h]=S,c[h]=C}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)r[m]=GS(s[m]);else{const S=GS(s);for(;++m<f;)r[m]=S}m=-1;const x=[],y=[];for(;++m<f;){const S=r[m];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let N=n.alignDelimiters===!1?1:Math.max(1,d[m]-C.length-k.length);const j=C+"-".repeat(N)+k;n.alignDelimiters!==!1&&(N=C.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],C=c[h];m=-1;const k=[];for(;++m<f;){const N=S[m]||"";let j="",_="";if(n.alignDelimiters!==!1){const D=d[m]-(C[m]||0),E=r[m];E===114?j=" ".repeat(D):E===99?D%2?(j=" ".repeat(D/2+.5),_=" ".repeat(D/2-.5)):(j=" ".repeat(D/2),_=j):_=" ".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(_),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 J8(t){return t==null?"":String(t)}function GS(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 Z8(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()),e9);return a(),i}function e9(t,e,n){return">"+(n?"":" ")+t}function t9(t,e){return YS(t,e.inConstruct,!0)&&!YS(t,e.notInConstruct,!1)}function YS(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 KS(t,e,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
63
+ `&&t9(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
64
+ `}function n9(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 s9(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 a9(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 r9(t,e,n,s){const a=a9(n),r=t.value||"",i=a==="`"?"GraveAccent":"Tilde";if(s9(t,n)){const m=n.enter("codeIndented"),x=n.indentLines(r,i9);return m(),x}const c=n.createTracker(s),d=a.repeat(Math.max(n9(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 i9(t,e,n){return(n?"":" ")+t}function Mx(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 o9(t,e,n,s){const a=Mx(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 l9(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 ku(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Yf(t,e,n){const s=kl(t),a=kl(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}}FN.peek=c9;function FN(t,e,n,s){const a=l9(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=ku(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)+ku(m));const y=i.move(a);return r(),n.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+d+y}function c9(t,e,n){return n.options.emphasis||"*"}function u9(t,e){let n=!1;return _x(t,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Db}),!!((!t.depth||t.depth<3)&&kx(t)&&(e.options.setext||n))}function d9(t,e,n,s){const a=Math.max(Math.min(6,t.depth||1),1),r=n.createTracker(s);if(u9(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=ku(f.charCodeAt(0))+f.slice(1)),f=f?i+" "+f:i,n.options.closeAtx&&(f+=" "+i),d(),c(),f}zN.peek=f9;function zN(t){return t.value||""}function f9(){return"<"}$N.peek=p9;function $N(t,e,n,s){const a=Mx(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 p9(){return"!"}HN.peek=h9;function HN(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 h9(){return"!"}UN.peek=m9;function UN(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 m9(){return"`"}function WN(t,e){const n=kx(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))}qN.peek=g9;function qN(t,e,n,s){const a=Mx(n),r=a==='"'?"Quote":"Apostrophe",i=n.createTracker(s);let c,d;if(WN(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 g9(t,e,n){return WN(t,n)?"<":"["}VN.peek=b9;function VN(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 b9(){return"["}function Dx(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 x9(t){const e=Dx(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 y9(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 GN(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 v9(t,e,n,s){const a=n.enter("list"),r=n.bulletCurrent;let i=t.ordered?y9(n):Dx(n);const c=t.ordered?i==="."?")":".":x9(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),GN(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 w9(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 k9(t,e,n,s){const a=w9(n);let r=n.bulletCurrent||Dx(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 S9(t,e,n,s){const a=n.enter("paragraph"),r=n.enter("phrasing"),i=n.containerPhrasing(t,s);return r(),a(),i}const C9=jp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function A9(t,e,n,s){return(t.children.some(function(i){return C9(i)})?n.containerPhrasing:n.containerFlow).call(n,t,s)}function j9(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}YN.peek=N9;function YN(t,e,n,s){const a=j9(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=ku(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)+ku(m));const y=i.move(a+a);return r(),n.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+d+y}function N9(t,e,n){return n.options.strong||"*"}function T9(t,e,n,s){return n.safe(t.value,s)}function _9(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 E9(t,e,n){const s=(GN(n)+(n.options.ruleSpaces?" ":"")).repeat(_9(n));return n.options.ruleSpaces?s.slice(0,-1):s}const KN={blockquote:Z8,break:KS,code:r9,definition:o9,emphasis:FN,hardBreak:KS,heading:d9,html:zN,image:$N,imageReference:HN,inlineCode:UN,link:qN,linkReference:VN,list:v9,listItem:k9,paragraph:S9,root:A9,strong:YN,text:T9,thematicBreak:E9};function M9(){return{enter:{table:D9,tableData:QS,tableHeader:QS,tableRow:O9},exit:{codeText:L9,table:R9,tableData:Mg,tableHeader:Mg,tableRow:Mg}}}function D9(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 R9(t){this.exit(t),this.data.inTable=void 0}function O9(t){this.enter({type:"tableRow",children:[]},t)}function Mg(t){this.exit(t)}function QS(t){this.enter({type:"tableCell",children:[]},t)}function L9(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,P9));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function P9(t,e){return e==="|"?e:t}function I9(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,C){return f(h(y,S,C),y.align)}function c(y,v,S,C){const k=m(y,S,C),N=f([k]);return N.slice(0,N.indexOf(`
75
+ `))}function d(y,v,S,C){const k=S.enter("tableCell"),N=S.enter("phrasing"),j=S.containerPhrasing(y,{...C,before:r,after:r});return N(),k(),j}function f(y,v){return X8(y,{align:v,alignDelimiters:s,padding:n,stringLength:a})}function h(y,v,S){const C=y.children;let k=-1;const N=[],j=v.enter("table");for(;++k<C.length;)N[k]=m(C[k],v,S);return j(),N}function m(y,v,S){const C=y.children;let k=-1;const N=[],j=v.enter("tableRow");for(;++k<C.length;)N[k]=d(C[k],y,v,S);return j(),N}function x(y,v,S){let C=KN.inlineCode(y,v,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function B9(){return{exit:{taskListCheckValueChecked:XS,taskListCheckValueUnchecked:XS,paragraph:z9}}}function F9(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$9}}}function XS(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function z9(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 $9(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=KN.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 H9(){return[v8(),$8(),q8(),M9(),B9()]}function U9(t){return{extensions:[w8(),H8(t),V8(),I9(t),F9()]}}const W9={tokenize:Q9,partial:!0},QN={tokenize:X9,partial:!0},XN={tokenize:J9,partial:!0},JN={tokenize:Z9,partial:!0},q9={tokenize:e4,partial:!0},ZN={name:"wwwAutolink",tokenize:Y9,previous:t1},e1={name:"protocolAutolink",tokenize:K9,previous:n1},Fr={name:"emailAutolink",tokenize:G9,previous:s1},or={};function V9(){return{text:or}}let Ji=48;for(;Ji<123;)or[Ji]=Fr,Ji++,Ji===58?Ji=65:Ji===91&&(Ji=97);or[43]=Fr;or[45]=Fr;or[46]=Fr;or[95]=Fr;or[72]=[Fr,e1];or[104]=[Fr,e1];or[87]=[Fr,ZN];or[119]=[Fr,ZN];function G9(t,e,n){const s=this;let a,r;return i;function i(m){return!Pb(m)||!s1.call(s,s.previous)||Rx(s.events)?n(m):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(m))}function c(m){return Pb(m)?(t.consume(m),c):m===64?(t.consume(m),d):n(m)}function d(m){return m===46?t.check(q9,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&&As(s.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(m)):n(m)}}function Y9(t,e,n){const s=this;return a;function a(i){return i!==87&&i!==119||!t1.call(s,s.previous)||Rx(s.events)?n(i):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(W9,t.attempt(QN,t.attempt(XN,r),n),n)(i))}function r(i){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(i)}}function K9(t,e,n){const s=this;let a="",r=!1;return i;function i(m){return(m===72||m===104)&&n1.call(s,s.previous)&&!Rx(s.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),t.consume(m),c):n(m)}function c(m){if(As(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)||jn(m)||ho(m)||Sp(m)?n(m):t.attempt(QN,t.attempt(XN,h),n)(m)}function h(m){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(m)}}function Q9(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 X9(t,e,n){let s,a,r;return i;function i(f){return f===46||f===95?t.check(JN,d,c)(f):f===null||jn(f)||ho(f)||f!==45&&Sp(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 J9(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(JN,e,r)(i):i===null||jn(i)||ho(i)?e(i):(t.consume(i),a)}function r(i){return i===41&&s++,t.consume(i),a}}function Z9(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||jn(c)||ho(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||jn(c)||ho(c)?e(c):s(c)}function r(c){return As(c)?i(c):n(c)}function i(c){return c===59?(t.consume(c),s):As(c)?(t.consume(c),i):n(c)}}function e4(t,e,n){return s;function s(r){return t.consume(r),a}function a(r){return ys(r)?n(r):e(r)}}function t1(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||jn(t)}function n1(t){return!As(t)}function s1(t){return!(t===47||Pb(t))}function Pb(t){return t===43||t===45||t===46||t===95||ys(t)}function Rx(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 t4={tokenize:c4,partial:!0};function n4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:i4,continuation:{tokenize:o4},exit:l4}},text:{91:{name:"gfmFootnoteCall",tokenize:r4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:s4,resolveTo:a4}}}}function s4(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=Ma(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 a4(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 r4(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||jn(m))return n(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return a.includes(Ma(s.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return jn(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 i4(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||jn(v))return n(v);if(v===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return r=Ma(s.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return jn(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 o4(t,e,n){return t.check(Eu,e,t.attempt(t4,e,n))}function l4(t){t.exit("gfmFootnoteDefinition")}function c4(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 u4(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&&sa(x,x.length,0,Cp(y,i.slice(f+1,d),c)),sa(x,x.length,0,[["exit",m,c],["enter",i[d][1],c],["exit",i[d][1],c],["exit",h,c]]),sa(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=kl(f);if(v===126)return m>1?d(v):(i.consume(v),m++,y);if(m<2&&!n)return d(v);const C=i.exit("strikethroughSequenceTemporary"),k=kl(v);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,c(v)}}}class d4{constructor(){this.map=[]}add(e,n,s){f4(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 f4(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 p4(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 h4(){return{flow:{null:{name:"table",tokenize:m4,resolveAll:g4}}}}function m4(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 B=R>-1?s.events[R][1].type:null,$=B==="tableHead"||B==="tableRow"?E:d;return $===E&&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):Rt(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||jn(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?C(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,C,"whitespace")(M):C(M)}function C(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||Rt(M)?_(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,_,"whitespace")(M):_(M)}function _(M){return M===124?v(M):M===null||Rt(M)?!i||a!==r?D(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(M)):D(M)}function D(M){return n(M)}function E(M){return t.enter("tableRow"),I(M)}function I(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),I):M===null||Rt(M)?(t.exit("tableRow"),e(M)):Zt(M)?on(t,I,"whitespace")(M):(t.enter("data"),O(M))}function O(M){return M===null||M===124||jn(M)?(t.exit("data"),I(M)):(t.consume(M),M===92?T:O)}function T(M){return M===92||M===124?(t.consume(M),O):O(M)}}function g4(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 d4;for(;++n<t.length;){const y=t[n],v=y[1];y[0]==="enter"?v.type==="tableHead"?(c=!1,d!==0&&(JS(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&&JS(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=p4(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({},dl(e.events,n[0])),t.add(n[0],0,[["exit",r,e]]));const d=dl(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=dl(e.events,n[2]),h=dl(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({},dl(e.events,a)),t.add(a,0,[["exit",r,e]]),r=void 0),r}function JS(t,e,n,s,a){const r=[],i=dl(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 dl(t,e){const n=t[e],s=n[0]==="enter"?"start":"end";return n[1][s]}const b4={name:"tasklistCheck",tokenize:y4};function x4(){return{text:{91:b4}}}function y4(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 jn(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 Rt(d)?e(d):Zt(d)?t.check({tokenize:v4},e,n)(d):n(d)}}function v4(t,e,n){return on(t,s,"whitespace");function s(a){return a===null?n(a):e(a)}}function w4(t){return hN([V9(),n4(),u4(t),h4(),x4()])}const k4={};function Rr(t){const e=this,n=t||k4,s=e.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),i=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(w4(n)),r.push(H9()),i.push(U9(n))}var Dg={exports:{}},ZS;function S4(){return ZS||(ZS=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,"&amp;").replace(/</g,"&lt;").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,_){_=_||{};var D,E;switch(c.util.type(j)){case"Object":if(E=c.util.objId(j),_[E])return _[E];D={},_[E]=D;for(var I in j)j.hasOwnProperty(I)&&(D[I]=N(j[I],_));return D;case"Array":return E=c.util.objId(j),_[E]?_[E]:(D=[],_[E]=D,j.forEach(function(O,T){D[T]=N(O,_)}),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 _ in j)if(j[_].src==N)return j[_]}return null}},isActive:function(N,j,_){for(var D="no-"+j;N;){var E=N.classList;if(E.contains(j))return!0;if(E.contains(D))return!1;N=N.parentElement}return!!_}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(N,j){var _=c.util.clone(c.languages[N]);for(var D in j)_[D]=j[D];return _},insertBefore:function(N,j,_,D){D=D||c.languages;var E=D[N],I={};for(var O in E)if(E.hasOwnProperty(O)){if(O==j)for(var T in _)_.hasOwnProperty(T)&&(I[T]=_[T]);_.hasOwnProperty(O)||(I[O]=E[O])}var M=D[N];return D[N]=I,c.languages.DFS(c.languages,function(R,B){B===M&&R!=N&&(this[R]=I)}),I},DFS:function N(j,_,D,E){E=E||{};var I=c.util.objId;for(var O in j)if(j.hasOwnProperty(O)){_.call(j,O,j[O],D||O);var T=j[O],M=c.util.type(T);M==="Object"&&!E[I(T)]?(E[I(T)]=!0,N(T,_,null,E)):M==="Array"&&!E[I(T)]&&(E[I(T)]=!0,N(T,_,O,E))}}},plugins:{},highlightAll:function(N,j){c.highlightAllUnder(document,N,j)},highlightAllUnder:function(N,j,_){var D={callback:_,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 E=0,I;I=D.elements[E++];)c.highlightElement(I,j===!0,D.callback)},highlightElement:function(N,j,_){var D=c.util.getLanguage(N),E=c.languages[D];c.util.setLanguage(N,D);var I=N.parentElement;I&&I.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(I,D);var O=N.textContent,T={element:N,language:D,grammar:E,code:O};function M(B){T.highlightedCode=B,c.hooks.run("before-insert",T),T.element.innerHTML=T.highlightedCode,c.hooks.run("after-highlight",T),c.hooks.run("complete",T),_&&_.call(T.element)}if(c.hooks.run("before-sanity-check",T),I=T.element.parentElement,I&&I.nodeName.toLowerCase()==="pre"&&!I.hasAttribute("tabindex")&&I.setAttribute("tabindex","0"),!T.code){c.hooks.run("complete",T),_&&_.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(B){M(B.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,_){var D={code:N,grammar:j,language:_};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 _=j.rest;if(_){for(var D in _)j[D]=_[D];delete j.rest}var E=new m;return x(E,E.head,N),h(N,E,j,E.head,0),v(E)},hooks:{all:{},add:function(N,j){var _=c.hooks.all;_[N]=_[N]||[],_[N].push(j)},run:function(N,j){var _=c.hooks.all[N];if(!(!_||!_.length))for(var D=0,E;E=_[D++];)E(j)}},Token:d};s.Prism=c;function d(N,j,_,D){this.type=N,this.content=j,this.alias=_,this.length=(D||"").length|0}d.stringify=function N(j,_){if(typeof j=="string")return j;if(Array.isArray(j)){var D="";return j.forEach(function(M){D+=N(M,_)}),D}var E={type:j.type,content:N(j.content,_),tag:"span",classes:["token",j.type],attributes:{},language:_},I=j.alias;I&&(Array.isArray(I)?Array.prototype.push.apply(E.classes,I):E.classes.push(I)),c.hooks.run("wrap",E);var O="";for(var T in E.attributes)O+=" "+T+'="'+(E.attributes[T]||"").replace(/"/g,"&quot;")+'"';return"<"+E.tag+' class="'+E.classes.join(" ")+'"'+O+">"+E.content+"</"+E.tag+">"};function f(N,j,_,D){N.lastIndex=j;var E=N.exec(_);if(E&&D&&E[1]){var I=E[1].length;E.index+=I,E[0]=E[0].slice(I)}return E}function h(N,j,_,D,E,I){for(var O in _)if(!(!_.hasOwnProperty(O)||!_[O])){var T=_[O];T=Array.isArray(T)?T:[T];for(var M=0;M<T.length;++M){if(I&&I.cause==O+","+M)return;var R=T[M],B=R.inside,$=!!R.lookbehind,U=!!R.greedy,L=R.alias;if(U&&!R.pattern.global){var F=R.pattern.toString().match(/[imsuy]*$/)[0];R.pattern=RegExp(R.pattern.source,F+"g")}for(var W=R.pattern||R,V=D.next,Y=E;V!==j.tail&&!(I&&Y>=I.reach);Y+=V.value.length,V=V.next){var z=V.value;if(j.length>N.length)return;if(!(z instanceof d)){var Q=1,K;if(U){if(K=f(W,Y,N,$),!K||K.index>=N.length)break;var ee=K.index,q=K.index+K[0].length,xe=Y;for(xe+=V.value.length;ee>=xe;)V=V.next,xe+=V.value.length;if(xe-=V.value.length,Y=xe,V.value instanceof d)continue;for(var de=V;de!==j.tail&&(xe<q||typeof de.value=="string");de=de.next)Q++,xe+=de.value.length;Q--,z=N.slice(Y,xe),K.index-=Y}else if(K=f(W,0,z,$),!K)continue;var ee=K.index,fe=K[0],je=z.slice(0,ee),ge=z.slice(ee+fe.length),Ee=Y+z.length;I&&Ee>I.reach&&(I.reach=Ee);var Be=V.prev;je&&(Be=x(j,Be,je),Y+=je.length),y(j,Be,Q);var Ve=new d(O,B?c.tokenize(fe,B):fe,L,fe);if(V=x(j,Be,Ve),ge&&x(j,V,ge),Q>1){var J={cause:O+","+M,reach:Ee};h(N,j,_,V.prev,Y,J),I&&J.reach>I.reach&&(I.reach=J.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,_){var D=j.next,E={value:_,prev:j,next:D};return j.next=E,D.prev=E,N.length++,E}function y(N,j,_){for(var D=j.next,E=0;E<_&&D!==N.tail;E++)D=D.next;j.next=D,D.prev=j,N.length-=E}function v(N){for(var j=[],_=N.head.next;_!==N.tail;)j.push(_.value),_=_.next;return j}if(!s.document)return s.addEventListener&&(c.disableWorkerMessageHandler||s.addEventListener("message",function(N){var j=JSON.parse(N.data),_=j.language,D=j.code,E=j.immediateClose;s.postMessage(c.highlight(D,c.languages[_],_)),E&&s.close()},!1)),c;var S=c.util.currentScript();S&&(c.filename=S.src,S.hasAttribute("data-manual")&&(c.manual=!0));function C(){c.manual||c.highlightAll()}if(!c.manual){var k=document.readyState;k==="loading"||k==="interactive"&&S&&S.defer?document.addEventListener("DOMContentLoaded",C):window.requestAnimationFrame?window.requestAnimationFrame(C):window.setTimeout(C,16)}return c})(e);t.exports&&(t.exports=n),typeof D0<"u"&&(D0.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(/&amp;/,"&"))}),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,C){return"✖ Error "+S+" while fetching file: "+C},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,C,k){var N=new XMLHttpRequest;N.open("GET",S,!0),N.onreadystatechange=function(){N.readyState==4&&(N.status<400&&N.responseText?C(N.responseText):N.status>=400?k(a(N.status,N.statusText)):k(r))},N.send(null)}function y(S){var C=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(S||"");if(C){var k=Number(C[1]),N=C[2],j=C[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 C=S.element;if(C.matches(m)){S.code="",C.setAttribute(c,d);var k=C.appendChild(document.createElement("CODE"));k.textContent=s;var N=C.getAttribute("data-src"),j=S.language;if(j==="none"){var _=(/\.(\w+)$/.exec(N)||[,"none"])[1];j=i[_]||_}n.util.setLanguage(k,j),n.util.setLanguage(C,j);var D=n.plugins.autoloader;D&&D.loadLanguages(j),x(N,function(E){C.setAttribute(c,f);var I=y(C.getAttribute("data-range"));if(I){var O=E.split(/\r\n?|\n/g),T=I[0],M=I[1]==null?O.length:I[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)),E=O.slice(T,M).join(`
83
+ `),C.hasAttribute("data-start")||C.setAttribute("data-start",String(T+1))}k.textContent=E,n.highlightElement(k)},function(E){C.setAttribute(c,h),k.textContent=E})}}),n.plugins.fileHighlight={highlight:function(C){for(var k=(C||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)}})()})(Dg)),Dg.exports}var C4=S4();const aa=ju(C4);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 eC={},tC;function A4(){return tC||(tC=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)),eC}A4();(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 nC={},sC;function j4(){return sC||(sC=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:/![sra](?=[:}]$)/,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),nC}j4();(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 C=S.content[1],k=S.content[3];if(C&&k&&C.type==="code-language"&&k.type==="code-block"&&typeof C.content=="string"){var N=C.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 C=t.languages[m];if(C)h.content=t.highlight(f(h.content),C,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 aC={},rC;function N4(){return rC||(rC=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)),aC}N4();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 T4={".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"},ye="/assets/vscode-icons/",Kf={".7z":`${ye}file_type_zip.svg`,".R":`${ye}file_type_r.svg`,".adoc":`${ye}file_type_asciidoc.svg`,".asciidoc":`${ye}file_type_asciidoc.svg`,".astro":`${ye}file_type_astro.svg`,".avi":`${ye}file_type_video.svg`,".babelrc":`${ye}file_type_babel.svg`,".bash":`${ye}file_type_shell.svg`,".bat":`${ye}file_type_bat.svg`,".bmp":`${ye}file_type_image.svg`,".c":`${ye}file_type_c.svg`,".cc":`${ye}file_type_cpp.svg`,".cfg":`${ye}file_type_ini.svg`,".circleci":`${ye}file_type_circleci.svg`,".cjs":`${ye}file_type_js_official.svg`,".clj":`${ye}file_type_clojure.svg`,".cljs":`${ye}file_type_clojure.svg`,".cmd":`${ye}file_type_bat.svg`,".conf":`${ye}file_type_ini.svg`,".cpp":`${ye}file_type_cpp.svg`,".cs":`${ye}file_type_csharp.svg`,".css":`${ye}file_type_css.svg`,".csv":`${ye}file_type_csv.svg`,".cxx":`${ye}file_type_cpp.svg`,".dart":`${ye}file_type_dart.svg`,".diff":`${ye}file_type_diff.svg`,".dockerfile":`${ye}file_type_docker.svg`,".dockerignore":`${ye}file_type_docker.svg`,".env":`${ye}file_type_dotenv.svg`,".env.development":`${ye}file_type_dotenv.svg`,".env.local":`${ye}file_type_dotenv.svg`,".env.production":`${ye}file_type_dotenv.svg`,".env.test":`${ye}file_type_dotenv.svg`,".erb":`${ye}file_type_ruby.svg`,".erl":`${ye}file_type_erlang.svg`,".eslintrc":`${ye}file_type_eslint.svg`,".eslintrc.js":`${ye}file_type_eslint.svg`,".eslintrc.json":`${ye}file_type_eslint.svg`,".ex":`${ye}file_type_elixir.svg`,".exs":`${ye}file_type_elixir.svg`,".fish":`${ye}file_type_shell.svg`,".gif":`${ye}file_type_image.svg`,".git":`${ye}file_type_git.svg`,".gitattributes":`${ye}file_type_git.svg`,".github":`${ye}file_type_github.svg`,".gitignore":`${ye}file_type_git.svg`,".gitlab-ci.yml":`${ye}file_type_gitlab.svg`,".gitmodules":`${ye}file_type_git.svg`,".go":`${ye}file_type_go.svg`,".gql":`${ye}file_type_graphql.svg`,".gradle":`${ye}file_type_gradle.svg`,".graphql":`${ye}file_type_graphql.svg`,".groovy":`${ye}file_type_groovy.svg`,".gz":`${ye}file_type_zip.svg`,".h":`${ye}file_type_c.svg`,".hpp":`${ye}file_type_cpp.svg`,".hrl":`${ye}file_type_erlang.svg`,".hs":`${ye}file_type_haskell.svg`,".htm":`${ye}file_type_html.svg`,".html":`${ye}file_type_html.svg`,".ico":`${ye}file_type_image.svg`,".ini":`${ye}file_type_ini.svg`,".java":`${ye}file_type_java.svg`,".jl":`${ye}file_type_julia.svg`,".jpeg":`${ye}file_type_image.svg`,".jpg":`${ye}file_type_image.svg`,".js":`${ye}file_type_js_official.svg`,".json":`${ye}file_type_json_official.svg`,".json5":`${ye}file_type_json5.svg`,".jsonc":`${ye}file_type_json_official.svg`,".jsx":`${ye}file_type_reactjs.svg`,".kt":`${ye}file_type_kotlin.svg`,".kts":`${ye}file_type_kotlin.svg`,".kubernetes.yaml":`${ye}file_type_kubernetes.svg`,".less":`${ye}file_type_less.svg`,".lhs":`${ye}file_type_haskell.svg`,".lock":`${ye}file_type_lock.svg`,".log":`${ye}file_type_log.svg`,".lua":`${ye}file_type_lua.svg`,".markdown":`${ye}file_type_markdown.svg`,".md":`${ye}file_type_markdown.svg`,".mdown":`${ye}file_type_markdown.svg`,".mdx":`${ye}file_type_markdown.svg`,".mjs":`${ye}file_type_js_official.svg`,".mk":`${ye}file_type_makefile.svg`,".mov":`${ye}file_type_video.svg`,".mp3":`${ye}file_type_audio.svg`,".mp4":`${ye}file_type_video.svg`,".nim":`${ye}file_type_nim.svg`,".nims":`${ye}file_type_nim.svg`,".patch":`${ye}file_type_diff.svg`,".pdf":`${ye}file_type_pdf.svg`,".php":`${ye}file_type_php.svg`,".pl":`${ye}file_type_perl.svg`,".pm":`${ye}file_type_perl.svg`,".png":`${ye}file_type_image.svg`,".prettier.json":`${ye}file_type_prettier.svg`,".prettierrc":`${ye}file_type_prettier.svg`,".ps1":`${ye}file_type_powershell.svg`,".psd1":`${ye}file_type_powershell.svg`,".psm1":`${ye}file_type_powershell.svg`,".py":`${ye}file_type_python.svg`,".pyw":`${ye}file_type_python.svg`,".r":`${ye}file_type_r.svg`,".rar":`${ye}file_type_zip.svg`,".rb":`${ye}file_type_ruby.svg`,".rs":`${ye}file_type_rust.svg`,".rst":`${ye}file_type_rst.svg`,".sass":`${ye}file_type_scss.svg`,".scala":`${ye}file_type_scala.svg`,".scss":`${ye}file_type_scss.svg`,".sh":`${ye}file_type_shell.svg`,".sql":`${ye}file_type_sql.svg`,".sty":`${ye}file_type_latex.svg`,".svelte":`${ye}file_type_svelte.svg`,".svg":`${ye}file_type_svg.svg`,".swift":`${ye}file_type_swift.svg`,".tar":`${ye}file_type_tar.svg`,".tar.bz2":`${ye}file_type_zip.svg`,".tar.gz":`${ye}file_type_zip.svg`,".terraform":`${ye}file_type_terraform.svg`,".tex":`${ye}file_type_latex.svg`,".toml":`${ye}file_type_toml.svg`,".travis.yml":`${ye}file_type_travis.svg`,".ts":`${ye}file_type_typescript_official.svg`,".tsv":`${ye}file_type_tsv.svg`,".tsx":`${ye}file_type_typescript_official.svg`,".txt":`${ye}file_type_text.svg`,".vue":`${ye}file_type_vue.svg`,".webm":`${ye}file_type_video.svg`,".webp":`${ye}file_type_image.svg`,".xml":`${ye}file_type_xml.svg`,".yaml":`${ye}file_type_yaml_official.svg`,".yml":`${ye}file_type_yaml_official.svg`,".zig":`${ye}file_type_zig.svg`,".zip":`${ye}file_type_zip.svg`,".zsh":`${ye}file_type_shell.svg`,"CMakeLists.txt":`${ye}file_type_cmake.svg`,"Cargo.lock":`${ye}file_type_cargo.svg`,"Cargo.toml":`${ye}file_type_cargo.svg`,Dockerfile:`${ye}file_type_docker.svg`,Gemfile:`${ye}file_type_ruby.svg`,"Gemfile.lock":`${ye}file_type_ruby.svg`,Justfile:`${ye}file_type_just.svg`,Makefile:`${ye}file_type_makefile.svg`,Pipfile:`${ye}file_type_python.svg`,"Pipfile.lock":`${ye}file_type_python.svg`,Procfile:`${ye}file_type_procfile.svg`,Vagrantfile:`${ye}file_type_vagrant.svg`,"azure-pipelines.yml":`${ye}file_type_azurepipelines.svg`,"build.gradle":`${ye}file_type_gradle.svg`,"build.sbt":`${ye}file_type_scala.svg`,"docker-compose.yaml":`${ye}file_type_docker.svg`,"docker-compose.yml":`${ye}file_type_docker.svg`,dune:`${ye}file_type_dune.svg`,"gatsby-config.js":`${ye}file_type_gatsby.svg`,"go.mod":`${ye}file_type_go.svg`,"go.sum":`${ye}file_type_go.svg`,"heroku.yml":`${ye}file_type_heroku.svg`,"jsconfig.json":`${ye}file_type_jsconfig.svg`,"kubernetes.yaml":`${ye}file_type_kubernetes.svg`,makefile:`${ye}file_type_makefile.svg`,"meson.build":`${ye}file_type_meson.svg`,"mix.exs":`${ye}file_type_elixir.svg`,"next.config.js":`${ye}file_type_nextjs.svg`,"nuxt.config.js":`${ye}file_type_nuxtjs.svg`,"package-lock.json":`${ye}file_type_npm.svg`,"package.json":`${ye}file_type_npm.svg`,"pnpm-lock.yaml":`${ye}file_type_pnpm.svg`,"pom.xml":`${ye}file_type_maven.svg`,"pubspec.lock":`${ye}file_type_dart.svg`,"pubspec.yaml":`${ye}file_type_dart.svg`,"pyproject.toml":`${ye}file_type_python.svg`,"rebar.config":`${ye}file_type_erlang.svg`,"requirements.txt":`${ye}file_type_python.svg`,"terraform.tfvars":`${ye}file_type_terraform.svg`,"tox.ini":`${ye}file_type_tox.svg`,"tsconfig.json":`${ye}file_type_tsconfig.svg`,"vite.config.js":`${ye}file_type_vite.svg`,"vite.config.ts":`${ye}file_type_vite.svg`,"webpack.config.js":`${ye}file_type_webpack.svg`,"yarn.lock":`${ye}file_type_yarn.svg`,default:`${ye}default_file.svg`},a1={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"}},_4={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"),[])},Rg=new Map;async function r1(t){if(t in aa.languages)return!0;const e=_4[t];if(!e)return!1;let n=Rg.get(t);n||(n=e(),Rg.set(t,n));try{return await n,t in aa.languages}catch{return!1}finally{Rg.delete(t)}}function xV(t){aa.highlightElement(t)}function Af(t){return T4[t]||"plaintext"}function E4(t){return t in aa.languages}function iC(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function mo(t,e){if(!t)return"";const n=aa.languages[e];if(!n)return iC(t);try{return aa.highlight(t,n,e)}catch{return iC(t)}}function M4(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 uu(t){var e;if(typeof navigator<"u"&&((e=navigator.clipboard)!=null&&e.writeText)){await navigator.clipboard.writeText(t);return}M4(t)}function i1(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,_)=>{_%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,_)=>{const D=(j.textContent||"").trim();D.length,h[_]=D.length});for(const j of f)Array.from(j.children).forEach((D,E)=>{if(E<d){const I=(D.textContent||"").trim();m[E]=Math.max(m[E],I.length);const O=I.split(/\s+/);for(const T of O)h[E]=Math.max(h[E],T.length)}});const x=h.reduce((j,_)=>j+_,0)||1,y=h.map(j=>{const _=j<=3?3:j<=6?5:8;return Math.max(_,Math.round(j/x*50))}),v=y.reduce((j,_)=>j+_,0),S=Math.max(0,100-v),C=m.reduce((j,_)=>j+_,0)||1,k=y.map((j,_)=>j+Math.round(m[_]/C*S)),N=k.reduce((j,_)=>j+_,0);k[k.length-1]+=100-N;for(const j of f)Array.from(j.children).forEach((D,E)=>{if(E<d){const I=`${k[E]}%`;D.setAttribute("width",I),D.style.cssText+=`;width:${I}`}})}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 o1(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),C=b.useRef(null),k=b.useCallback(()=>{if(!y.current||!v.current)return;const D=y.current.getBoundingClientRect(),E=v.current.getBoundingClientRect(),I=window.scrollY,O=window.scrollX,T=8;let M=0,R=0;switch(n){case"top":M=D.top+I-E.height-T,R=D.left+O+(D.width-E.width)/2;break;case"bottom":M=D.bottom+I+T,R=D.left+O+(D.width-E.width)/2;break;case"left":M=D.top+I+(D.height-E.height)/2,R=D.left+O-E.width-T;break;case"right":M=D.top+I+(D.height-E.height)/2,R=D.right+O+T;break}const B=window.innerWidth,$=window.innerHeight;R<T&&(R=T),R+E.width>B-T&&(R=B-E.width-T),M<T&&(M=T),M+E.height>$+I-T&&(M=$+I-E.height-T),x({top:M,left:R})},[n]),N=b.useCallback(()=>{r||(C.current&&(clearTimeout(C.current),C.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),C.current=setTimeout(()=>{h(!1)},100)},[]);b.useEffect(()=>{f&&c&&requestAnimationFrame(k)},[f,c,k]),b.useEffect(()=>()=>{S.current&&clearTimeout(S.current),C.current&&clearTimeout(C.current)},[]);const _=f&&t&&Rl.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}),_]})}function yV({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 Og(t,e){return t?mo(t,e):""}function D4(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 E=1;E<=c;E++)s[D-1]===a[E-1]?d[D][E]=d[D-1][E-1]+1:d[D][E]=Math.max(d[D-1][E],d[D][E-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 C=-1,k=0,N=-1,j=0;const _=()=>{(k>0||j>0)&&S.push({leftStart:C>=0?C:x.length,leftCount:k,rightStart:N>=0?N:y.length,rightCount:j,type:k>0&&j>0?"modified":k>0?"removed":"added"}),C=-1,k=0,N=-1,j=0};for(const D of f)if(D.type==="equal"){_();const E=s[D.origIdx],I=Og(E,r);x.push({num:D.origIdx+1,text:E,highlighted:I,type:"unchanged"}),y.push({num:D.modIdx+1,text:E,highlighted:I,type:"unchanged"}),v.push({leftLine:x.length,rightLine:y.length})}else if(D.type==="delete"){C<0&&(C=x.length),k++;const E=s[D.origIdx],I=Og(E,r);x.push({num:D.origIdx+1,text:E,highlighted:I,type:"removed"})}else{N<0&&(N=y.length),j++;const E=a[D.modIdx],I=Og(E,r);y.push({num:D.modIdx+1,text:E,highlighted:I,type:"added"})}return _(),v.push({leftLine:x.length,rightLine:y.length}),{leftLines:x,rightLines:y,alignments:v,changeBlocks:S}}function R4(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],_=r?N.leftLine:N.rightLine,D=r?j.leftLine:j.rightLine;if(i>=_&&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 O4=[".md",".mdx",".markdown"];function Ib({originalContent:t,modifiedContent:e,filename:n,language:s,initialModifiedOnly:a=!1}){const{t:r}=pt(["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,C]=b.useState("idle"),[k,N]=b.useState(a),[j,_]=b.useState(0);b.useEffect(()=>{s&&s!=="plaintext"&&r1(s).then(()=>_(ee=>ee+1))},[s]);const D=!t,E=!e,I=b.useMemo(()=>{const ee=n.substring(n.lastIndexOf(".")).toLowerCase();return O4.includes(ee)},[n]),O=b.useCallback(async()=>{try{if(I&&k&&d.current){const ee=d.current.innerHTML,fe=i1(ee),je=d.current.innerText;await o1(fe,je)}else await uu(e);v("copied"),setTimeout(()=>v("idle"),2e3)}catch(ee){console.error("Copy modified content failed:",ee),v("error"),setTimeout(()=>v("idle"),2e3)}},[e,I,k]),T=b.useCallback(async()=>{if(!d.current){console.error("Copy HTML: markdown content ref is not available"),C("error"),setTimeout(()=>C("idle"),2e3);return}try{const ee=d.current.innerHTML;await uu(ee),C("copied"),setTimeout(()=>C("idle"),2e3)}catch(ee){console.error("Copy HTML failed:",ee),C("error"),setTimeout(()=>C("idle"),2e3)}},[]),{leftLines:M,rightLines:R,alignments:B,changeBlocks:$}=b.useMemo(()=>D4(t,e,s),[t,e,s,j]),U=b.useCallback(()=>{const ee=f.current,fe=i.current,je=c.current;if(!ee||!fe||!je)return;const ge=window.devicePixelRatio||1,Ee=ee.parentElement;if(!Ee)return;const Be=Ee.clientWidth,Ve=Ee.clientHeight;if(Be===0||Ve===0)return;const J=Math.round(Be*ge),ne=Math.round(Ve*ge);(ee.width!==J||ee.height!==ne)&&(ee.width=J,ee.height=ne);const Te=ee.getContext("2d");if(!Te)return;Te.setTransform(ge,0,0,ge,0,0),Te.clearRect(0,0,Be,Ve);const qe=Ee.getBoundingClientRect(),at=fe.getBoundingClientRect(),Se=je.getBoundingClientRect(),Fe=at.top-qe.top,ie=Se.top-qe.top,he=fe.scrollTop,We=je.scrollTop,st=fe.clientHeight,ut=je.clientHeight;for(const ue of $){const X=Fe+ue.leftStart*Q-he,ae=Fe+(ue.leftStart+Math.max(ue.leftCount,.5))*Q-he,we=ie+ue.rightStart*Q-We,Z=ie+(ue.rightStart+Math.max(ue.rightCount,.5))*Q-We;if(ae<Fe&&Z<ie||X>Fe+st+20&&we>ie+ut+20)continue;ue.type==="modified"?(Te.fillStyle="rgba(90, 130, 180, 0.2)",Te.strokeStyle="rgba(90, 130, 180, 0.45)"):ue.type==="removed"?(Te.fillStyle="rgba(200, 90, 90, 0.2)",Te.strokeStyle="rgba(200, 90, 90, 0.45)"):(Te.fillStyle="rgba(92, 184, 138, 0.2)",Te.strokeStyle="rgba(92, 184, 138, 0.45)");const ve=Be*.5;Te.lineWidth=1,Te.save(),Te.beginPath(),Te.rect(0,Fe,Be,Ve-Fe),Te.clip(),Te.beginPath(),Te.moveTo(0,X),Te.bezierCurveTo(ve,X,ve,we,Be,we),Te.lineTo(Be,Z),Te.bezierCurveTo(ve,Z,ve,ae,0,ae),Te.closePath(),Te.fill(),Te.stroke(),Te.restore()}},[$]);b.useEffect(()=>{if(k||D||E)return;const ee=f.current,fe=i.current,je=c.current;if(!ee||!fe||!je)return;const ge=ee.parentElement;if(!ge)return;const Ee=new ResizeObserver(()=>{U()});return Ee.observe(ge),requestAnimationFrame(()=>U()),()=>{Ee.disconnect(),h.current&&cancelAnimationFrame(h.current)}},[k,D,E,U]);const{leftBoundaries:L,rightBoundaries:F}=b.useMemo(()=>{const ee=new Map,fe=new Map;for(const je of $){if(je.leftCount>0){const ge=je.leftStart,Ee=je.leftStart+je.leftCount-1;ee.set(ge,ee.has(ge)?"both":"top"),ge===Ee?ee.set(ge,"both"):ee.set(Ee,ee.has(Ee)?"both":"bottom")}if(je.rightCount>0){const ge=je.rightStart,Ee=je.rightStart+je.rightCount-1;fe.set(ge,fe.has(ge)?"both":"top"),ge===Ee?fe.set(ge,"both"):fe.set(Ee,fe.has(Ee)?"both":"bottom")}}return{leftBoundaries:ee,rightBoundaries:fe}},[$]),W=b.useMemo(()=>{const ee=R.filter(je=>je.type==="added").length,fe=M.filter(je=>je.type==="removed").length;return{added:ee,removed:fe}},[M,R]),V=b.useMemo(()=>{const ee=[];let fe=!1;R.forEach((ge,Ee)=>{ge.type==="added"?fe||(ee.push(Ee),fe=!0):fe=!1});let je=!1;return M.forEach((ge,Ee)=>{if(ge.type==="removed"){if(!je){const Be=Math.min(Ee,R.length-1);ee.includes(Be)||ee.push(Be),je=!0}}else je=!1}),ee.sort((ge,Ee)=>ge-Ee)},[M,R]),[Y,z]=b.useState(0),Q=20,K=b.useCallback(ee=>{const fe=i.current,je=c.current;if(!fe||!je||m.current&&m.current!==ee)return;m.current=ee,x.current&&cancelAnimationFrame(x.current);const ge=ee==="left"?fe:je,Ee=ee==="left"?je:fe;Ee.scrollLeft=ge.scrollLeft;const Be=R4(ge.scrollTop,ge.scrollHeight-ge.clientHeight,Ee.scrollHeight-Ee.clientHeight,B,Q,ee==="left");Ee.scrollTop=Be,h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{U(),h.current=null}),x.current=requestAnimationFrame(()=>{m.current=null})},[B,U]);b.useEffect(()=>{const ee=i.current,fe=c.current;if(!ee||!fe)return;const je=()=>K("left"),ge=()=>K("right");return ee.addEventListener("scroll",je),fe.addEventListener("scroll",ge),()=>{ee.removeEventListener("scroll",je),fe.removeEventListener("scroll",ge),x.current&&cancelAnimationFrame(x.current)}},[K]);const q=b.useCallback(ee=>{if(ee<0||ee>=V.length)return;const je=V[ee]*Q;c.current&&(c.current.scrollTop=je),z(ee)},[V]),xe=b.useCallback(()=>{const ee=Math.min(Y+1,V.length-1);q(ee)},[Y,V.length,q]),de=b.useCallback(()=>{const ee=Math.max(Y-1,0);q(ee)},[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:de,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:xe,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&&!E&&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:I&&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(I&&k?"terminal:diffViewer.copyRichText":"common:buttons.copy")})}),I&&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||E?"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((ee,fe)=>{const je=L.get(fe),ge=je==="both"?"diff-hunk-top diff-hunk-bottom":je==="top"?"diff-hunk-top":je==="bottom"?"diff-hunk-bottom":"";return o.jsxs("div",{className:`diff-line diff-line-${ee.type} ${ge}`,children:[o.jsx("span",{className:"diff-line-num",children:ee.num}),o.jsx("span",{className:"diff-line-content",dangerouslySetInnerHTML:{__html:ee.highlighted||"&nbsp;"}})]},fe)})})]}),!k&&!D&&!E&&o.jsx("div",{className:"diff-connector-gutter",children:o.jsx("canvas",{ref:f})}),!E&&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&&I?o.jsx("div",{className:"diff-panel-content diff-markdown-content",ref:d,children:o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],children:e})})}):o.jsx("div",{className:"diff-panel-content",ref:c,children:R.map((ee,fe)=>{const je=F.get(fe),ge=je==="both"?"diff-hunk-top diff-hunk-bottom":je==="top"?"diff-hunk-top":je==="bottom"?"diff-hunk-bottom":"";return o.jsxs("div",{className:`diff-line diff-line-${ee.type} ${ge}`,children:[o.jsx("span",{className:"diff-line-num",children:ee.num}),o.jsx("span",{className:"diff-line-content",dangerouslySetInnerHTML:{__html:ee.highlighted||"&nbsp;"}})]},fe)})})]})]})]})}function L4(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 l1(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 Tp(t,e){const n=l1(t);return{path:L4(n.path,e),line:n.line}}function P4(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 oC=[".md",".mdx",".markdown"],lC=[".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".svg"],cC=[".pdf"];function c1({isOpen:t,onClose:e,filePath:n,action:s,editData:a,searchRoot:r}){const{t:i}=pt(["terminal","common"]),[c,d]=b.useState(null),[f,h]=b.useState(!1),[m,x]=b.useState(null),[y,v]=b.useState([]),[S,C]=b.useState([]),[k,N]=b.useState("idle"),[j,_]=b.useState("idle"),[D,E]=b.useState("idle"),[I,O]=b.useState("idle"),[T,M]=b.useState(null),[R,B]=b.useState(null),[$,U]=b.useState(!1),L=b.useRef(null),F=b.useRef(null),W=b.useRef(null),V=b.useMemo(()=>l1(n),[n]),Y=V.path,z=(a==null?void 0:a.targetLine)??V.line,Q=(a==null?void 0:a.highlightRange)||void 0;b.useEffect(()=>{t&&Y?(v([]),C([]),M(null),B(null),Te()):(d(null),x(null),v([]),C([]),M(null),B(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 le=Le.key==="j"?100:-100;if(F.current){const me=F.current.querySelectorAll(".diff-panel-content");if(me.length>0)me.forEach(se=>{se.scrollBy({top:le,behavior:"smooth"})});else{const se=F.current.querySelector(".file-viewer-code-with-lines");se?se.scrollBy({top:le,behavior:"smooth"}):F.current.scrollBy({top:le,behavior:"smooth"})}}return}Le.stopPropagation()}};return window.addEventListener("keydown",oe,{capture:!0}),()=>window.removeEventListener("keydown",oe,{capture:!0})},[t,e]);const K=b.useMemo(()=>{if(!c||!a||a.highlightRange)return null;const{oldString:oe="",newString:Le="",operation:le}=a;if(!oe&&!Le)return null;if(le==="append"&&Le){if(c.content.endsWith(Le))return c.content.slice(0,c.content.length-Le.length);const me=c.content.lastIndexOf(Le);return me!==-1?c.content.slice(0,me)+c.content.slice(me+Le.length):null}if(Le){const me=c.content.indexOf(Le);return me!==-1?c.content.slice(0,me)+oe+c.content.slice(me+Le.length):null}return null},[c,a]),q=!!a&&!a.highlightRange&&(!!a.oldString||!!a.newString),xe=(a==null?void 0:a.unifiedDiff)||T,de=!!xe,ee=b.useMemo(()=>K!==null||!c||!xe?null:P4(c.content,xe),[K,c,xe]),fe=K??ee??R,je=fe!==null&&(q||de),ge=de&&!je,Ee=Q!==void 0;b.useEffect(()=>{if(!c||!a||a.highlightRange||je||a.unifiedDiff||T!==null)return;(async()=>{try{const Le=c.path||Y,le=await Bt(Dt(`/api/files/git-diff?path=${encodeURIComponent(Le)}`));if(le.ok){const me=await le.json();if(me.diff&&me.diff.trim()){M(me.diff);return}}}catch{}M("")})()},[c,a,je,Y,T]),b.useEffect(()=>{if(!c||!a||a.highlightRange||K!==null||ee!==null||R!==null||!q&&!de)return;(async()=>{try{const Le=c.path||Y,le=await Bt(Dt(`/api/files/git-original?path=${encodeURIComponent(Le)}`));if(le.ok){const me=await le.json();if(me.content!==void 0&&me.content!==c.content){B(me.content);return}}}catch{}B("")})()},[c,a,K,ee,R,q,de,Y]),b.useEffect(()=>{if(!c)return;const oe=Af(c.extension);if(oe==="plaintext"||oe in aa.languages){U(!0);return}U(!1),r1(oe).then(()=>U(!0))},[c]);const Be=b.useMemo(()=>{if(!c||je||ge||oC.includes(c.extension))return[];const oe=Af(c.extension),Le=aa.languages[oe],le=me=>me.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return c.content.split(`
89
+ `).map(me=>Le?aa.highlight(me||" ",Le,oe):le(me||" "))},[c,je,ge,$]);b.useEffect(()=>{if(!t||!c||!F.current)return;const oe=window.setTimeout(()=>{const Le=()=>{if(!F.current)return;const le=F.current.querySelector(".file-line-highlighted");if(le){le.scrollIntoView({block:"center",behavior:"auto"});return}if(z){const me=F.current.querySelector(`.file-viewer-line-num[data-line="${z}"]`);me==null||me.scrollIntoView({block:"center",behavior:"auto"})}};window.requestAnimationFrame(()=>window.requestAnimationFrame(Le))},0);return()=>window.clearTimeout(oe)},[t,c,Ee,Q==null?void 0:Q.offset,z]);const Ve=async oe=>{const Le=oe.substring(oe.lastIndexOf(".")).toLowerCase(),le=cC.includes(Le),me=lC.includes(Le),se=le||me?`/api/files/info?path=${encodeURIComponent(oe)}`:`/api/files/read?path=${encodeURIComponent(oe)}`,Re=await Bt(Dt(se)),Ke=await Re.json();if(!Re.ok){const ze=Ke.error==="Path is a directory";return{ok:!1,error:Ke.error,isDirectory:ze}}return(le||me)&&(Ke.content=""),{ok:!0,data:Ke}},J=async(oe,Le)=>{var le;try{const me=await Bt(Dt(`/api/files/resolve?name=${encodeURIComponent(oe)}&root=${encodeURIComponent(Le)}`)),se=await me.json();if(me.ok&&((le=se.results)==null?void 0:le.length)>0)return se.results}catch{}return[]},ne=async oe=>{var Le;try{const le=await Bt(Dt(`/api/files/list?path=${encodeURIComponent(oe)}`)),me=await le.json();if(le.ok&&((Le=me.files)==null?void 0:Le.length)>0)return me.files.slice(0,20).map(se=>({name:se.name,path:se.path,isDirectory:se.isDirectory,size:se.size||0,extension:se.extension||""}))}catch{}return[]},Te=async()=>{h(!0),x(null),v([]),C([]);try{const oe=await Ve(Y);if(oe.ok){d(oe.data);return}if(oe.isDirectory){const me=await ne(Y);if(me.length>0){C(me);return}x(oe.error||i("terminal:fileExplorer.failedToLoad"));return}const Le=Y.split("/").pop()||Y,le=r||(Y.startsWith("/")?Y.split("/").slice(0,-1).join("/"):"");if(le&&Le){const me=await J(Le,le);if(me.length===1&&!me[0].isDirectory){const se=await Ve(me[0].path);if(se.ok){d(se.data);return}}else if(me.length>0){v(me);return}}x(oe.error||i("terminal:fileExplorer.failedToLoad"))}catch(oe){x(oe.message||i("terminal:fileExplorer.failedToLoad"))}finally{h(!1)}},qe=async oe=>{if(oe.isDirectory){h(!0),v([]),C([]),x(null);try{const Le=await ne(oe.path);Le.length>0?C(Le):x("Empty directory")}catch{x("Failed to load directory")}finally{h(!1)}return}h(!0),v([]),C([]),x(null);try{const Le=await Ve(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:Se}=wa(e),Fe=()=>{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)"}},he=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=i1(oe),le=L.current.innerText;await o1(Le,le),N("copied"),setTimeout(()=>N("idle"),2e3)}catch(oe){console.error("Copy Rich Text failed:",oe),N("error"),setTimeout(()=>N("idle"),2e3)}},[]),We=b.useCallback(async()=>{if(!L.current){console.error("Copy HTML: markdown content ref is not available"),_("error"),setTimeout(()=>_("idle"),2e3);return}try{const oe=L.current.innerHTML;await uu(oe),_("copied"),setTimeout(()=>_("idle"),2e3)}catch(oe){console.error("Copy HTML failed:",oe),_("error"),setTimeout(()=>_("idle"),2e3)}},[]),st=b.useCallback(async()=>{if(!c){E("error"),setTimeout(()=>E("idle"),2e3);return}try{await uu(c.content),E("copied"),setTimeout(()=>E("idle"),2e3)}catch{E("error"),setTimeout(()=>E("idle"),2e3)}},[c]),ut=b.useCallback(async()=>{if(!c){O("error"),setTimeout(()=>O("idle"),2e3);return}try{await uu(c.content),O("copied"),setTimeout(()=>O("idle"),2e3)}catch{O("error"),setTimeout(()=>O("idle"),2e3)}},[c]),ue=oe=>oe<1024?`${oe} B`:oe<1024*1024?`${(oe/1024).toFixed(1)} KB`:`${(oe/(1024*1024)).toFixed(1)} MB`,X=c&&oC.includes(c.extension),ae=c&&lC.includes(c.extension),we=c&&cC.includes(c.extension),Z=ae?"Image":we?"PDF":c?Af(c.extension):"text",ve=Ni(),He=ae?Dt(`/api/files/binary?path=${encodeURIComponent(Y)}${ve?`&token=${encodeURIComponent(ve)}`:""}`):null,Pe=we?Dt(`/api/files/binary?path=${encodeURIComponent(Y)}${ve?`&token=${encodeURIComponent(ve)}`:""}`):null;return t?o.jsx(ir,{children:o.jsx("div",{ref:W,className:"file-viewer-overlay",onMouseDown:at,onClick:Se,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:Fe()}),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:[X&&c&&!je&&!ge&&!Ee&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`file-viewer-copy-html-btn ${k}`,onClick:he,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:We,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:st,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 ${I}`,onClick:ut,title:i("terminal:fileExplorer.copyOriginalTitle"),children:i(I==="copied"?"common:status.copied":I==="error"?"common:status.error":"terminal:fileExplorer.copyOriginal")})]}),ae&&He||we&&Pe?o.jsx("a",{className:"file-viewer-copy-html-btn",href:`${ae?He:Pe}&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:ue(c.size)}),o.jsx("span",{children:"•"}),o.jsx("span",{children:Z}),c.content&&!ae&&!we&&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:F,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:()=>qe(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:ue(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:()=>qe(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:ue(oe.size)})]},oe.path))})]}),c&&!f&&!m&&(ae&&He?o.jsx("div",{className:"file-viewer-image-wrapper",children:o.jsx("img",{src:He,alt:c.filename,className:"file-viewer-image"})}):we&&Pe?o.jsx("div",{className:"file-viewer-pdf-embed",children:o.jsx("iframe",{src:Pe,title:c.filename,className:"file-viewer-pdf-iframe"})}):je?o.jsx(Ib,{originalContent:fe,modifiedContent:c.content,filename:c.filename,language:Z}):ge?o.jsx("pre",{className:"file-viewer-code file-viewer-unified-diff",children:xe.split(`
91
+ `).map((oe,Le)=>{let le="diff-ctx";return oe.startsWith("+")&&!oe.startsWith("+++")?le="diff-add":oe.startsWith("-")&&!oe.startsWith("---")?le="diff-del":oe.startsWith("@@")?le="diff-hdr":(oe.startsWith("diff ")||oe.startsWith("index ")||oe.startsWith("---")||oe.startsWith("+++"))&&(le="diff-meta"),o.jsxs("div",{className:`file-line file-line-${le}`,children:[o.jsx("span",{className:"file-line-num",children:Le+1}),o.jsx("code",{children:oe||" "})]},Le)})}):Ee?o.jsx("pre",{className:"file-viewer-code file-viewer-code-highlighted",children:c.content.split(`
92
+ `).map((oe,Le)=>{const le=Le+1,me=Q,se=me&&le>=me.offset&&le<me.offset+me.limit;return o.jsxs("div",{className:`file-line ${se?"file-line-highlighted":""}`,children:[o.jsx("span",{className:"file-line-num",children:le}),o.jsx("code",{className:`language-${Z}`,dangerouslySetInnerHTML:{__html:Be[Le]||oe||" "}})]},Le)})}):X?o.jsx("div",{className:"file-viewer-markdown markdown-content",ref:L,children:o.jsx(Dr,{remarkPlugins:[Rr],children:c.content})}):o.jsx("pre",{className:`file-viewer-code file-viewer-code-lines language-${Z}`,children:Be.map((oe,Le)=>o.jsxs("div",{className:`file-line ${z===Le+1?"file-line-highlighted":""}`,children:[o.jsx("span",{className:`file-line-num ${z===Le+1?"file-viewer-line-num-target":""}`,"data-line":Le+1,children:Le+1}),o.jsx("code",{className:`language-${Z}`,dangerouslySetInnerHTML:{__html:oe}})]},Le+1))}))]})]})})}):null}function I4({agentIds:t}){const{t:e}=pt(["terminal"]),n=hx(),s=Lj(),[a,r]=b.useState(null),[i,c]=b.useState(null),[d,f]=b.useState(()=>_r(ft.TOOLS_COLLAPSED)),[h,m]=b.useState(()=>_r(ft.FILES_COLLAPSED)),x=()=>{const O=!d;f(O),Qa(ft.TOOLS_COLLAPSED,O)},y=()=>{const O=!h;m(O),Qa(ft.FILES_COLLAPSED,O)},v=b.useMemo(()=>new Set(t),[t]),S=b.useMemo(()=>n.filter(O=>v.has(O.agentId)),[n,v]),C=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},_=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)"}},E=O=>O==="Read"?"📖":O==="Write"?"📝":O==="Edit"?"✏️":O==="Bash"?"💻":O==="Grep"?"🔍":O==="Glob"?"📁":O==="Task"||O==="Agent"?"🤖":O==="WebFetch"?"🌐":O==="WebSearch"?"🔎":"🔧",I=(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(F4,{execution:O,formatTime:N,formatPath:j,getToolIcon:E,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")," (",C.length,")"]}),!h&&o.jsx("div",{className:"tool-history-panel-content",children:C.length===0?o.jsx("div",{className:"tool-history-empty",children:e("terminal:toolHistory.noFileChangesYet")}):o.jsx("div",{className:"tool-history-list",children:C.slice(0,50).map((O,T)=>o.jsx($4,{change:O,formatTime:N,formatPath:j,getActionIcon:_,getActionColor:D,onClick:()=>I(O.filePath,O.action),showAgentName:k},T))})})]})]}),o.jsx(c1,{isOpen:a!==null,onClose:()=>r(null),filePath:(a==null?void 0:a.path)||"",action:(a==null?void 0:a.action)||"read"})]})}function B4(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 F4({execution:t,formatTime:e,formatPath:n,getToolIcon:s,showAgentName:a,isExpanded:r,onToggle:i,onViewFile:c}){const{t:d}=pt(["terminal"]),f=B4(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:z4(t.toolName,t.toolInput)})]})]})}function z4(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 $4({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 rl(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,C=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*C,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 uC(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const H4=(t,e)=>Math.abs(t-e)<1.01,U4=(t,e,n)=>{let s;return function(...a){t.clearTimeout(s),s=t.setTimeout(()=>e.apply(this,a),n)}},dC=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},W4=t=>t,q4=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},V4=(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(dC(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(dC(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return r.observe(n,{box:"border-box"}),()=>{r.unobserve(n)}},fC={passive:!0},pC=typeof window>"u"?!0:"onscrollend"in window,G4=(t,e)=>{const n=t.scrollElement;if(!n)return;const s=t.targetWindow;if(!s)return;let a=0;const r=t.options.useScrollendEvent&&pC?()=>{}:U4(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,fC);const f=t.options.useScrollendEvent&&pC;return f&&n.addEventListener("scrollend",d,fC),()=>{n.removeEventListener("scroll",c),f&&n.removeEventListener("scrollend",d)}},Y4=(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"]},K4=(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 Q4{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:W4,rangeExtractor:q4,onChange:()=>{},measureElement:Y4,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=rl(()=>(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=rl(()=>[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=rl(()=>[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,C;if(v!==void 0&&this.options.lanes>1){S=v;const _=m[S],D=_!==void 0?h[_]:void 0;C=D?D.end+this.options.gap:s+a}else{const _=this.options.lanes===1?h[x-1]:this.getFurthestMeasurement(h,x);C=_?_.end+this.options.gap:s+a,S=_?_.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=C+N;h[x]={index:x,start:C,size:N,end:j,key:y,lane:S},m[S]=x}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=rl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,a,r)=>this.range=n.length>0&&s>0?X4({measurements:n,outerSize:s,scrollOffset:a,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=rl(()=>{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=rl(()=>[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 uC(s[u1(0,s.length-1,a=>uC(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&&H4(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 u1=(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 X4({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=u1(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 hC=typeof document<"u"?b.useLayoutEffect:b.useEffect;function J4({useFlushSync:t=!0,...e}){const n=b.useReducer(()=>({}),{})[1],s={...e,onChange:(r,i)=>{var c;t&&i?Rl.flushSync(n):n(),(c=e.onChange)==null||c.call(e,r,i)}},[a]=b.useState(()=>new Q4(s));return a.setOptions(s),hC(()=>a._didMount(),[]),hC(()=>a._willUpdate()),a}function d1(t){return J4({observeElementRect:V4,observeElementOffset:G4,scrollToFn:K4,...t})}const mC={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"},gC={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 bC(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 Z4(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=mC[e]:e>=40&&e<=47?n.bgColor=gC[e]:e>=90&&e<=97?n.color=mC[e]:e>=100&&e<=107&&(n.bgColor=gC[e]),n)}function Sl(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=bC(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=Z4(a,f);s=r.index+r[0].length}const i=t.slice(s);if(i){const c=bC(a);c?n+=`<span style="${c}">${of(i)}</span>`:n+=of(i)}return n}function of(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const go=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 f1(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=f1(t[e]))&&(s&&(s+=" "),s+=n)}else for(n in t)t[n]&&(s&&(s+=" "),s+=n);return s}function as(){for(var t,e,n=0,s="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=f1(t))&&(s&&(s+=" "),s+=e);return s}const p1=6048e5,ez=864e5,_p=6e4,Ep=36e5,tz=1e3,xC=Symbol.for("constructDateFrom");function xn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&xC in t?t[xC](e):t instanceof Date?new t.constructor(e):new Date(e)}function St(t,e){return xn(e||t,t)}function Da(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 Oa(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 h1(t,e,n){return xn(t,+St(t)+e)}function nz(t,e,n){return h1(t,e*Ep)}let sz={};function vo(){return sz}function Ir(t,e){var c,d,f,h;const n=vo(),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 Cl(t,e){return Ir(t,{...e,weekStartsOn:1})}function m1(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=Cl(a),i=xn(n,0);i.setFullYear(s,0,4),i.setHours(0,0,0,0);const c=Cl(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 zr(t,...e){const n=xn.bind(null,e.find(s=>typeof s=="object"));return e.map(n)}function bo(t,e){const n=St(t,e==null?void 0:e.in);return n.setHours(0,0,0,0),n}function Al(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=bo(s),i=bo(a),c=+r-Qf(r),d=+i-Qf(i);return Math.round((c-d)/ez)}function az(t,e){const n=m1(t,e),s=xn(t,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),Cl(s)}function Su(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setTime(s.getTime()+e*_p),s}function Ox(t,e,n){return Oa(t,e*3,n)}function rz(t,e,n){return h1(t,e*1e3)}function Xf(t,e,n){return Da(t,e*7,n)}function Ra(t,e,n){return Oa(t,e*12,n)}function yC(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 vC(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 iz(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return+bo(s)==+bo(a)}function tr(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function jl(t){return!(!tr(t)&&typeof t!="number"||isNaN(+St(t)))}function Jf(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=s.getFullYear()-a.getFullYear(),i=s.getMonth()-a.getMonth();return r*12+i}function vi(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]=zr(n==null?void 0:n.in,t,e),r=s.getFullYear()-a.getFullYear(),i=vi(s)-vi(a);return r*4+i}function ep(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return s.getFullYear()-a.getFullYear()}function oz(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e),r=wC(s,a),i=Math.abs(Al(s,a));s.setDate(s.getDate()-r*i);const c=+(wC(s,a)===-r),d=r*(i-c);return d===0?0:d}function wC(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 g1(t,e){const n=St(t,e==null?void 0:e.in);return n.setHours(23,59,59,999),n}function b1(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 Bb(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 x1(t,e){const n=St(t,e==null?void 0:e.in);return n.setDate(1),n.setHours(0,0,0,0),n}function y1(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 Mp(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 lz(t,e){var c,d;const n=vo(),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 cz={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"}},uz=(t,e,n)=>{let s;const a=cz[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 Lg(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const dz={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},fz={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},pz={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},hz={date:Lg({formats:dz,defaultWidth:"full"}),time:Lg({formats:fz,defaultWidth:"full"}),dateTime:Lg({formats:pz,defaultWidth:"full"})},mz={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},gz=(t,e,n,s)=>mz[t];function Hc(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 bz={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},xz={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yz={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"]},vz={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"]},wz={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"}},kz={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"}},Sz=(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"},Cz={ordinalNumber:Sz,era:Hc({values:bz,defaultWidth:"wide"}),quarter:Hc({values:xz,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Hc({values:yz,defaultWidth:"wide"}),day:Hc({values:vz,defaultWidth:"wide"}),dayPeriod:Hc({values:wz,defaultWidth:"wide",formattingValues:kz,defaultFormattingWidth:"wide"})};function Uc(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)?jz(c,m=>m.test(i)):Az(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 Az(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function jz(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Nz(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 Tz=/^(\d+)(th|st|nd|rd)?/i,_z=/\d+/i,Ez={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},Mz={any:[/^b/i,/^(a|c)/i]},Dz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Rz={any:[/1/i,/2/i,/3/i,/4/i]},Oz={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},Lz={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]},Pz={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},Iz={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]},Bz={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},Fz={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}},zz={ordinalNumber:Nz({matchPattern:Tz,parsePattern:_z,valueCallback:t=>parseInt(t,10)}),era:Uc({matchPatterns:Ez,defaultMatchWidth:"wide",parsePatterns:Mz,defaultParseWidth:"any"}),quarter:Uc({matchPatterns:Dz,defaultMatchWidth:"wide",parsePatterns:Rz,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Uc({matchPatterns:Oz,defaultMatchWidth:"wide",parsePatterns:Lz,defaultParseWidth:"any"}),day:Uc({matchPatterns:Pz,defaultMatchWidth:"wide",parsePatterns:Iz,defaultParseWidth:"any"}),dayPeriod:Uc({matchPatterns:Bz,defaultMatchWidth:"any",parsePatterns:Fz,defaultParseWidth:"any"})},v1={code:"en-US",formatDistance:uz,formatLong:hz,formatRelative:gz,localize:Cz,match:zz,options:{weekStartsOn:0,firstWeekContainsDate:1}};function $z(t,e){const n=St(t,e==null?void 0:e.in);return Al(n,Mp(n))+1}function Lx(t,e){const n=St(t,e==null?void 0:e.in),s=+Cl(n)-+az(n);return Math.round(s/p1)+1}function Px(t,e){var h,m,x,y;const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=vo(),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=Ir(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=Ir(d,e);return+n>=+c?s+1:+n>=+f?s:s-1}function Hz(t,e){var c,d,f,h;const n=vo(),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=Px(t,e),r=xn((e==null?void 0:e.in)||t,0);return r.setFullYear(a,0,s),r.setHours(0,0,0,0),Ir(r,e)}function w1(t,e){const n=St(t,e==null?void 0:e.in),s=+Ir(n,e)-+Hz(n,e);return Math.round(s/p1)+1}function bn(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const yi={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)}},il={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},kC={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 yi.y(t,e)},Y:function(t,e,n,s){const a=Px(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=m1(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 yi.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=w1(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):bn(a,e.length)},I:function(t,e,n){const s=Lx(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"}):yi.d(t,e)},D:function(t,e,n){const s=$z(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=il.noon:s===0?a=il.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=il.evening:s>=12?a=il.afternoon:s>=4?a=il.morning:a=il.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 yi.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):yi.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"}):yi.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):yi.s(t,e)},S:function(t,e){return yi.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return CC(s);case"XXXX":case"XX":return no(s);case"XXXXX":case"XXX":default:return no(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return CC(s);case"xxxx":case"xx":return no(s);case"xxxxx":case"xxx":default:return no(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+SC(s,":");case"OOOO":default:return"GMT"+no(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+SC(s,":");case"zzzz":default:return"GMT"+no(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 SC(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 CC(t,e){return t%60===0?(t>0?"-":"+")+bn(Math.abs(t)/60,2):no(t,e)}function no(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 AC=(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"})}},k1=(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"})}},Uz=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return AC(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}}",AC(s,e)).replace("{{time}}",k1(a,e))},Fb={p:k1,P:Uz},Wz=/^D+$/,qz=/^Y+$/,Vz=["D","DD","YY","YYYY"];function Gz(t){return Wz.test(t)}function Yz(t){return qz.test(t)}function Kz(t,e,n){const s=Qz(t,e,n);if(console.warn(s),Vz.includes(t))throw new RangeError(s)}function Qz(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 Xz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Jz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zz=/^'([^]*?)'?$/,e3=/''/g,t3=/[a-zA-Z]/;function jC(t,e,n){var h,m,x,y,v,S,C,k;const s=vo(),a=(n==null?void 0:n.locale)??s.locale??v1,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=(C=s.locale)==null?void 0:C.options)==null?void 0:k.weekStartsOn)??0,c=St(t,n==null?void 0:n.in);if(!jl(c))throw new RangeError("Invalid time value");let d=e.match(Jz).map(N=>{const j=N[0];if(j==="p"||j==="P"){const _=Fb[j];return _(N,a.formatLong)}return N}).join("").match(Xz).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const j=N[0];if(j==="'")return{isToken:!1,value:n3(N)};if(kC[j])return{isToken:!0,value:N};if(j.match(t3))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)&&Yz(j)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Gz(j))&&Kz(j,e,String(t));const _=kC[j[0]];return _(c,j,a.localize,f)}).join("")}function n3(t){const e=t.match(Zz);return e?e[1].replace(e3,"'"):t}function NC(t,e){return St(t,e==null?void 0:e.in).getDate()}function s3(t,e){return St(t,e==null?void 0:e.in).getDay()}function a3(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 r3(){return Object.assign({},vo())}function bs(t,e){return St(t,e==null?void 0:e.in).getHours()}function i3(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 zs(t,e){return St(t,e==null?void 0:e.in).getMonth()}function wi(t){return St(t).getSeconds()}function zb(t){return+St(t)}function Jt(t,e){return St(t,e==null?void 0:e.in).getFullYear()}function Or(t,e){return+St(t)>+St(e)}function Ja(t,e){return+St(t)<+St(e)}function o3(t,e){return+St(t)==+St(e)}function l3(t,e){const n=c3(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 c3(t){var e;return typeof t=="function"&&((e=t.prototype)==null?void 0:e.constructor)===t}const u3=10;class S1{constructor(){Ze(this,"subPriority",0)}validate(e,n){return!0}}class d3 extends S1{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 f3 extends S1{constructor(n,s){super();Ze(this,"priority",u3);Ze(this,"subPriority",-1);this.context=n||(a=>xn(s,a))}set(n,s){return s.timestampIsSet?n:xn(n,l3(n,this.context))}}class hn{run(e,n,s,a){const r=this.parse(e,n,s,a);return r?{setter:new d3(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(e,n,s){return!0}}class p3 extends hn{constructor(){super(...arguments);Ze(this,"priority",140);Ze(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}/},Ga={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 On(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function Ya(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*Ep+r*_p+i*tz),rest:e.slice(n[0].length)}}function C1(t){return On(Wn.anyDigitsSigned,t)}function zn(t,e){switch(t){case 1:return On(Wn.singleDigit,e);case 2:return On(Wn.twoDigits,e);case 3:return On(Wn.threeDigits,e);case 4:return On(Wn.fourDigits,e);default:return On(new RegExp("^\\d{1,"+t+"}"),e)}}function tp(t,e){switch(t){case 1:return On(Wn.singleDigitSigned,e);case 2:return On(Wn.twoDigitsSigned,e);case 3:return On(Wn.threeDigitsSigned,e);case 4:return On(Wn.fourDigitsSigned,e);default:return On(new RegExp("^-?\\d{1,"+t+"}"),e)}}function Ix(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 A1(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 j1(t){return t%400===0||t%4===0&&t%100!==0}class h3 extends hn{constructor(){super(...arguments);Ze(this,"priority",130);Ze(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=A1(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 m3 extends hn{constructor(){super(...arguments);Ze(this,"priority",130);Ze(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=Px(n,r);if(a.isTwoDigitYear){const d=A1(a.year,i);return n.setFullYear(d,0,r.firstWeekContainsDate),n.setHours(0,0,0,0),Ir(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),Ir(n,r)}}class g3 extends hn{constructor(){super(...arguments);Ze(this,"priority",130);Ze(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),Cl(r)}}class b3 extends hn{constructor(){super(...arguments);Ze(this,"priority",130);Ze(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 x3 extends hn{constructor(){super(...arguments);Ze(this,"priority",120);Ze(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 y3 extends hn{constructor(){super(...arguments);Ze(this,"priority",120);Ze(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 v3 extends hn{constructor(){super(...arguments);Ze(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Ze(this,"priority",110)}parse(n,s,a){const r=i=>i-1;switch(s){case"M":return qn(On(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 w3 extends hn{constructor(){super(...arguments);Ze(this,"priority",110);Ze(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(On(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 k3(t,e,n){const s=St(t,n==null?void 0:n.in),a=w1(s,n)-e;return s.setDate(s.getDate()-a*7),St(s,n==null?void 0:n.in)}class S3 extends hn{constructor(){super(...arguments);Ze(this,"priority",100);Ze(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return On(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 Ir(k3(n,a,r),r)}}function C3(t,e,n){const s=St(t,n==null?void 0:n.in),a=Lx(s,n)-e;return s.setDate(s.getDate()-a*7),s}class A3 extends hn{constructor(){super(...arguments);Ze(this,"priority",100);Ze(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 On(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 Cl(C3(n,a))}}const j3=[31,28,31,30,31,30,31,31,30,31,30,31],N3=[31,29,31,30,31,30,31,31,30,31,30,31];class T3 extends hn{constructor(){super(...arguments);Ze(this,"priority",90);Ze(this,"subPriority",1);Ze(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return On(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=j1(a),i=n.getMonth();return r?s>=1&&s<=N3[i]:s>=1&&s<=j3[i]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class _3 extends hn{constructor(){super(...arguments);Ze(this,"priority",90);Ze(this,"subpriority",1);Ze(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 On(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 j1(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 Bx(t,e,n){var m,x,y,v;const s=vo(),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 Da(r,h,n)}class E3 extends hn{constructor(){super(...arguments);Ze(this,"priority",90);Ze(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=Bx(n,a,r),n.setHours(0,0,0,0),n}}class M3 extends hn{constructor(){super(...arguments);Ze(this,"priority",90);Ze(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=Bx(n,a,r),n.setHours(0,0,0,0),n}}class D3 extends hn{constructor(){super(...arguments);Ze(this,"priority",90);Ze(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=Bx(n,a,r),n.setHours(0,0,0,0),n}}function R3(t,e,n){const s=St(t,n==null?void 0:n.in),a=i3(s,n),r=e-a;return Da(s,r,n)}class O3 extends hn{constructor(){super(...arguments);Ze(this,"priority",90);Ze(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=R3(n,a),n.setHours(0,0,0,0),n}}class L3 extends hn{constructor(){super(...arguments);Ze(this,"priority",80);Ze(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(Ix(a),0,0,0),n}}class P3 extends hn{constructor(){super(...arguments);Ze(this,"priority",80);Ze(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(Ix(a),0,0,0),n}}class I3 extends hn{constructor(){super(...arguments);Ze(this,"priority",80);Ze(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(Ix(a),0,0,0),n}}class B3 extends hn{constructor(){super(...arguments);Ze(this,"priority",70);Ze(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return On(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 F3 extends hn{constructor(){super(...arguments);Ze(this,"priority",70);Ze(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return On(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 z3 extends hn{constructor(){super(...arguments);Ze(this,"priority",70);Ze(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return On(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 $3 extends hn{constructor(){super(...arguments);Ze(this,"priority",70);Ze(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return On(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 H3 extends hn{constructor(){super(...arguments);Ze(this,"priority",60);Ze(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return On(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 U3 extends hn{constructor(){super(...arguments);Ze(this,"priority",50);Ze(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return On(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 W3 extends hn{constructor(){super(...arguments);Ze(this,"priority",30);Ze(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 q3 extends hn{constructor(){super(...arguments);Ze(this,"priority",10);Ze(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Ya(Ga.basicOptionalMinutes,n);case"XX":return Ya(Ga.basic,n);case"XXXX":return Ya(Ga.basicOptionalSeconds,n);case"XXXXX":return Ya(Ga.extendedOptionalSeconds,n);case"XXX":default:return Ya(Ga.extended,n)}}set(n,s,a){return s.timestampIsSet?n:xn(n,n.getTime()-Qf(n)-a)}}class V3 extends hn{constructor(){super(...arguments);Ze(this,"priority",10);Ze(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Ya(Ga.basicOptionalMinutes,n);case"xx":return Ya(Ga.basic,n);case"xxxx":return Ya(Ga.basicOptionalSeconds,n);case"xxxxx":return Ya(Ga.extendedOptionalSeconds,n);case"xxx":default:return Ya(Ga.extended,n)}}set(n,s,a){return s.timestampIsSet?n:xn(n,n.getTime()-Qf(n)-a)}}class G3 extends hn{constructor(){super(...arguments);Ze(this,"priority",40);Ze(this,"incompatibleTokens","*")}parse(n){return C1(n)}set(n,s,a){return[xn(n,a*1e3),{timestampIsSet:!0}]}}class Y3 extends hn{constructor(){super(...arguments);Ze(this,"priority",20);Ze(this,"incompatibleTokens","*")}parse(n){return C1(n)}set(n,s,a){return[xn(n,a),{timestampIsSet:!0}]}}const K3={G:new p3,y:new h3,Y:new m3,R:new g3,u:new b3,Q:new x3,q:new y3,M:new v3,L:new w3,w:new S3,I:new A3,d:new T3,D:new _3,E:new E3,e:new M3,c:new D3,i:new O3,a:new L3,b:new P3,B:new I3,h:new B3,H:new F3,K:new z3,k:new $3,m:new H3,s:new U3,S:new W3,X:new q3,x:new V3,t:new G3,T:new Y3},Q3=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,X3=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,J3=/^'([^]*?)'?$/,Z3=/''/g,e$=/\S/,t$=/[a-zA-Z]/;function n$(t,e,n,s){var C,k,N,j,_,D,E,I;const a=()=>xn((s==null?void 0:s.in)||n,NaN),r=r3(),i=(s==null?void 0:s.locale)??r.locale??v1,c=(s==null?void 0:s.firstWeekContainsDate)??((k=(C=s==null?void 0:s.locale)==null?void 0:C.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=(_=s==null?void 0:s.locale)==null?void 0:_.options)==null?void 0:D.weekStartsOn)??r.weekStartsOn??((I=(E=r.locale)==null?void 0:E.options)==null?void 0:I.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 f3(s==null?void 0:s.in,n)],m=e.match(X3).map(O=>{const T=O[0];if(T in Fb){const M=Fb[T];return M(O,i.formatLong)}return O}).join("").match(Q3),x=[];for(let O of m){const T=O[0],M=K3[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 B=M.run(t,O,i.match,f);if(!B)return a();h.push(B.setter),t=B.rest}else{if(T.match(t$))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if(O==="''"?O="'":T==="'"&&(O=s$(O)),t.indexOf(O)===0)t=t.slice(O.length);else return a()}}if(t.length>0&&e$.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 s$(t){return t.match(J3)[1].replace(Z3,"'")}function a$(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return s.getFullYear()===a.getFullYear()&&s.getMonth()===a.getMonth()}function r$(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return+Bb(s)==+Bb(a)}function i$(t,e,n){const[s,a]=zr(n==null?void 0:n.in,t,e);return s.getFullYear()===a.getFullYear()}function Cu(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 o$(t,e,n){return Da(t,-1,n)}function l$(t,e){const n=()=>xn(e==null?void 0:e.in,NaN),a=f$(t);let r;if(a.date){const f=p$(a.date,2);r=h$(f.restDateString,f.year)}if(!r||isNaN(+r))return n();const i=+r;let c=0,d;if(a.time&&(c=m$(a.time),isNaN(c)))return n();if(a.timezone){if(d=g$(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+-].*)$/},c$=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,u$=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,d$=/^([+-])(\d{2})(?::?(\d{2}))?$/;function f$(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 p$(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 h$(t,e){if(e===null)return new Date(NaN);const n=t.match(c$);if(!n)return new Date(NaN);const s=!!n[4],a=Wc(n[1]),r=Wc(n[2])-1,i=Wc(n[3]),c=Wc(n[4]),d=Wc(n[5])-1;if(s)return w$(e,c,d)?b$(e,c,d):new Date(NaN);{const f=new Date(0);return!y$(e,r,i)||!v$(e,a)?new Date(NaN):(f.setUTCFullYear(e,r,Math.max(a,i)),f)}}function Wc(t){return t?parseInt(t):1}function m$(t){const e=t.match(u$);if(!e)return NaN;const n=Pg(e[1]),s=Pg(e[2]),a=Pg(e[3]);return k$(n,s,a)?n*Ep+s*_p+a*1e3:NaN}function Pg(t){return t&&parseFloat(t.replace(",","."))||0}function g$(t){if(t==="Z")return 0;const e=t.match(d$);if(!e)return 0;const n=e[1]==="+"?-1:1,s=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return S$(s,a)?n*(s*Ep+a*_p):NaN}function b$(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 x$=[31,null,31,30,31,30,31,31,30,31,30,31];function N1(t){return t%400===0||t%4===0&&t%100!==0}function y$(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(x$[e]||(N1(t)?29:28))}function v$(t,e){return e>=1&&e<=(N1(t)?366:365)}function w$(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function k$(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function S$(t,e){return e>=0&&e<=59}function Zs(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=a3(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 fl(t,e,n){const s=St(t,n==null?void 0:n.in),a=Math.trunc(s.getMonth()/3)+1,r=e-a;return Zs(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 qa(t,e,n){const s=St(t,n==null?void 0:n.in);return isNaN(+s)?xn(t,NaN):(s.setFullYear(e),s)}function lo(t,e,n){return Oa(t,-e,n)}function T1(t,e,n){return Ox(t,-1,n)}function TC(t,e,n){return Xf(t,-1,n)}function Ci(t,e,n){return Ra(t,-e,n)}function Dp(){return typeof window<"u"}function Pl(t){return _1(t)?(t.nodeName||"").toLowerCase():"#document"}function ra(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function lr(t){var e;return(e=(_1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _1(t){return Dp()?t instanceof Node||t instanceof ra(t).Node:!1}function js(t){return Dp()?t instanceof Element||t instanceof ra(t).Element:!1}function $r(t){return Dp()?t instanceof HTMLElement||t instanceof ra(t).HTMLElement:!1}function _C(t){return!Dp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ra(t).ShadowRoot}function Du(t){const{overflow:e,overflowX:n,overflowY:s,display:a}=ka(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&a!=="inline"&&a!=="contents"}function C$(t){return/^(table|td|th)$/.test(Pl(t))}function Rp(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const A$=/transform|translate|scale|rotate|perspective|filter/,j$=/paint|layout|strict|content/,Zi=t=>!!t&&t!=="none";let Ig;function Fx(t){const e=js(t)?ka(t):t;return Zi(e.transform)||Zi(e.translate)||Zi(e.scale)||Zi(e.rotate)||Zi(e.perspective)||!zx()&&(Zi(e.backdropFilter)||Zi(e.filter))||A$.test(e.willChange||"")||j$.test(e.contain||"")}function N$(t){let e=Ai(t);for(;$r(e)&&!Nl(e);){if(Fx(e))return e;if(Rp(e))return null;e=Ai(e)}return null}function zx(){return Ig==null&&(Ig=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ig}function Nl(t){return/^(html|body|#document)$/.test(Pl(t))}function ka(t){return ra(t).getComputedStyle(t)}function Op(t){return js(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ai(t){if(Pl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||_C(t)&&t.host||lr(t);return _C(e)?e.host:e}function E1(t){const e=Ai(t);return Nl(e)?t.ownerDocument?t.ownerDocument.body:t.body:$r(e)&&Du(e)?e:E1(e)}function Au(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=E1(t),r=a===((s=t.ownerDocument)==null?void 0:s.body),i=ra(a);if(r){const c=$b(i);return e.concat(i,i.visualViewport||[],Du(a)?a:[],c&&n?Au(c):[])}else return e.concat(a,Au(a,[],n))}function $b(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Tl=Math.min,co=Math.max,np=Math.round,cf=Math.floor,nr=t=>({x:t,y:t}),T$={left:"right",right:"left",bottom:"top",top:"bottom"};function _$(t,e,n){return co(t,Tl(e,n))}function Lp(t,e){return typeof t=="function"?t(e):t}function _l(t){return t.split("-")[0]}function Ru(t){return t.split("-")[1]}function E$(t){return t==="x"?"y":"x"}function $x(t){return t==="y"?"height":"width"}function ro(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Hx(t){return E$(ro(t))}function M$(t,e,n){n===void 0&&(n=!1);const s=Ru(t),a=Hx(t),r=$x(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 D$(t){const e=sp(t);return[Hb(t),e,Hb(e)]}function Hb(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const EC=["left","right"],MC=["right","left"],R$=["top","bottom"],O$=["bottom","top"];function L$(t,e,n){switch(t){case"top":case"bottom":return n?e?MC:EC:e?EC:MC;case"left":case"right":return e?R$:O$;default:return[]}}function P$(t,e,n,s){const a=Ru(t);let r=L$(_l(t),n==="start",s);return a&&(r=r.map(i=>i+"-"+a),e&&(r=r.concat(r.map(Hb)))),r}function sp(t){const e=_l(t);return T$[e]+t.slice(e.length)}function I$(t){return{top:0,right:0,bottom:0,left:0,...t}}function M1(t){return typeof t!="number"?I$(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 B$=typeof document<"u",F$=function(){},rp=B$?b.useLayoutEffect:F$;const z$={...GA},$$=z$.useInsertionEffect,H$=$$||(t=>t());function U$(t){const e=b.useRef(()=>{});return H$(()=>{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 DC(t,e,n){let{reference:s,floating:a}=t;const r=ro(e),i=Hx(e),c=$x(i),d=_l(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(Ru(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 W$(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}=Lp(e,t),v=M1(y),C=c[x?m==="floating"?"reference":"floating":m],k=ap(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(C)))==null||n?C:C.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)),_=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)/_.y,bottom:(D.bottom-k.bottom+v.bottom)/_.y,left:(k.left-D.left+v.left)/_.x,right:(D.right-k.right+v.right)/_.x}}const q$=50,V$=async(t,e,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:r=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:W$},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}=DC(f,s,d),x=s,y=0;const v={};for(let S=0;S<r.length;S++){const C=r[S];if(!C)continue;const{name:k,fn:N}=C,{x:j,y:_,data:D,reset:E}=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=_??m,v[k]={...v[k],...D},E&&y<q$&&(y++,typeof E=="object"&&(E.placement&&(x=E.placement),E.rects&&(f=E.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:a}):E.rects),{x:h,y:m}=DC(f,x,d)),S=-1)}return{x:h,y:m,placement:x,strategy:a,middlewareData:v}},G$=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}=Lp(t,e)||{};if(f==null)return{};const m=M1(h),x={x:n,y:s},y=Hx(a),v=$x(y),S=await i.getDimensions(f),C=y==="y",k=C?"top":"left",N=C?"bottom":"right",j=C?"clientHeight":"clientWidth",_=r.reference[v]+r.reference[y]-x[y]-r.floating[v],D=x[y]-r.reference[y],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let I=E?E[j]:0;(!I||!await(i.isElement==null?void 0:i.isElement(E)))&&(I=c.floating[j]||r.floating[v]);const O=_/2-D/2,T=I/2-S[v]/2-1,M=Tl(m[k],T),R=Tl(m[N],T),B=M,$=I-S[v]-R,U=I/2-S[v]/2+O,L=_$(B,U,$),F=!d.arrow&&Ru(a)!=null&&U!==L&&r.reference[v]/2-(U<B?M:R)-S[v]/2<0,W=F?U<B?U-B:U-$:0;return{[y]:x[y]+W,data:{[y]:L,centerOffset:U-L-W,...F&&{alignmentOffset:W}},reset:F}}}),Y$=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,...C}=Lp(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const k=_l(a),N=ro(c),j=_l(c)===c,_=await(d.isRTL==null?void 0:d.isRTL(f.floating)),D=x||(j||!S?[sp(c)]:D$(c)),E=v!=="none";!x&&E&&D.push(...P$(c,S,v,_));const I=[c,...D],O=await d.detectOverflow(e,C),T=[];let M=((s=r.flip)==null?void 0:s.overflows)||[];if(h&&T.push(O[k]),m){const U=M$(a,i,_);T.push(O[U[0]],O[U[1]])}if(M=[...M,{placement:a,overflows:T}],!T.every(U=>U<=0)){var R,B;const U=(((R=r.flip)==null?void 0:R.index)||0)+1,L=I[U];if(L&&(!(m==="alignment"?N!==ro(L):!1)||M.every(V=>ro(V.placement)===N?V.overflows[0]>0:!0)))return{data:{index:U,overflows:M},reset:{placement:L}};let F=(B=M.filter(W=>W.overflows[0]<=0).sort((W,V)=>W.overflows[1]-V.overflows[1])[0])==null?void 0:B.placement;if(!F)switch(y){case"bestFit":{var $;const W=($=M.filter(V=>{if(E){const Y=ro(V.placement);return Y===N||Y==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(Y=>Y>0).reduce((Y,z)=>Y+z,0)]).sort((V,Y)=>V[1]-Y[1])[0])==null?void 0:$[0];W&&(F=W);break}case"initialPlacement":F=c;break}if(a!==F)return{reset:{placement:F}}}return{}}}},K$=new Set(["left","top"]);async function Q$(t,e){const{placement:n,platform:s,elements:a}=t,r=await(s.isRTL==null?void 0:s.isRTL(a.floating)),i=_l(n),c=Ru(n),d=ro(n)==="y",f=K$.has(i)?-1:1,h=r&&d?-1:1,m=Lp(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 X$=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 Q$(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 D1(t){const e=ka(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const a=$r(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 Ux(t){return js(t)?t:t.contextElement}function xl(t){const e=Ux(t);if(!$r(e))return nr(1);const n=e.getBoundingClientRect(),{width:s,height:a,$:r}=D1(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 J$=nr(0);function R1(t){const e=ra(t);return!zx()||!e.visualViewport?J$:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Z$(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ra(t)?!1:e}function xo(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),r=Ux(t);let i=nr(1);e&&(s?js(s)&&(i=xl(s)):i=xl(t));const c=Z$(r,n,s)?R1(r):nr(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=ra(r),y=s&&js(s)?ra(s):s;let v=x,S=$b(v);for(;S&&s&&y!==v;){const C=xl(S),k=S.getBoundingClientRect(),N=ka(S),j=k.left+(S.clientLeft+parseFloat(N.paddingLeft))*C.x,_=k.top+(S.clientTop+parseFloat(N.paddingTop))*C.y;d*=C.x,f*=C.y,h*=C.x,m*=C.y,d+=j,f+=_,v=ra(S),S=$b(v)}}return ap({width:h,height:m,x:d,y:f})}function Pp(t,e){const n=Op(t).scrollLeft;return e?e.left+n:xo(lr(t)).left+n}function O1(t,e){const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-Pp(t,n),a=n.top+e.scrollTop;return{x:s,y:a}}function eH(t){let{elements:e,rect:n,offsetParent:s,strategy:a}=t;const r=a==="fixed",i=lr(s),c=e?Rp(e.floating):!1;if(s===i||c&&r)return n;let d={scrollLeft:0,scrollTop:0},f=nr(1);const h=nr(0),m=$r(s);if((m||!m&&!r)&&((Pl(s)!=="body"||Du(i))&&(d=Op(s)),m)){const y=xo(s);f=xl(s),h.x=y.x+s.clientLeft,h.y=y.y+s.clientTop}const x=i&&!m&&!r?O1(i,d):nr(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 tH(t){return Array.from(t.getClientRects())}function nH(t){const e=lr(t),n=Op(t),s=t.ownerDocument.body,a=co(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),r=co(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+Pp(t);const c=-n.scrollTop;return ka(s).direction==="rtl"&&(i+=co(e.clientWidth,s.clientWidth)-a),{width:a,height:r,x:i,y:c}}const RC=25;function sH(t,e){const n=ra(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=zx();(!h||h&&e==="fixed")&&(c=a.offsetLeft,d=a.offsetTop)}const f=Pp(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<=RC&&(r-=v)}else f<=RC&&(r+=f);return{width:r,height:i,x:c,y:d}}function aH(t,e){const n=xo(t,!0,e==="fixed"),s=n.top+t.clientTop,a=n.left+t.clientLeft,r=$r(t)?xl(t):nr(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 OC(t,e,n){let s;if(e==="viewport")s=sH(t,n);else if(e==="document")s=nH(lr(t));else if(js(e))s=aH(e,n);else{const a=R1(t);s={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ap(s)}function L1(t,e){const n=Ai(t);return n===e||!js(n)||Nl(n)?!1:ka(n).position==="fixed"||L1(n,e)}function rH(t,e){const n=e.get(t);if(n)return n;let s=Au(t,[],!1).filter(c=>js(c)&&Pl(c)!=="body"),a=null;const r=ka(t).position==="fixed";let i=r?Ai(t):t;for(;js(i)&&!Nl(i);){const c=ka(i),d=Fx(i);!d&&c.position==="fixed"&&(a=null),(r?!d&&!a:!d&&c.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Du(i)&&!d&&L1(t,i))?s=s.filter(h=>h!==i):a=c,i=Ai(i)}return e.set(t,s),s}function iH(t){let{element:e,boundary:n,rootBoundary:s,strategy:a}=t;const i=[...n==="clippingAncestors"?Rp(e)?[]:rH(e,this._c):[].concat(n),s],c=OC(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=OC(e,i[x],a);d=co(y.top,d),f=Tl(y.right,f),h=Tl(y.bottom,h),m=co(y.left,m)}return{width:f-m,height:h-d,x:m,y:d}}function oH(t){const{width:e,height:n}=D1(t);return{width:e,height:n}}function lH(t,e,n){const s=$r(e),a=lr(e),r=n==="fixed",i=xo(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const d=nr(0);function f(){d.x=Pp(a)}if(s||!s&&!r)if((Pl(e)!=="body"||Du(a))&&(c=Op(e)),s){const y=xo(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?O1(a,c):nr(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 Bg(t){return ka(t).position==="static"}function LC(t,e){if(!$r(t)||ka(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return lr(t)===n&&(n=n.ownerDocument.body),n}function P1(t,e){const n=ra(t);if(Rp(t))return n;if(!$r(t)){let a=Ai(t);for(;a&&!Nl(a);){if(js(a)&&!Bg(a))return a;a=Ai(a)}return n}let s=LC(t,e);for(;s&&C$(s)&&Bg(s);)s=LC(s,e);return s&&Nl(s)&&Bg(s)&&!Fx(s)?n:s||N$(t)||n}const cH=async function(t){const e=this.getOffsetParent||P1,n=this.getDimensions,s=await n(t.floating);return{reference:lH(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function uH(t){return ka(t).direction==="rtl"}const dH={convertOffsetParentRelativeRectToViewportRelativeRect:eH,getDocumentElement:lr,getClippingRect:iH,getOffsetParent:P1,getElementRects:cH,getClientRects:tH,getDimensions:oH,getScale:xl,isElement:js,isRTL:uH};function I1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function fH(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)),C=cf(a.clientHeight-(m+y)),k=cf(h),j={rootMargin:-v+"px "+-S+"px "+-C+"px "+-k+"px",threshold:co(0,Tl(1,d))||1};let _=!0;function D(E){const I=E[0].intersectionRatio;if(I!==d){if(!_)return i();I?i(!1,I):s=setTimeout(()=>{i(!1,1e-7)},1e3)}I===1&&!I1(f,t.getBoundingClientRect())&&i(),_=!1}try{n=new IntersectionObserver(D,{...j,root:a.ownerDocument})}catch{n=new IntersectionObserver(D,j)}n.observe(t)}return i(!0),r}function pH(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=Ux(t),h=a||r?[...f?Au(f):[],...e?Au(e):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),r&&k.addEventListener("resize",n)});const m=f&&c?fH(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?xo(t):null;d&&C();function C(){const k=xo(t);S&&!I1(S,k)&&n(),S=k,v=requestAnimationFrame(C)}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 hH=X$,mH=Y$,PC=G$,gH=(t,e,n)=>{const s=new Map,a={platform:dH,...n},r={...a.platform,_c:s};return V$(t,e,{...a,platform:r})};var bH=typeof document<"u",xH=function(){},_f=bH?b.useLayoutEffect:xH;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 B1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function IC(t,e){const n=B1(t);return Math.round(e*n)/n}function Fg(t){const e=b.useRef(t);return _f(()=>{e.current=t}),e}function yH(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),[C,k]=b.useState(null),N=b.useCallback(V=>{V!==E.current&&(E.current=V,S(V))},[]),j=b.useCallback(V=>{V!==I.current&&(I.current=V,k(V))},[]),_=r||v,D=i||C,E=b.useRef(null),I=b.useRef(null),O=b.useRef(h),T=d!=null,M=Fg(d),R=Fg(a),B=Fg(f),$=b.useCallback(()=>{if(!E.current||!I.current)return;const V={placement:e,strategy:n,middleware:x};R.current&&(V.platform=R.current),gH(E.current,I.current,V).then(Y=>{const z={...Y,isPositioned:B.current!==!1};U.current&&!ip(O.current,z)&&(O.current=z,Rl.flushSync(()=>{m(z)}))})},[x,e,n,R,B]);_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=_),D&&(I.current=D),_&&D){if(M.current)return M.current(_,D,$);$()}},[_,D,$,M,T]);const L=b.useMemo(()=>({reference:E,floating:I,setReference:N,setFloating:j}),[N,j]),F=b.useMemo(()=>({reference:_,floating:D}),[_,D]),W=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!F.floating)return V;const Y=IC(F.floating,h.x),z=IC(F.floating,h.y);return c?{...V,transform:"translate("+Y+"px, "+z+"px)",...B1(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:z}},[n,c,F.floating,h.x,h.y]);return b.useMemo(()=>({...h,update:$,refs:L,elements:F,floatingStyles:W}),[h,$,L,F,W])}const vH=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?PC({element:s.current,padding:a}).fn(n):{}:s?PC({element:s,padding:a}).fn(n):{}}}},wH=(t,e)=>{const n=hH(t);return{name:n.name,fn:n.fn,options:[t,e]}},kH=(t,e)=>{const n=mH(t);return{name:n.name,fn:n.fn,options:[t,e]}},SH=(t,e)=>{const n=vH(t);return{name:n.name,fn:n.fn,options:[t,e]}},CH={...GA};let BC=!1,AH=0;const FC=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+AH++;function jH(){const[t,e]=b.useState(()=>BC?FC():void 0);return rp(()=>{t==null&&e(FC())},[]),b.useEffect(()=>{BC=!0},[]),t}const NH=CH.useId,F1=NH||jH,TH=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}={},...C}=e,k=F1(),[N,j]=b.useState(!1);if(rp(()=>{if(!a)return;ka(a).direction==="rtl"&&j(!0)},[a]),!a)return null;const[_,D]=s.split("-"),E=_==="top"||_==="bottom";let I=m;(E&&i!=null&&i.x||!E&&i!=null&&i.y)&&(I=null);const O=h*2,T=O/2,M=c/2*(f/-8+1),R=d/2*f/4,B=!!y,$=I&&D==="end"?"bottom":"top";let U=I&&D==="end"?"right":"left";I&&N&&(U=D==="end"?"left":"right");const L=(r==null?void 0:r.x)!=null?I||r.x:"",F=(r==null?void 0:r.y)!=null?I||r.y:"",W=y||"M0,0"+(" H"+c)+(" L"+(c-M)+","+(d-R))+(" Q"+c/2+","+d+" "+M+","+(d-R))+" Z",V={top:B?"rotate(180deg)":"",left:B?"rotate(90deg)":"rotate(-90deg)",bottom:B?"":"rotate(180deg)",right:B?"rotate(-90deg)":"rotate(90deg)"}[_];return o.jsxs("svg",{...C,"aria-hidden":!0,ref:n,width:B?c:c+O,height:c,viewBox:"0 0 "+c+" "+(d>c?d:c),style:{position:"absolute",pointerEvents:"none",[U]:L,[$]:F,[_]:E||B?"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?C.fill:"none",d:W}),o.jsx("clipPath",{id:k,children:o.jsx("rect",{x:-T,y:T*(B?-1:1),width:c+O,height:c})})]})});function _H(){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 EH=b.createContext(null),MH=b.createContext(null),DH=()=>{var t;return((t=b.useContext(EH))==null?void 0:t.id)||null},RH=()=>b.useContext(MH);function OH(t){const{open:e=!1,onOpenChange:n,elements:s}=t,a=F1(),r=b.useRef({}),[i]=b.useState(()=>_H()),c=DH()!=null,[d,f]=b.useState(s.reference),h=U$((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 LH(t){t===void 0&&(t={});const{nodeId:e}=t,n=OH({...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=RH();rp(()=>{h&&(m.current=h)},[h]);const y=yH({...t,elements:{...a,...c&&{reference:c}}}),v=b.useCallback(j=>{const _=js(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(_),y.refs.setReference(_)},[y.refs]),S=b.useCallback(j=>{(js(j)||j===null)&&(m.current=j,i(j)),(js(y.refs.reference.current)||y.refs.reference.current===null||j!==null&&!js(j))&&y.refs.setReference(j)},[y.refs]),C=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:C,elements:k,nodeId:e}),[y,C,k,e,s]);return rp(()=>{s.dataRef.current.floatingContext=N;const j=x==null?void 0:x.nodesRef.current.find(_=>_.id===e);j&&(j.context=N)}),b.useMemo(()=>({...y,context:N,refs:C,elements:k}),[y,C,k,N])}/*!
106
+ react-datepicker v9.1.0
107
+ https://github.com/Hacker0x01/react-datepicker
108
+ Released under the MIT License.
109
+ */var Ub=function(e,n){return Ub=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])},Ub(e,n)};function ms(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ub(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 Za(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 PH=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 Ce.createElement("div",{className:r,"aria-label":d,role:c?void 0:"dialog","aria-modal":c?void 0:"true",translate:"no"},i)},IH=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},Ip=function(t){var e=t.children,n=t.onClickOutside,s=t.className,a=t.containerRef,r=t.style,i=t.ignoreClass,c=IH(n,i);return Ce.createElement("div",{className:s,style:r,ref:function(d){c.current=d,a&&(a.current=d)}},e)},uf=null,zC=!1;function z1(){if(zC)return uf;zC=!0;try{var t="date-fns-tz";uf=require(t)}catch{uf=null}return uf}function $C(t,e){if(!e)return t;var n=z1();return n?n.toZonedTime(t,e):t}function jr(t,e){if(!e)return t;var n=z1();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 $1(){var t=typeof window<"u"?window:globalThis;return t}var Ou=12;function ln(t){if(t==null)return new Date;var e=typeof t=="string"?l$(t):St(t);return Fs(e)?e:new Date}function eo(t,e,n,s,a){a===void 0&&(a=ln());for(var r=El(n)||El(Wx()),i=Array.isArray(e)?e:[e],c=0,d=i;c<d.length;c++){var f=d[c],h=n$(t,f,a,{locale:r});if(Fs(h)&&(!s||t===Dn(h,f,n)))return h}if(!s&&t&&t.length>=8){var m=new Date(t);if(jl(m))return m}return null}function BH(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 Fs(t){return jl(t)}function io(t){return t==null?null:tr(t)&&jl(t)?t:null}function Dn(t,e,n){if(n==="en")return jC(t,e,{useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0});var s=n?El(n):void 0;return n&&!s&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),s=s||El(Wx()),jC(t,e,{locale:s,useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0})}function Bs(t,e){var n=e.dateFormat,s=e.locale,a=Array.isArray(n)&&n.length>0?n[0]:n;return t&&Dn(t,a,s)||""}var H1=" - ";function FH(t,e,n){if(!t&&!e)return"";var s=t?Bs(t,n):"",a=e?Bs(e,n):"",r=n.rangeSeparator||H1;return"".concat(s).concat(r).concat(a)}function zH(t,e){if(!(t!=null&&t.length))return"";var n=t[0]?Bs(t[0],e):"";if(t.length===1)return n;if(t.length===2&&t[1]){var s=Bs(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 $H(t){return Lx(t)}function HH(t,e){return Dn(t,"ddd",e)}function Qc(t){return bo(t)}function ki(t,e,n){var s=El(e||Wx());return Ir(t,{locale:s,weekStartsOn:n})}function Lr(t){return x1(t)}function Xc(t){return Mp(t)}function HC(t){return Bb(t)}function UC(){return bo(ln())}function WC(t){return g1(t)}function UH(t){return lz(t)}function WH(t){return b1(t)}function Va(t,e){return t&&e?i$(t,e):!t&&!e}function Cs(t,e){return t&&e?a$(t,e):!t&&!e}function op(t,e){return t&&e?r$(t,e):!t&&!e}function an(t,e){return t&&e?iz(t,e):!t&&!e}function oo(t,e){return t&&e?o3(t,e):!t&&!e}function so(t,e,n){var s,a=bo(e),r=g1(n);try{s=Cu(t,{start:a,end:r})}catch{s=!1}return s}function Wx(){var t=$1();return t.__localeId__}function El(t){if(typeof t=="string"){var e=$1();return e.__localeData__?e.__localeData__[t]:void 0}else return t}function qH(t,e,n){return e(Dn(t,"EEEE",n))}function VH(t,e){return Dn(t,"EEEEEE",e)}function GH(t,e){return Dn(t,"EEE",e)}function qx(t,e){return Dn(Zs(ln(),t),"LLLL",e)}function U1(t,e){return Dn(Zs(ln(),t),"LLL",e)}function YH(t,e){return Dn(fl(ln(),t),"QQQ",e)}function xa(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:Lu(t,{minDate:s,maxDate:a})||r&&r.some(function(m){return m instanceof Date?an(t,m):an(t,m.date)})||i&&i.some(function(m){var x=m.start,y=m.end;return Cu(t,{start:x,end:y})})||c&&!c.some(function(m){return an(t,m)})||d&&!d.some(function(m){var x=m.start,y=m.end;return Cu(t,{start:x,end:y})})||f&&!f(ln(t))||!1}function Vx(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 Cu(t,{start:i,end:c})}):s&&s.some(function(r){var i;return r instanceof Date?an(t,r):an(t,(i=r.date)!==null&&i!==void 0?i:new Date)})||!1}function W1(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate;return Lu(t,{minDate:s?x1(s):void 0,maxDate:a?b1(a):void 0})||(r==null?void 0:r.some(function(d){return Cs(t,d instanceof Date?d:d.date)}))||i&&!i.some(function(d){return Cs(t,d)})||c&&!c(ln(t))||!1}function df(t,e,n,s){var a=Jt(t),r=zs(t),i=Jt(e),c=zs(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 KH(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates;return Lu(t,{minDate:s,maxDate:a})||r&&r.some(function(c){return Cs(c instanceof Date?c:c.date,t)})||i&&!i.some(function(c){return Cs(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:Lu(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||!jl(e)||!jl(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 Lu(f,{minDate:s?Mp(s):void 0,maxDate:a?y1(a):void 0})||(r==null?void 0:r.some(function(h){return Va(f,h instanceof Date?h:h.date)}))||i&&!i.some(function(h){return Va(f,h)})||c&&!c(ln(f))||!1}function hf(t,e,n,s){var a=Jt(t),r=vi(t),i=Jt(e),c=vi(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 Lu(t,e){var n,s=e===void 0?{}:e,a=s.minDate,r=s.maxDate;return(n=a&&Al(t,a)<0||r&&Al(t,r)>0)!==null&&n!==void 0?n:!1}function qC(t,e){return e.some(function(n){return bs(n)===bs(t)&&xs(n)===xs(t)&&wi(n)===wi(t)})}function VC(t,e){var n=e===void 0?{}:e,s=n.excludeTimes,a=n.includeTimes,r=n.filterTime;return s&&qC(t,s)||a&&!qC(t,a)||r&&!r(t)||!1}function GC(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,wi(t));var r=ln();r=jf(r,bs(n)),r=Nf(r,xs(n)),r=Tf(r,wi(n));var i=ln();i=jf(i,bs(s)),i=Nf(i,xs(s)),i=Tf(i,wi(s));var c;try{c=!Cu(a,{start:r,end:i})}catch{c=!1}return c}function YC(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=lo(t,1);return s&&Jf(s,r)>0||a&&a.every(function(i){return Jf(i,r)>0})||!1}function KC(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=Oa(t,1);return s&&Jf(r,s)>0||a&&a.every(function(i){return Jf(r,i)>0})||!1}function QH(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=Mp(t),i=T1(r);return s&&Zf(s,i)>0||a&&a.every(function(c){return Zf(c,i)>0})||!1}function XH(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=y1(t),i=Ox(r,1);return s&&Zf(i,s)>0||a&&a.every(function(c){return Zf(i,c)>0})||!1}function QC(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=Ci(t,1);return s&&ep(s,r)>0||a&&a.every(function(i){return ep(i,r)>0})||!1}function JH(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.yearItemNumber,r=a===void 0?Ou:a,i=Xc(Ci(t,r)),c=Er(i,r).endPeriod,d=s&&Jt(s);return d&&d>c||!1}function XC(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=Ra(t,1);return s&&ep(r,s)>0||a&&a.every(function(i){return ep(r,i)>0})||!1}function ZH(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.yearItemNumber,r=a===void 0?Ou:a,i=Ra(t,r),c=Er(i,r).startPeriod,d=s&&Jt(s);return d&&d<c||!1}function q1(t){var e=t.minDate,n=t.includeDates;if(n&&e){var s=n.filter(function(a){return Al(a,e)>=0});return vC(s)}else return n?vC(n):e}function V1(t){var e=t.maxDate,n=t.includeDates;if(n&&e){var s=n.filter(function(a){return Al(a,e)<=0});return yC(s)}else return n?yC(n):e}function JC(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(tr(i)){var c=Dn(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=Dn(v,"MM.dd.yyyy"),d=s.get(c)||[];d.includes(h)||(d.push(h),s.set(c,d))}}}}return s}function eU(t,e){return t.length!==e.length?!1:t.every(function(n,s){return n===e[s]})}function tU(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(tr(a)){var i=Dn(a,"MM.dd.yyyy"),c=n.get(i)||{className:"",holidayNames:[]};if(!("className"in c&&c.className===e&&eU(c.holidayNames,[r]))){c.className=e;var d=c.holidayNames;c.holidayNames=d?Za(Za([],d,!0),[r],!1):[r],n.set(i,c)}}}),n}function nU(t,e,n,s,a){for(var r=a.length,i=[],c=0;c<r;c++){var d=t,f=a[c];f&&(d=nz(d,bs(f)),d=Su(d,xs(f)),d=rz(d,wi(f)));var h=Su(t,(n+1)*s);Or(d,e)&&Ja(d,h)&&f!=null&&i.push(f)}return i}function ol(t){return t<10?"0".concat(t):"".concat(t)}function Er(t,e){e===void 0&&(e=Ou);var n=Math.ceil(Jt(t)/e)*e,s=n-(e-1);return{startPeriod:s,endPeriod:n}}function sU(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 ZC(t){var e=t.getSeconds(),n=t.getMilliseconds();return St(t.getTime()-e*1e3-n)}function G1(t,e){return ZC(t).getTime()===ZC(e).getTime()}function eA(t){if(!tr(t))throw new Error("Invalid date");var e=new Date(t);return e.setHours(0,0,0,0),e}function zg(t,e){if(!tr(t)||!tr(e))throw new Error("Invalid date received");var n=eA(t),s=eA(e);return Ja(n,s)}function Y1(t){return t.key===dt.Space}var $g=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.inputRef=Ce.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}):Ce.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 Ce.createElement("div",{className:"react-datepicker__input-time-container"},Ce.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),Ce.createElement("div",{className:"react-datepicker-time__input-container"},Ce.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))},e})(b.Component),aU=(function(t){ms(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 an(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),xa(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 Vx(n.props.day,{excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals})},n.isStartOfWeek=function(){return an(n.props.day,ki(n.props.day,n.props.locale,n.props.calendarStartDay))},n.isSameWeek=function(s){return n.props.showWeekPicker&&an(s,ki(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=Dn(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=Dn(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:so(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&&(Ja(y,x)||oo(y,x)))return so(r,y,x);if(c&&h&&(Or(y,h)||oo(y,h)))return so(r,h,y);if(d&&h&&!x){if(oo(y,h)||Or(y,h))return so(r,h,y);if(m&&Ja(y,h))return so(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?an(r,h):f&&d&&i&&h?an(r,Ja(h,i)?h:i):an(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?an(r,m):d&&f&&h&&m?an(r,Ja(m,h)?h:m):d?an(r,m):an(r,i)},n.isRangeStart=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:an(r,a)},n.isRangeEnd=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:an(i,a)},n.isWeekend=function(){var s=s3(n.props.day);return s===0||s===6},n.isAfterMonth=function(){return n.props.month!==void 0&&(n.props.month+1)%12===zs(n.props.day)},n.isBeforeMonth=function(){return n.props.month!==void 0&&(zs(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 as("react-datepicker__day",a,"react-datepicker__day--"+HH(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(Dn(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=Dn(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?an(h,a):an(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)&&an(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(NC(n.props.day),n.props.day):NC(n.props.day)},n.render=function(){return Ce.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()!==""&&Ce.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),rU=(function(t){ms(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&&!an(n.props.date,n.props.selected)&&an(n.props.date,n.props.preSelection)},n.getTabIndex=function(){return n.props.showWeekPicker&&n.props.showWeekNumber&&(n.isKeyboardSelected()||an(n.props.date,n.props.selected)&&an(n.props.preSelection,n.props.selected))?0:-1},n.handleFocusWeekNumber=function(s){var a=!1;n.getTabIndex()===0&&!(s!=null&&s.isInputFocused)&&an(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&&an(this.props.date,this.props.selected)};return Ce.createElement("div",{ref:this.weekNumberEl,className:as(d),"aria-label":"".concat(i," ").concat(this.props.weekNumber),onClick:this.handleClick,onKeyDown:this.handleOnKeyDown,tabIndex:this.getTabIndex(),role:"gridcell"},s)},e})(b.Component),iU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.isDisabled=function(s){return xa(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):$H(s)},n.isWeekDisabled=function(){for(var s=n.startOfWeek(),a=Da(s,6),r=new Date(s);r<=a;){if(!n.isDisabled(r))return!1;r=Da(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(Ce.createElement(rU,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=Da(s,c);return Ce.createElement(aU,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 ki(n.props.day,n.props.locale,n.props.calendarStartDay)},n.isKeyboardSelected=function(){return!n.props.disabledKeyboardNavigation&&!an(n.startOfWeek(),n.props.selected)&&an(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":an(this.startOfWeek(),this.props.selected),"react-datepicker__week--keyboard-selected":this.isKeyboardSelected()},s=this.props.weekClassName?this.props.weekClassName(this.startOfWeek()):void 0;return Ce.createElement("div",{className:as(n,s),role:"row"},this.renderDays())},e})(b.Component),qc,oU=6,yl={TWO_COLUMNS:"two_columns",THREE_COLUMNS:"three_columns",FOUR_COLUMNS:"four_columns"},Hg=(qc={},qc[yl.TWO_COLUMNS]={grid:[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]],verticalNavigationOffset:2},qc[yl.THREE_COLUMNS]={grid:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]],verticalNavigationOffset:3},qc[yl.FOUR_COLUMNS]={grid:[[0,1,2,3],[4,5,6,7],[8,9,10,11]],verticalNavigationOffset:4},qc),mf=1;function tA(t,e){return t?yl.FOUR_COLUMNS:e?yl.TWO_COLUMNS:yl.THREE_COLUMNS}var lU=(function(t){ms(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.MONTH_REFS=Za([],Array(12),!0).map(function(){return b.createRef()}),n.QUARTER_REFS=Za([],Array(4),!0).map(function(){return b.createRef()}),n.isDisabled=function(s){return xa(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 Vx(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:Cs(Zs(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(fl(r,s),i)},n.isRangeEndMonth=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:Cs(Zs(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(fl(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=Zs(i,s),h=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return d?Cs(f,h):Cs(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=Zs(i,s),m=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return d||f?Cs(h,m):Cs(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=Da(s,6);return Cs(s,a)||Cs(r,a)},n.isCurrentMonth=function(s,a){return Jt(s)===Jt(ln())&&a===zs(ln())},n.isCurrentQuarter=function(s,a){return Jt(s)===Jt(ln())&&a===vi(ln())},n.isSelectedMonth=function(s,a,r){return zs(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 vi(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=zs(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=vi(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(!Fs(n.props.day))return[];for(var s=[],a=n.props.fixedHeight,r=0,i=!1,c=ki(Lr(n.props.day),n.props.locale,n.props.calendarStartDay),d=function(v){return n.props.showWeekPicker?ki(v,n.props.locale,n.props.calendarStartDay):n.props.preSelection},f=function(v){return n.props.showWeekPicker?ki(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(Ce.createElement(iU,qt({},n.props,{ariaLabelPrefix:n.props.weekAriaLabelPrefix,key:r,day:c,month:zs(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>=oU,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(Lr(c),s)},n.onMonthMouseEnter=function(s){var a=n.isMonthDisabledForLabelDate(s),r=a.isDisabled,i=a.labelDate;r||n.handleDayMouseEnter(Lr(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=tA(y,v),C=n.getVerticalOffset(S),k=(i=Hg[S])===null||i===void 0?void 0:i.grid,N=function(I,O,T){var M,R,B=O,$=T;switch(I){case dt.ArrowRight:B=Oa(O,mf),$=T===11?0:T+mf;break;case dt.ArrowLeft:B=lo(O,mf),$=T===0?11:T-mf;break;case dt.ArrowUp:B=lo(O,C),$=!((M=k==null?void 0:k[0])===null||M===void 0)&&M.includes(T)?T+12-C:T-C;break;case dt.ArrowDown:B=Oa(O,C),$=!((R=k==null?void 0:k[k.length-1])===null||R===void 0)&&R.includes(T)?T-12+C:T+C;break}return{newCalculatedDate:B,newCalculatedMonth:$}},j=function(I,O,T){for(var M=40,R=I,B=!1,$=0,U=N(R,O,T),L=U.newCalculatedDate,F=U.newCalculatedMonth;!B;){if($>=M){L=O,F=T;break}if(m&&L<m){R=dt.ArrowRight;var W=N(R,L,F);L=W.newCalculatedDate,F=W.newCalculatedMonth}if(x&&L>x){R=dt.ArrowLeft;var W=N(R,L,F);L=W.newCalculatedDate,F=W.newCalculatedMonth}if(KH(L,n.props)){var W=N(R,L,F);L=W.newCalculatedDate,F=W.newCalculatedMonth}else B=!0;$++}return{newCalculatedDate:L,newCalculatedMonth:F}};if(a===dt.Enter){n.isMonthDisabled(r)||(n.onMonthClick(s,r),h==null||h(d));return}var _=j(a,f,r),D=_.newCalculatedDate,E=_.newCalculatedMonth;switch(a){case dt.ArrowRight:case dt.ArrowLeft:case dt.ArrowUp:case dt.ArrowDown:n.handleMonthNavigation(E,D);break}}},n.getVerticalOffset=function(s){var a,r;return(r=(a=Hg[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=fl(n.props.day,a);ff(r,n.props)||n.handleDayClick(HC(r),s)},n.onQuarterMouseEnter=function(s){var a=fl(n.props.day,s);ff(a,n.props)||n.handleDayMouseEnter(HC(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,Ox(n.props.preSelection,1));break;case dt.ArrowLeft:if(!n.props.preSelection)break;n.handleQuarterNavigation(a===1?4:a-1,T1(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=Zs(i,s);return c?{isDisabled:!0,labelDate:Zs(i,s)}:{isDisabled:(a=(d||f||h||m)&&W1(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(Zs(r,s)):void 0,m=n.getSelection();return as("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=zs(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=vi(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=Zs(f,s),x=n.isDisabled(m)||n.isExcluded(m)?d:i;return"".concat(x," ").concat(Dn(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,C=(d||f||h||m||x||S)&&ff(fl(r,s),n.props),k=n.getSelection();return as("react-datepicker__quarter-text","react-datepicker__quarter-".concat(s),{"react-datepicker__quarter-text--disabled":C,"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()&&!C,"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=U1(s,c),h=qx(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=YH(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=Hg[tA(i,r)])===null||s===void 0?void 0:s.grid;return f==null?void 0:f.map(function(h,m){return Ce.createElement("div",{className:"react-datepicker__month-wrapper",key:m},h.map(function(x,y){return Ce.createElement("div",{ref:n.MONTH_REFS[x],key:y,onClick:function(v){n.onMonthClick(v,x)},onKeyDown:function(v){Y1(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 Ce.createElement("div",{className:"react-datepicker__quarter-wrapper"},i.map(function(c,d){return Ce.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 as("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=Fs(r)?"".concat(d).concat(Dn(r,"MMMM, yyyy",this.props.locale)):"",h=s||a;return h?Ce.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()):Ce.createElement("div",{role:"table"},this.props.dayNamesHeader&&Ce.createElement("div",{role:"rowgroup"},this.props.dayNamesHeader),this.props.monthHeader&&Ce.createElement("div",{role:"rowgroup"},this.props.monthHeader),Ce.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&&Ce.createElement("div",{role:"rowgroup"},this.props.monthFooter))},e})(b.Component),cU=(function(t){ms(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 Ce.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)?Ce.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 Ce.createElement(Ip,{className:"react-datepicker__month-dropdown",onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),uU=(function(t){ms(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 Ce.createElement("option",{key:a,value:r},a)})},n.renderSelectMode=function(s){return Ce.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 Ce.createElement("button",{key:"read",type:"button",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:n.toggleDropdown},Ce.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),Ce.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},a[n.props.month]))},n.renderDropdown=function(s){return Ce.createElement(cU,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 U1(r,n.props.locale)}:function(r){return qx(r,n.props.locale)}),a;switch(this.props.dropdownMode){case"scroll":a=this.renderScrollMode(s);break;case"select":a=this.renderSelectMode(s);break}return Ce.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},a)},e})(b.Component),nA=5;function dU(t,e,n){for(var s=[],a=t??Ci(n,nA),r=e??Ra(n,nA),i=Lr(a),c=Lr(r);!Or(i,c);)s.push(ln(i)),i=Oa(i,1);return s}var fU=(function(t){ms(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=zb(a),i=Va(s.props.date,a)&&Cs(s.props.date,a);return Ce.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?Ce.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Dn(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:dU(s.props.minDate,s.props.maxDate,s.props.date)},s}return e.prototype.render=function(){var n=as({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return Ce.createElement(Ip,{className:n,onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),sA=5,pU=(function(t){ms(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:Ci(n.props.date,sA),i=(a=n.props.maxDate)!==null&&a!==void 0?a:Ra(n.props.date,sA),c=Lr(r),d=Lr(i),f=[];!Or(c,d);){var h=zb(c);f.push(Ce.createElement("option",{key:h,value:h},Dn(c,n.props.dateFormat,n.props.locale))),c=Oa(c,1)}return f},n.onSelectChange=function(s){n.onChange(parseInt(s.target.value))},n.renderSelectMode=function(){return Ce.createElement("select",{value:zb(Lr(n.props.date)),className:"react-datepicker__month-year-select",onChange:n.onSelectChange},n.renderSelectOptions())},n.renderReadView=function(s){var a=Dn(n.props.date,n.props.dateFormat,n.props.locale);return Ce.createElement("div",{key:"read",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:n.toggleDropdown},Ce.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),Ce.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},a))},n.renderDropdown=function(){return Ce.createElement(fU,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);Va(n.props.date,a)&&Cs(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 Ce.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},n)},e})(b.Component),hU=(function(t){ms(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)&&GC(s,n.props)||(n.props.excludeTimes||n.props.includeTimes||n.props.filterTime)&&VC(s,n.props)||(r=(a=n.props).onChange)===null||r===void 0||r.call(a,s)},n.isSelectedTime=function(s){var a=io(n.props.selected);return a&&G1(a,s)},n.isDisabledTime=function(s){return(n.props.minTime||n.props.maxTime)&&GC(s,n.props)||(n.props.excludeTimes||n.props.includeTimes||n.props.filterTime)&&VC(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+wi(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=io(n.props.selected)||io(n.props.openToDate)||ln(),d=Qc(c),f=n.props.injectTimes&&n.props.injectTimes.sort(function(C,k){return C.getTime()-k.getTime()}),h=60*sU(c),m=h/i,x=0;x<m;x++){var y=Su(d,x*i);if(a.push(y),f){var v=nU(d,y,x,i,f);a=a.concat(v)}}var S=a.reduce(function(C,k){return k.getTime()<=c.getTime()?k:C},a[0]);return a.map(function(C){return Ce.createElement("li",{key:C.valueOf(),onClick:n.handleClick.bind(n,C),className:n.liClasses(C),ref:function(k){C===S&&(n.centerLi=k)},onKeyDown:function(k){n.handleOnKeyDown(k,C)},tabIndex:C===S?0:-1,role:"option","aria-selected":n.isSelectedTime(C)?"true":void 0,"aria-disabled":n.isDisabledTime(C)?"true":void 0},Dn(C,r,n.props.locale))})},n.renderTimeCaption=function(){return n.props.showTimeCaption===!1?Ce.createElement(Ce.Fragment,null):Ce.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}},Ce.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 Ce.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(),Ce.createElement("div",{className:"react-datepicker__time"},Ce.createElement("div",{className:"react-datepicker__time-box"},Ce.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),aA=3,mU=(function(t){ms(e,t);function e(n){var s=t.call(this,n)||this;return s.YEAR_REFS=Za([],Array(s.props.yearItemNumber),!0).map(function(){return b.createRef()}),s.isDisabled=function(a){return xa(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 Vx(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=Er(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 an(a,r)},s.isCurrentYear=function(a){return a===Jt(ln())},s.isRangeStart=function(a){return s.props.startDate&&s.props.endDate&&Va(qa(ln(),a),s.props.startDate)},s.isRangeEnd=function(a){return s.props.startDate&&s.props.endDate&&Va(qa(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=qa(ln(),a);return d?Va(f,(r=s.selectingDate())!==null&&r!==void 0?r:null):Va(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=qa(ln(),a);return d||f?Va(h,(r=s.selectingDate())!==null&&r!==void 0?r:null):Va(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=Xc(qa(s.props.date,a)),y=(i||c||d||f||h)&&Ef(a,s.props),v=!!m&&an(x,Xc(m)),S=an(x,Xc(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(Xc(qa(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,Ra(s.props.preSelection,1));break;case dt.ArrowLeft:if(s.props.preSelection==null)break;s.handleYearNavigation(r-1,Ci(s.props.preSelection,1));break;case dt.ArrowUp:{if(h===void 0||m===void 0||s.props.preSelection==null)break;var y=Er(h,m).startPeriod,v=aA,S=r-v;if(S<y){var C=m%v;r>=y&&r<y+C?v=C:v+=C,S=r-v}s.handleYearNavigation(S,Ci(s.props.preSelection,v));break}case dt.ArrowDown:{if(h===void 0||m===void 0||s.props.preSelection==null)break;var k=Er(h,m).endPeriod,v=aA,S=r+v;if(S>k){var C=m%v;r<=k&&r>k-C?v=C:v+=C,S=r+v}s.handleYearNavigation(S,Ra(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 as("react-datepicker__year-text","react-datepicker__year-".concat(a),i?y==null?void 0:y(qa(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=Er(r,i),h=f.startPeriod,m=f.endPeriod,x=function(S){s.push(Ce.createElement("div",{ref:y.YEAR_REFS[S-h],onClick:function(C){n.onYearClick(C,S)},onKeyDown:function(C){Y1(C)&&(C.preventDefault(),C.key=dt.Enter),n.onYearKeyDown(C,S)},tabIndex:Number(y.getYearTabIndex(S)),className:y.getYearClassNames(S),onMouseEnter:y.props.usePointerEvent?void 0:function(C){return c(C,S)},onPointerEnter:y.props.usePointerEvent?function(C){return c(C,S)}:void 0,onMouseLeave:y.props.usePointerEvent?void 0:function(C){return d(C,S)},onPointerLeave:y.props.usePointerEvent?function(C){return d(C,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 Ce.createElement("div",{className:"react-datepicker__year"},Ce.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 gU(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 bU=(function(t){ms(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 Ce.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?Ce.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(Ce.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:s.incrementYears},Ce.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(Ce.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:s.decrementYears},Ce.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:gU(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=as({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return Ce.createElement(Ip,{className:n,containerRef:this.dropdownRef,onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),xU=(function(t){ms(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(Ce.createElement("option",{key:i,value:i},i));return r},n.onSelectChange=function(s){n.onChange(parseInt(s.target.value))},n.renderSelectMode=function(){return Ce.createElement("select",{value:n.props.year,className:"react-datepicker__year-select",onChange:n.onSelectChange},n.renderSelectOptions())},n.renderReadView=function(s){return Ce.createElement("button",{key:"read",type:"button",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:n.toggleDropdown},Ce.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),Ce.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},n.props.year))},n.renderDropdown=function(){return Ce.createElement(bU,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 Ce.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},n)},e})(b.Component),yU=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],K1="react-datepicker-ignore-onclickoutside",vU=function(t){var e=(t.className||"").split(/\s+/);return yU.some(function(n){return e.indexOf(n)>=0})},wU=(function(t){ms(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;vU(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=q1(s.props),f=V1(s.props),h=ln(),m=c||i||r;return m||(d&&Ja(h,d)?d:f&&Or(h,f)?f:h)},s.increaseMonth=function(){s.setState(function(a){var r=a.date;return{date:Oa(r,1)}},function(){return s.handleMonthChange(s.state.date)})},s.decreaseMonth=function(){s.setState(function(a){var r=a.date;return{date:lo(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:qa(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(!xa(a,s.props))return a;for(var r=Lr(a),i=WH(a),c=oz(i,r),d=null,f=0;f<=c;f++){var h=Da(r,f);if(!xa(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:qa(i,Number(a))}},function(){return s.handleYearChange(s.state.date)})},s.changeMonth=function(a){s.setState(function(r){var i=r.date;return{date:Zs(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:qa(Zs(i,zs(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),!Fs(a))return[];var i=s.props.disabled,c=ki(a,s.props.locale,s.props.calendarStartDay),d=[];return s.props.showWeekNumbers&&d.push(Ce.createElement("div",{key:"W",className:"react-datepicker__day-name ".concat(i?"react-datepicker__day-name--disabled":""),role:"columnheader"},Ce.createElement("span",{className:"react-datepicker__sr-only"},"Week number"),Ce.createElement("span",{"aria-hidden":"true"},s.props.weekLabel||"#"))),d.concat([0,1,2,3,4,5,6].map(function(f){var h=Da(c,f),m=s.formatWeekday(h,s.props.locale),x=Dn(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 Ce.createElement("div",{key:f,role:"columnheader",className:as("react-datepicker__day-name",y,i?"react-datepicker__day-name--disabled":"")},v)}return Ce.createElement("div",{key:f,role:"columnheader",className:as("react-datepicker__day-name",y,i?"react-datepicker__day-name--disabled":"")},Ce.createElement("span",{className:"react-datepicker__sr-only"},x),Ce.createElement("span",{"aria-hidden":"true"},m))}))},s.formatWeekday=function(a,r){return s.props.formatWeekDay?qH(a,s.props.formatWeekDay,r):s.props.useWeekdaysShort?GH(a,r):VH(a,r)},s.decreaseYear=function(){s.setState(function(a){var r,i=a.date;return{date:Ci(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=lo(s.state.date,f),m;switch(!0){case s.props.disabled:m=!0;break;case s.props.showMonthYearPicker:m=QC(s.state.date,s.props);break;case s.props.showYearPicker:m=JH(s.state.date,s.props);break;case s.props.showQuarterYearPicker:m=QH(s.state.date,s.props);break;default:m=YC(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,C=s.props,k=C.previousMonthButtonLabel,N=k===void 0?e.defaultProps.previousMonthButtonLabel:k,j=C.previousYearButtonLabel,_=j===void 0?e.defaultProps.previousYearButtonLabel:j,D=s.props,E=D.previousMonthAriaLabel,I=E===void 0?typeof N=="string"?N:"Previous Month":E,O=D.previousYearAriaLabel,T=O===void 0?typeof _=="string"?_:"Previous Year":O;return Ce.createElement("button",{type:"button",className:y.join(" "),onClick:v,onKeyDown:s.props.handleOnKeyDown,"aria-label":S?T:I},Ce.createElement("span",{className:x.join(" ")},S?_:N))}}},s.increaseYear=function(){s.setState(function(a){var r,i=a.date;return{date:Ra(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=XC(s.state.date,s.props);break;case s.props.showYearPicker:r=ZH(s.state.date,s.props);break;case s.props.showQuarterYearPicker:r=XH(s.state.date,s.props);break;default:r=KC(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,C=S.nextMonthAriaLabel,k=C===void 0?typeof x=="string"?x:"Next Month":C,N=S.nextYearAriaLabel,j=N===void 0?typeof v=="string"?v:"Next Year":N;return Ce.createElement("button",{type:"button",className:i.join(" "),onClick:d,onKeyDown:s.props.handleOnKeyDown,"aria-label":f?j:k},Ce.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"),Ce.createElement("h2",{className:r.join(" ")},Fs(a)?Dn(a,s.props.dateFormat,s.props.locale):"")},s.renderYearDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showYearDropdown||a))return Ce.createElement(xU,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 Ce.createElement(uU,qt({},e.defaultProps,s.props,{month:zs(s.state.date),onChange:s.changeMonth}))},s.renderMonthYearDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showMonthYearDropdown||a))return Ce.createElement(pU,qt({},e.defaultProps,s.props,{date:s.state.date,onChange:s.changeMonthYear}))},s.handleTodayButtonClick=function(a){s.props.onSelect(UC(),a),s.props.setPreSelection&&s.props.setPreSelection(UC())},s.renderTodayButton=function(){if(!(!s.props.todayButton||s.props.showTimeSelectOnly))return Ce.createElement("div",{className:"react-datepicker__today-button",onClick:s.handleTodayButtonClick},s.props.todayButton)},s.renderDayNamesHeader=function(a,r){return r===void 0&&(r=0),Ce.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=Ce.createElement("div",{className:as("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),Ce.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:Ce.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=Er(c,m),v=y.startPeriod,S=y.endPeriod;x={startYear:v,endYear:S}}var C=YC(s.state.date,s.props),k=KC(s.state.date,s.props),N=QC(s.state.date,s.props),j=XC(s.state.date,s.props);return Ce.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:C,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=Er(r,f),m=h.startPeriod,x=h.endPeriod;return Ce.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?Ra(s.state.date,d):lo(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?Ra(f,x):Oa(f,x),v="month-".concat(m),S=m<c-1,C=m>0;i.push(Ce.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}),Ce.createElement(lU,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:C,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 Ce.createElement("div",{className:"react-datepicker__year--container"},s.renderHeader({monthDate:s.state.date}),Ce.createElement(mU,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 Ce.createElement(hU,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&&Fs(f)&&!!c,m=h?"".concat(ol(f.getHours()),":").concat(ol(f.getMinutes())):"",x=d?new Date(d):void 0,y=x&&Fs(x)&&!!d,v=y?"".concat(ol(x.getHours()),":").concat(ol(x.getMinutes())):"";return Ce.createElement(Ce.Fragment,null,Ce.createElement($g,qt({},e.defaultProps,s.props,{date:f,timeString:m,onChange:function(N){var j,_;(_=(j=s.props).onTimeChange)===null||_===void 0||_.call(j,N,"start")},timeInputLabel:((a=s.props.timeInputLabel)!==null&&a!==void 0?a:"Time")+" (Start)"})),Ce.createElement($g,qt({},e.defaultProps,s.props,{date:x,timeString:v,onChange:function(N){var j,_;(_=(j=s.props).onTimeChange)===null||_===void 0||_.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,C=S&&Fs(S)&&!!s.props.selected,k=C?"".concat(ol(S.getHours()),":").concat(ol(S.getMinutes())):"";return Ce.createElement($g,qt({},e.defaultProps,s.props,{date:S,timeString:k,onChange:function(N){var j,_;(_=(j=s.props).onTimeChange)===null||_===void 0||_.call(j,N)}}))}},s.renderAriaLiveRegion=function(){var a;if(!Fs(s.state.date))return Ce.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"});var r=Er(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(qx(zs(s.state.date),s.props.locale)," ").concat(Jt(s.state.date)),Ce.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},s.state.isRenderAriaLiveMessage&&d)},s.renderChildren=function(){if(s.props.children)return Ce.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:K1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",yearItemNumber:Ou,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&&Fs(this.props.preSelection)&&(!an(this.props.preSelection,n.preSelection)||this.props.monthSelectedIn!==n.monthSelectedIn)){var a=!Cs(this.state.date,this.props.preSelection);this.setState({date:this.props.preSelection},function(){return a&&s.handleCustomMonthChange(s.state.date)})}else this.props.openToDate&&!an(this.props.openToDate,n.openToDate)&&this.setState({date:this.props.openToDate})},e.prototype.render=function(){var n=this.props.container||PH;return Ce.createElement(Ip,{onClickOutside:this.handleClickOutside,style:{display:"contents"},ignoreClass:this.props.outsideClickIgnoreClass},Ce.createElement("div",{style:{display:"contents"},ref:this.containerRef},Ce.createElement(n,{className:as("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),kU=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 Ce.createElement("i",{className:"".concat(r," ").concat(e," ").concat(s),"aria-hidden":"true",onClick:a});if(Ce.isValidElement(e)){var i=e;return Ce.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 Ce.createElement("svg",{className:"".concat(r," ").concat(s),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",onClick:a},Ce.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"}))},Q1=(function(t){ms(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 D2.createPortal(this.props.children,this.el)},e})(b.Component),SU="[tabindex], a, button, input, select, textarea",CU=function(t){return(t instanceof HTMLAnchorElement||!t.disabled)&&t.tabIndex!==-1},X1=(function(t){ms(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(SU),1,-1).filter(CU)},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)?Ce.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},Ce.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:0,onFocus:this.handleFocusStart}),this.props.children,Ce.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:0,onFocus:this.handleFocusEnd})):this.props.children},e.defaultProps={enableTabLoop:!0},e})(b.Component);function AU(t){function e(n){var s,a=typeof n.hidePopper=="boolean"?n.hidePopper:!0,r=b.useRef(null),i=LH(qt({open:!a,whileElementsMounted:pH,placement:n.popperPlacement,middleware:Za([kH({padding:15}),wH(10),SH({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 Ce.createElement(t,qt({},c))}return e.displayName="withFloating(".concat(t.displayName||t.name||"Component",")"),e}var jU=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 C=as("react-datepicker-popper",!x&&"react-datepicker-popper-offset",v==="middle"&&"react-datepicker-popper--header-middle",v==="bottom"&&"react-datepicker-popper--header-bottom",e);S=Ce.createElement(X1,{enableTabLoop:c},Ce.createElement("div",{ref:m.refs.setFloating,style:m.floatingStyles,className:C,"data-placement":m.placement,onKeyDown:d},r,x&&Ce.createElement(TH,{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=Ce.createElement(Q1,{portalId:f,portalHost:h},S));var k=as("react-datepicker-wrapper",n);return Ce.createElement(Ce.Fragment,null,Ce.createElement("div",{ref:m.refs.setReference,className:k},i),S)},NU=AU(jU);function rA(t,e){return t&&e?zs(t)!==zs(e)||Jt(t)!==Jt(e):t!==e}var Ug="Date input not valid.",TU=(function(t){ms(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?$C(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=eo(i.date,"yyyy-MM-dd",void 0,!1);return c?Za(Za([],r,!0),[qt(qt({},i),{date:c})],!1):r},[])},s.calcInitialState=function(){var a=s.props.timeZone,r=s.getPreSelection(),i=q1(s.props),c=V1(s.props),d=i&&Ja(r,Qc(i))?i:c&&Or(r,WC(c))?c:r,f=s.props.selectsRange?s.props.startDate:s.props.selected;return f&&a&&(f=$C(f,a)),{open:s.props.startOpen||!1,preventFocus:!1,inputValue:null,preSelection:f??d,highlightDates:JC(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,C=(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 FH(c,d,{dateFormat:C,locale:i,rangeSeparator:f});if(x){if(v){var N=function(j){return Bs(j,{dateFormat:C,locale:i})};return v(m??[],N)}return zH(m??[],{dateFormat:C,locale:i})}return Bs(h,{dateFormat:C,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:Wg},function(){a||s.setState(function(i){return{focused:r?i.focused:!1}},function(){!r&&s.deferBlur(),s.setState({inputValue:null})})})},s.inputOk=function(){return tr(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:_U});var S=s.props,C=S.selectsRange,k=S.startDate,N=S.endDate,j=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,_=(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(C){var E=s.props.rangeSeparator,I=E.trim(),O=D.split(j.includes(I)?E:I,2).map(function(W){return W.trim()}),T=O[0],M=O[1],R=eo(T??"",j,s.props.locale,_),B=R?eo(M??"",j,s.props.locale,_):null,$=((i=io(k))===null||i===void 0?void 0:i.getTime())!==(R==null?void 0:R.getTime()),U=((c=io(N))===null||c===void 0?void 0:c.getTime())!==(B==null?void 0:B.getTime());if(!$&&!U||R&&xa(R,s.props)||B&&xa(B,s.props))return;R&&s.setState({preSelection:R}),(f=(d=s.props).onChange)===null||f===void 0||f.call(d,[R,B],v)}else{var L=eo(D,j,s.props.locale,_,(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 F=BH(D,(m=s.state.preSelection)!==null&&m!==void 0?m:void 0);F&&(!s.props.minDate||!Ja(F,s.props.minDate))&&(!s.props.maxDate||!Or(F,s.props.maxDate))&&s.setState({preSelection:F})}}}},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||!zg(a,h));if(s.props.shouldCloseOnSelect&&!s.props.showTimeSelect&&S&&s.sendFocusBackToInput(),s.props.onChangeRaw){var C=Bs(a,{dateFormat:v,locale:x});s.props.onChangeRaw(r,{date:a,formattedDate:C})}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&&W1(m,s.props))return}else if(m!==null&&xa(m,s.props))return;var x=s.props,y=x.onChange,v=x.selectsRange,S=x.startDate,C=x.endDate,k=x.selectsMultiple,N=x.selectedDates,j=x.minTime,_=x.swapRange;if(!oo(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:wi(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,E=!S&&!C,I=S&&!C,O=!S&&!!C,T=S&&C;E?D==null||D([m,null],r):I?m===null?D==null||D([null,null],r):zg(m,S)?_?D==null||D([m,S],r):D==null||D([m,null],r):D==null||D([S,m],r):O&&(m&&zg(m,C)?D==null||D([m,C],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 an($,m)});if(R){var B=N.filter(function($){return!an($,m)});M==null||M(B,r)}else M==null||M(Za(Za([],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=tr(s.props.minDate),i=tr(s.props.maxDate),c=!0;if(a){var d=Qc(a);if(r&&i)c=so(a,s.props.minDate,s.props.maxDate);else if(r){var f=Qc(s.props.minDate);c=Or(a,f)||oo(d,f)}else if(i){var h=WC(s.props.maxDate);c=Ja(a,h)||oo(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 C=Nr(m,{hour:bs(a),minute:xs(a)});s.setState({preSelection:C}),y&&(C=jr(C,y)),v==null||v([h?y?jr(h,y):h:null,C],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 C=Nr(m,{hour:bs(a),minute:xs(a)});s.setState({preSelection:C}),y&&(C=jr(C,y)),v==null||v([y?jr(h,y):h,C],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=io(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=Qc(f),v=bs(f)*60+xs(f),S=1440-h,C;if(a===dt.ArrowUp){var k=Math.max(0,v-h);C=Su(y,k)}else{var k=Math.min(S,v+h);C=Su(y,k)}var N=Dn(C,x||e.defaultProps.dateFormat,s.props.locale);if(s.setState({preSelection:C,inputValue:N}),!(s.props.selectsRange||s.props.selectsMultiple)){var j=s.props.selected?s.props.selected:s.getPreSelection(),_=s.props.selected?C:Nr(j,{hour:bs(C),minute:xs(C)});(d=(c=s.props).onChange)===null||d===void 0||d.call(c,_),(s.props.showTimeSelectOnly||s.props.showTimeSelect)&&s.setState({isRenderAriaLiveMessage:!0}),requestAnimationFrame(function(){s.scrollToTimeOption(C)})}},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||io(s.props.selected)||ln(),v=eo(h,m,s.props.locale,(i=s.props.strictParsing)!==null&&i!==void 0?i:!1,y),S=y;if(v&&Fs(v))S=v;else{var C=((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(C instanceof HTMLElement){var k=(d=C.textContent)===null||d===void 0?void 0:d.trim();if(k){var N=eo(k,x,s.props.locale,!1,y);N&&Fs(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 C=eo(S,m,s.props.locale,!1,a);if(C&&Fs(C)){if(G1(C,a)){f=v;break}var k=Math.abs(C.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===Wg?(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:Ug})}},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,C=m.shouldCloseOnSelect,k=m.locale,N=m.calendarStartDay,j=m.adjustDateOnChange,_=m.inline;if((i=(r=s.props).onKeyDown)===null||i===void 0||i.call(r,a),!v){var D=a.key,E=a.shiftKey,I=ln(s.state.preSelection),O=function(R,B){var $=B;switch(R){case dt.ArrowRight:$=S?Xf(B,1):Da(B,1);break;case dt.ArrowLeft:$=S?TC(B):o$(B);break;case dt.ArrowUp:$=TC(B);break;case dt.ArrowDown:$=Xf(B,1);break;case dt.PageUp:$=E?Ci(B,1):lo(B,1);break;case dt.PageDown:$=E?Ra(B,1):Oa(B,1);break;case dt.Home:$=ki(B,k,N);break;case dt.End:$=UH(B);break}return $},T=function(R,B){for(var $=40,U=R,L=!1,F=0,W=O(R,B);!L;){if(F>=$){W=B;break}x&&W<x&&(U=dt.ArrowRight,W=xa(x,s.props)?O(U,W):x),y&&W>y&&(U=dt.ArrowLeft,W=xa(y,s.props)?O(U,W):y),xa(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,F++}return W};if(D===dt.Enter){a.preventDefault(),s.handleSelect(I,a),!C&&s.setPreSelection(I);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:Ug});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,I);break}if(!M){(h=(f=s.props).onInputError)===null||h===void 0||h.call(f,{code:1,msg:Ug});return}a.preventDefault(),s.setState({lastPreSelectChange:Wg}),j&&s.setSelected(M),s.setPreSelection(M),_&&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:Ce.createElement(wU,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:tU(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(Bs(s.props.startDate,{dateFormat:d,locale:r}),". ").concat(s.props.endDate?"End date: "+Bs(s.props.endDate,{dateFormat:d,locale:r}):""):s.props.showTimeSelectOnly?f="Selected time: ".concat(Bs(s.props.selected,{dateFormat:i,locale:r})):s.props.showYearPicker?f="Selected year: ".concat(Bs(s.props.selected,{dateFormat:"yyyy",locale:r})):s.props.showMonthYearPicker?f="Selected month: ".concat(Bs(s.props.selected,{dateFormat:"MMMM yyyy",locale:r})):s.props.showQuarterYearPicker?f="Selected quarter: ".concat(Bs(s.props.selected,{dateFormat:"yyyy, QQQ",locale:r})):f="Selected date: ".concat(Bs(s.props.selected,{dateFormat:d,locale:r})),Ce.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=as(s.props.className,(a={},a[s.props.outsideClickIgnoreClass||e.defaultProps.outsideClickIgnoreClass]=s.state.open,a)),x=s.props.customInput||Ce.createElement("input",{type:"text"}),y=s.props.customInputRef||"ref",v={},S=(i=s.props["aria-describedby"])!==null&&i!==void 0?i:s.props.ariaDescribedBy,C=(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),C!=null&&(v["aria-invalid"]=C),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(_){s.input=_},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=as(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,C=a.readOnly;return r&&!C&&(c!=null||d!=null||f!=null||S!=null&&S.length)?Ce.createElement("button",{type:"button",className:as("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:K1,readOnly:!1,rangeSeparator:H1,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:Ou,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&&rA(n.startDate,this.props.startDate)?this.setPreSelection(this.props.startDate):rA(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:JC(this.props.highlightDates)}),!s.focused&&!oo(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."),Ce.createElement("div",{className:"react-datepicker__input-container".concat(s?" react-datepicker__view-calendar-icon":"")},s&&Ce.createElement(kU,qt({icon:a,className:as(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?Ce.createElement(X1,{enableTabLoop:this.props.enableTabLoop},Ce.createElement("div",{className:"react-datepicker__portal",tabIndex:-1,onKeyDown:this.onPortalKeyDown},n)):null;return this.state.open&&this.props.portalId&&(s=Ce.createElement(Q1,qt({portalId:this.props.portalId},this.props),s)),Ce.createElement(Ce.Fragment,null,this.renderInputContainer(),s)}return Ce.createElement(NU,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),_U="input",Wg="navigate";const EU=[25,50,100,250,500,1e3],MU=250,Vc=t=>String(t).padStart(2,"0"),gf=t=>t?/(datetime|timestamp|timestamptz|datetime2|smalldatetime)/i.test(t):!1,iA=t=>`${t.getFullYear()}-${Vc(t.getMonth()+1)}-${Vc(t.getDate())} ${Vc(t.getHours())}:${Vc(t.getMinutes())}:${Vc(t.getSeconds())}`,oA=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},DU=t=>t===null?"NULL":t===void 0?"undefined":typeof t=="object"?JSON.stringify(t,null,2):String(t),RU=t=>t==null?"":typeof t=="object"?JSON.stringify(t):String(t),OU=t=>{const e=t.match(/FROM\s+(?:`?[\w]+`?\.)?`?([\w]+)`?(?:\s+(?:AS\s+)?\w+)?(?=\s|;|$)/i);return e!=null&&e[1]?e[1]:null},qg=t=>!t||!t.columns?[]:t.columns.filter(e=>e.primaryKey).map(e=>e.name),LU=(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}`},PU=({result:t,buildingId:e,building:n})=>{var ae,we;const{t:s}=pt(["terminal"]),a=mx(e),[r,i]=b.useState(0),[c,d]=b.useState(MU),[f,h]=b.useState(null),[m,x]=b.useState("asc"),[y,v]=b.useState(null),[S,C]=b.useState(!1),[k,N]=b.useState({}),[j,_]=b.useState(null),[D,E]=b.useState(null),[I,O]=b.useState(null),[T,M]=b.useState(!1),[R,B]=b.useState(null),[$,U]=b.useState(null),[L,F]=b.useState(new Map),[W,V]=b.useState(null),[Y,z]=b.useState(null),Q=b.useRef(null),K=b.useRef(null),q=b.useRef(null),xe=b.useRef(!1),de=t.status==="error",ee=!t.rows||t.rows.length===0;b.useEffect(()=>{var ve,He;const Z=OU(t.query||"");if(E(Z),M(!1),O(null),F(new Map),Z&&a.activeConnectionId&&a.activeDatabase){const Pe=`${a.activeConnectionId}:${a.activeDatabase}:${Z}`,oe=(He=(ve=a.tableSchemas)==null?void 0:ve.get)==null?void 0:He.call(ve,Pe);if(oe){O(oe);const Le=qg(oe);M(Le.length>0)}else H.getTableSchema(e,a.activeConnectionId,a.activeDatabase,Z)}},[t.query,t.rows,e,a.activeConnectionId,a.activeDatabase]),b.useEffect(()=>{var Z,ve;if(D&&a.activeConnectionId&&a.activeDatabase){const He=`${a.activeConnectionId}:${a.activeDatabase}:${D}`,Pe=(ve=(Z=a.tableSchemas)==null?void 0:Z.get)==null?void 0:ve.call(Z,He);if(Pe){O(Le=>Le===Pe?Le:Pe);const oe=qg(Pe);M(oe.length>0)}}},[a.tableSchemas,D,a.activeConnectionId,a.activeDatabase]);const fe=b.useMemo(()=>!f||!t.rows?t.rows:[...t.rows].sort((Z,ve)=>{const He=Z[f],Pe=ve[f];if(He===null&&Pe===null)return 0;if(He===null)return m==="asc"?-1:1;if(Pe===null)return m==="asc"?1:-1;if(typeof He=="number"&&typeof Pe=="number")return m==="asc"?He-Pe:Pe-He;const oe=String(He),Le=String(Pe);return m==="asc"?oe.localeCompare(Le):Le.localeCompare(oe)}),[t.rows,f,m]),je=b.useMemo(()=>{if(!fe)return[];const Z=r*c;return fe.slice(Z,Z+c)},[fe,r,c]),ge=Math.ceil(((fe==null?void 0:fe.length)??0)/c),Ee=((ae=t.fields)==null?void 0:ae.map(Z=>Z.name))??Object.keys(((we=t.rows)==null?void 0:we[0])||{}),Be=b.useMemo(()=>{const Z=new Map;return(t.fields??[]).forEach(ve=>{ve!=null&&ve.name&&Z.set(ve.name,String(ve.type??""))}),Z},[t.fields]),Ve=b.useMemo(()=>qg(I),[I]),J=b.useCallback((Z,ve)=>{const He=Be.get(Z);if(gf(He)){const Pe=oA(ve);return Pe?iA(Pe):""}return RU(ve)},[Be]),ne=b.useMemo(()=>T?"Editable":!a.activeConnectionId||!a.activeDatabase?"Read-only: no active connection or database":D?I?Ve.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,I,Ve.length]),Te=b.useCallback(Z=>{if(xe.current){xe.current=!1;return}f===Z?x(ve=>ve==="asc"?"desc":"asc"):(h(Z),x("asc"))},[f]),qe=b.useCallback((Z,ve,He,Pe)=>{!T||j||Y||_({rowIndex:He,rowKey:Pe,columnName:Z,originalValue:ve,currentValue:J(Z,ve),isUpdating:!1})},[T,j,Y,J]),at=b.useCallback((Z,ve)=>{v({column:Z,value:ve})},[]),Se=b.useCallback(Z=>{var jt,be;if(!D||!I||!a.activeConnectionId||!a.activeDatabase)return;const{rowIndex:ve,columnName:He,originalValue:Pe,currentValue:oe}=Z,Le=String(oe??"");if(oe!==null&&Le===J(He,Pe)){_(null);return}const le=r*c+ve,me=fe==null?void 0:fe[le];if(!me)return;const se=Ve;if(se.length===0){_(_e=>_e?{..._e,error:"No primary key found"}:null);return}const Re={};for(const _e of se)Re[_e]=me[_e];let Ke=Le;const ze=Be.get(He);if(oe===null)Ke=null;else if(gf(ze))Ke=Le.trim()===""?null:Le.trim();else if(typeof Pe=="number")if(Le.trim()==="")Ke=null;else{const _e=Number(Le);if(Number.isNaN(_e)){_(Ge=>Ge?{...Ge,isUpdating:!1,error:"Invalid number value"}:null);return}Ke=_e}else if(typeof Pe=="boolean"){const _e=Le.trim().toLowerCase();if(_e==="true"||_e==="1")Ke=!0;else if(_e==="false"||_e==="0")Ke=!1;else{_(Ge=>Ge?{...Ge,isUpdating:!1,error:"Invalid boolean value"}:null);return}}else if(Pe!==null&&typeof Pe=="object")try{Ke=JSON.parse(Le)}catch{_(_e=>_e?{..._e,isUpdating:!1,error:"Invalid JSON value"}:null);return}_(_e=>_e?{..._e,isUpdating:!0}:null);const tt=(jt=n.database)==null?void 0:jt.connections.find(_e=>_e.id===a.activeConnectionId),ot=(tt==null?void 0:tt.engine)||"mysql",nt=LU(ot,D,He,Re,Pe,Ke,!gf(ze));U(nt);const lt=JSON.stringify(Re),it=((be=t.query)==null?void 0:be.trim())||"",ht=`${Date.now()}-${Math.random().toString(36).slice(2,10)}`;z({requestId:ht,query:nt,rowKey:lt,columnName:He,parsedValue:Ke,startedAt:Date.now(),originalQuery:it}),H.executeSilentQuery(e,a.activeConnectionId,a.activeDatabase,nt,ht)},[D,I,r,c,fe,Ve,e,a.activeConnectionId,a.activeDatabase,t.query,J,Be]);b.useEffect(()=>{const Z=a.lastSilentQueryResult;if(!(!Y||!Z)&&!(Z.requestId&&Z.requestId!==Y.requestId)&&!(Z.timestamp<Y.startedAt)){if(!Z.success){B({message:Z.error||"Update failed on backend",type:"error"}),setTimeout(()=>B(null),5e3),_(ve=>ve&&{...ve,isUpdating:!1,error:Z.error||"Update failed on backend"}),z(null);return}if(Z.affectedRows===0){B({message:"No rows were updated",type:"error"}),setTimeout(()=>B(null),5e3),_(ve=>ve&&{...ve,isUpdating:!1,error:"No rows were updated"}),z(null);return}F(ve=>{const He=new Map(ve),Pe=He.get(Y.rowKey)||{};return Pe[Y.columnName]=Y.parsedValue,He.set(Y.rowKey,Pe),He}),_(null),B({message:"Row updated successfully",type:"success"}),setTimeout(()=>B(null),3e3),Y.originalQuery&&a.activeConnectionId&&a.activeDatabase&&setTimeout(()=>{H.executeQuery(e,a.activeConnectionId,a.activeDatabase,Y.originalQuery)},200),z(null)}},[Y,a.lastSilentQueryResult,a.activeConnectionId,a.activeDatabase,e]),b.useEffect(()=>{if(!Y)return;const Z=window.setTimeout(()=>{B({message:"Update timed out waiting for backend",type:"error"}),setTimeout(()=>B(null),5e3),_(ve=>ve&&{...ve,isUpdating:!1,error:"Update timed out waiting for backend"}),z(null)},1e4);return()=>window.clearTimeout(Z)},[Y]);const Fe=b.useCallback(()=>{j&&Se(j)},[j,Se]),ie=b.useCallback((Z,ve,He,Pe,oe)=>{Z.preventDefault(),Z.stopPropagation(),V({position:{x:Z.clientX,y:Z.clientY},rowIndex:Pe,rowKey:oe,columnName:ve,value:He})},[j,D,I,r,c,fe,Ve,e,a.activeConnectionId,a.activeDatabase]),he=b.useMemo(()=>{if(!W)return[];const Z=!T||!!j||!!Y||!D||!I||!a.activeConnectionId||!a.activeDatabase;return[{id:"editability",label:T?"Cell actions":ne,icon:T?"▣":"ℹ",disabled:!0,onClick:()=>{}},{id:"divider-1",label:"",divider:!0,onClick:()=>{}},{id:"edit-cell",label:"Edit Cell",icon:"✏️",disabled:Z,onClick:()=>{_({rowIndex:W.rowIndex,rowKey:W.rowKey,columnName:W.columnName,originalValue:W.value,currentValue:J(W.columnName,W.value),isUpdating:!1})}},{id:"set-null",label:"Set NULL",icon:"∅",disabled:Z||W.value===null,onClick:()=>{Se({rowIndex:W.rowIndex,rowKey:W.rowKey,columnName:W.columnName,originalValue:W.value,currentValue:null,isUpdating:!1})}}]},[W,T,j,Y,D,I,a.activeConnectionId,a.activeDatabase,ne,Se,J]),We=b.useCallback(Z=>{Z.key==="Enter"?(Z.preventDefault(),Fe()):Z.key==="Escape"&&(Z.preventDefault(),Z.stopPropagation(),_(null))},[Fe]),st=b.useCallback((Z,ve)=>{Z.preventDefault(),Z.stopPropagation();const He=Z.target.closest("th");if(!He)return;const Pe=He.getBoundingClientRect().width;q.current={column:ve,startX:Z.clientX,startWidth:Pe};const oe=le=>{if(!q.current)return;const me=le.clientX-q.current.startX,se=Math.max(50,q.current.startWidth+me);N(Re=>({...Re,[q.current.column]:se}))},Le=()=>{q.current=null,xe.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 Z=He=>{He.key==="Escape"&&(He.stopPropagation(),v(null))},ve=He=>{Q.current&&!Q.current.contains(He.target)&&v(null)};return document.addEventListener("keydown",Z),document.addEventListener("mousedown",ve),()=>{document.removeEventListener("keydown",Z),document.removeEventListener("mousedown",ve)}},[y]);const ut=j?`${j.rowKey}:${j.columnName}`:null;b.useEffect(()=>{K.current&&ut&&(K.current.focus(),K.current.select())},[ut]);const ue=b.useCallback(async()=>{var oe;if(!t.rows||t.rows.length===0)return;const Z=((oe=t.fields)==null?void 0:oe.map(Le=>Le.name))??Object.keys(t.rows[0]||{}),ve=fe??t.rows,He=["<table><thead><tr>"];Z.forEach(Le=>He.push(`<th>${Le}</th>`)),He.push("</tr></thead><tbody>"),ve.forEach(Le=>{He.push("<tr>"),Z.forEach(le=>{const me=Le[le];He.push(`<td>${me===null?"NULL":typeof me=="object"?JSON.stringify(me):String(me)}</td>`)}),He.push("</tr>")}),He.push("</tbody></table>");const Pe=[Z.join(" ")];ve.forEach(Le=>{Pe.push(Z.map(le=>{const me=Le[le];return me===null?"NULL":typeof me=="object"?JSON.stringify(me):String(me)}).join(" "))});try{const Le=new Blob([He.join("")],{type:"text/html"}),le=new Blob([Pe.join(`
110
+ `)],{type:"text/plain"});await navigator.clipboard.write([new ClipboardItem({"text/html":Le,"text/plain":le})]),C(!0),setTimeout(()=>C(!1),2e3)}catch{await navigator.clipboard.writeText(Pe.join(`
111
+ `)),C(!0),setTimeout(()=>C(!1),2e3)}},[t,fe]),X=Z=>{if(Z===null)return o.jsx("span",{className:"results-table__null",children:"NULL"});if(Z===void 0)return o.jsx("span",{className:"results-table__null",children:"undefined"});if(typeof Z=="boolean")return o.jsx("span",{className:`results-table__bool results-table__bool--${Z}`,children:String(Z)});if(typeof Z=="number")return o.jsx("span",{className:"results-table__number",children:Z.toLocaleString()});if(Z instanceof Date)return o.jsx("span",{className:"results-table__date",children:Z.toISOString()});if(typeof Z=="object")return o.jsx("span",{className:"results-table__json",title:JSON.stringify(Z,null,2),children:JSON.stringify(Z)});const ve=String(Z);return ve.length>100?o.jsxs("span",{className:"results-table__long",title:ve,children:[ve.substring(0,100),"..."]}):ve};return de?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})})]})}):ee?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:ne,children:ne}),o.jsx("button",{className:`results-table__copy-btn ${S?"results-table__copy-btn--success":""}`,onClick:ue,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:Z=>{d(Number(Z.target.value)),i(0)},children:EU.map(Z=>o.jsx("option",{value:Z,children:s("terminal:database.rowsPerPage",{count:Z})},Z))}),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(Z=>Z-1),title:s("terminal:database.previousPage"),children:"‹"}),o.jsx("span",{className:"results-table__page-info",children:s("terminal:database.pageInfo",{current:r+1,total:ge})}),o.jsx("button",{className:"results-table__page-btn",disabled:r>=ge-1,onClick:()=>i(Z=>Z+1),title:s("terminal:database.nextPage"),children:"›"}),o.jsx("button",{className:"results-table__page-btn",disabled:r>=ge-1,onClick:()=>i(ge-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:"#"}),Ee.map(Z=>{var Pe;const ve=(Pe=t.fields)==null?void 0:Pe.find(oe=>oe.name===Z),He=f===Z;return o.jsxs("th",{className:`results-table__header ${He?"results-table__header--sorted":""}`,onClick:()=>Te(Z),title:ve!=null&&ve.type?`Type: ${ve.type}`:void 0,style:k[Z]?{width:k[Z],minWidth:k[Z],maxWidth:k[Z]}:void 0,children:[o.jsx("span",{className:"results-table__header-name",children:Z}),He&&o.jsx("span",{className:"results-table__sort-indicator",children:m==="asc"?"▲":"▼"}),o.jsx("span",{className:"results-table__resize-handle",onMouseDown:oe=>st(oe,Z)})]},Z)})]})}),o.jsx("tbody",{children:je.map((Z,ve)=>o.jsxs("tr",{className:"results-table__row",children:[o.jsx("td",{className:"results-table__row-num",children:r*c+ve+1}),Ee.map(He=>{const Pe=JSON.stringify(Object.fromEntries(Ve.map(me=>[me,Z[me]]))),oe=(j==null?void 0:j.rowKey)===Pe&&(j==null?void 0:j.columnName)===He,Le=L.get(Pe),le=Le?Le[He]:Z[He];return o.jsx("td",{className:`results-table__cell ${oe?"results-table__cell--editing":""} ${T?"results-table__cell--editable":""} ${Le&&Le[He]!==Z[He]?"results-table__cell--updated":""}`,onClick:()=>qe(He,le,ve,Pe),onDoubleClick:()=>at(He,le),onContextMenu:me=>ie(me,He,le,ve,Pe),children:oe?o.jsxs("div",{className:"results-table__cell-input-wrapper",children:[gf(Be.get(j.columnName))?o.jsx(TU,{selected:oA(j.currentValue),onChange:me=>{const se=Array.isArray(me)?me[0]:me;_(Re=>Re?{...Re,currentValue:se?iA(se):""}:null)},onCalendarClose:Fe,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:K,type:"text",className:"results-table__cell-input",value:String(j.currentValue??""),onChange:me=>_(se=>se?{...se,currentValue:me.target.value}:null),onBlur:Fe,onKeyDown:We,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:me=>{me.preventDefault(),me.stopPropagation()},onClick:me=>{me.preventDefault(),me.stopPropagation(),_(null)},children:"✕"})]}):X(le)},He)})]},ve))})]})}),y&&o.jsx("div",{className:"results-table__detail-backdrop",children:o.jsxs("div",{className:"results-table__detail",ref:Q,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 Z=je.find(ve=>Ee.some(He=>ve[He]===y.value&&He===y.column));if(Z){const ve=je.indexOf(Z),He=JSON.stringify(Object.fromEntries(Ve.map(Pe=>[Pe,Z[Pe]])));_({rowIndex:ve,rowKey:He,columnName:y.column,originalValue:y.value,currentValue:J(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:DU(y.value),readOnly:!0,onFocus:Z=>Z.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(go,{isOpen:W!==null,position:(W==null?void 0:W.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:he,onClose:()=>V(null)})]})};function Gx(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 IU(t,e){const n=Gx(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 vV=({query:t,onChange:e,onExecute:n,isExecuting:s,disabled:a,autoFocus:r=!0})=>{const{t:i}=pt(["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 I=localStorage.getItem(h);if(I){const O=Number(I);if(O>=m&&O<=x)return O}}catch{}return 150}),S=b.useCallback(I=>{try{localStorage.setItem(h,String(I))}catch{}},[]),C=b.useCallback(I=>{I.preventDefault(),f.current=!0;const O=I.clientY,T=y,M=B=>{const $=B.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 B=($=c.current)==null?void 0:$.parentElement;B&&S(B.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 I=setTimeout(()=>{var O;(O=c.current)==null||O.focus()},100);return()=>clearTimeout(I)}},[r,a]);const k=b.useCallback(I=>{const O=I.currentTarget;d.current&&(d.current.scrollLeft=O.scrollLeft,d.current.scrollTop=O.scrollTop)},[]),N=b.useMemo(()=>Gx(t).length>1,[t]),j=b.useCallback(I=>{if((I.ctrlKey||I.metaKey)&&I.shiftKey&&I.key==="Enter"){I.preventDefault(),!a&&!s&&n("all");return}if((I.ctrlKey||I.metaKey)&&I.key==="Enter"&&(I.preventDefault(),!a&&!s&&n("cursor")),I.key==="Tab"){I.preventDefault();const O=I.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]),_=b.useMemo(()=>{if(!t)return"";try{return aa.highlight(t,aa.languages.sql,"sql")}catch{return t}},[t]),D=b.useMemo(()=>t.split(`
113
+ `).map((O,T)=>T+1),[t]),E=b.useCallback(()=>{var I;return((I=c.current)==null?void 0:I.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(I=>o.jsx("span",{children:I},I))}),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:_+`
114
+ `}}),o.jsx("textarea",{ref:c,className:"query-editor__textarea",value:t,onChange:I=>e(I.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":E()})]})]}),o.jsx("div",{className:"query-editor__resize-handle",onMouseDown:C})]})},lA=t=>`db-panel-${t}`,BU=({building:t})=>{var O,T,M,R,B,$;const e=mx(t.id),n=fL(t.id),s=pL(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 aa.highlight(r,aa.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),C=y?((B=e.databases)==null?void 0:B.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(lA(t.id));if(U){const L=JSON.parse(U);L.connectionId&&a.some(F=>F.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=lA(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]),_=b.useCallback(()=>{var F;if(!y||!v||!r.trim()||s)return;const U=((F=f.current)==null?void 0:F.selectionStart)??0;if(Gx(r).length<=1)H.executeQuery(t.id,y,v,r.trim());else{const W=IU(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=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]),I=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..."}),C.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&&E(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:_,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:I?o.jsx(PU,{result:I,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 FU(){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 C=document.querySelector(".app");C&&(C.style.setProperty("--keyboard-height",`${v}px`),C.style.setProperty("--keyboard-visible",S?"1":"0"),C.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 C=()=>{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),_=Math.max(0,c.current-window.innerHeight),D=j>=120||_>=120;D||(i.current=j,c.current=window.innerHeight);const E=_>=120?0:D?Math.max(0,j):0;(E!==s.current||D!==a.current)&&d(E,D),D&&setTimeout(()=>{e.current=!1},300)}))};n.current=C,window.visualViewport.addEventListener("resize",C),window.visualViewport.addEventListener("scroll",C),C()}},[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 zU(){const[t,e]=b.useState(()=>{const d=Jb(ft.TERMINAL_HEIGHT,zk);return d>=$k&&d<=Hk?d:zk}),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(Hk,Math.max($k,a.current+y));e(v)},f=()=>{n.current&&(n.current=!1,document.body.style.cursor="",document.body.style.userSelect="",Zb(ft.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 $U=120,HU=.7;function UU(){const[t,e]=b.useState(()=>Jb(ft.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*HU),i=m=>Math.min(r(),Math.max($U,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="",Zb(ft.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=C=>{const k=C.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=C=>{if(C.touches.length!==1)return;C.preventDefault();const k=C.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 WU({agents:t,selectedAgentId:e,isOpen:n,overviewPanelOpen:s,loadingHistory:a,hasModalOpen:r=!1,outputRef:i}){const c=rr(),d=hx(),h=Br().vibrationIntensity??1,m=()=>{if(typeof document>"u")return!1;const B=document.querySelector(".agent-bar");if(!B)return!1;const $=window.getComputedStyle(B);if($.display==="none"||$.visibility==="hidden")return!1;const U=B.getBoundingClientRect();return U.width>0&&U.height>0},x=b.useMemo(()=>{const B=Array.from(t.values());if(!s&&m()){const K=KR(),q=B.filter(J=>{if(H.isAgentInArchivedArea(J.id))return!1;if(K){const ne=H.getAreaForAgent(J.id);if(!xp((ne==null?void 0:ne.id)??null))return!1}return!0}).sort((J,ne)=>(J.createdAt||0)-(ne.createdAt||0)),xe=ta(ft.AGENT_ORDER,[]),de=new Set(q.map(J=>J.id)),ee=xe.filter(J=>de.has(J)),fe=q.filter(J=>!ee.includes(J.id)).map(J=>J.id),je=[...ee,...fe],ge=new Map(q.map(J=>[J.id,J])),Ee=je.map(J=>ge.get(J)).filter(J=>J!==void 0),Be=new Map;for(const J of Ee){const ne=H.getAreaForAgent(J.id),Te=(ne==null?void 0:ne.id)??null;Be.has(Te)||Be.set(Te,{name:(ne==null?void 0:ne.name)??"",agents:[]}),Be.get(Te).agents.push(J)}const Ve=Array.from(Be.entries());return Ve.sort(([J,ne],[Te,qe])=>J===null&&Te!==null?1:J!==null&&Te===null?-1:J===null&&Te===null?0:ne.name.localeCompare(qe.name)),Ve.flatMap(([,J])=>J.agents)}const $=ta(ft.AOP_CONFIG,{groupByArea:!0,sortMode:"recent",filterMode:"all",sameAreaOnly:!1}),U=H.getState(),L=new Map;for(const K of d)L.has(K.agentId)||L.set(K.agentId,K.timestamp);const F=new Map;for(const K of B){const q=H.getAreaForAgent(K.id);!q||q.archived||F.set(K.id,q.id)}let W=B.filter(K=>{if($.filterMode==="working"&&K.status!=="working"||$.filterMode==="idle"&&K.status!=="idle"||$.filterMode==="error"&&K.status!=="error")return!1;if($.sameAreaOnly&&e){const q=F.get(e)??null,xe=F.get(K.id)??null;if(q!==xe)return!1}return!0});const V=K=>[...K].sort((q,xe)=>{const de=!!(q.isBoss||q.class==="boss"),ee=!!(xe.isBoss||xe.class==="boss");if(de!==ee)return de?-1:1;if($.sortMode==="name")return q.name.localeCompare(xe.name);if($.sortMode==="status"){const ge=["working","waiting_input","waiting_permission","error","idle","stopped"],Ee=ge.indexOf(q.status)-ge.indexOf(xe.status);if(Ee!==0)return Ee;const Be=U.agentsWithUnseenOutput.has(q.id),Ve=U.agentsWithUnseenOutput.has(xe.id);if(Be!==Ve)return Be?-1:1;if(q.status==="working"&&xe.status==="working")return q.name.localeCompare(xe.name);if(q.status==="idle"&&xe.status==="idle"){const J=!!q.taskLabel,ne=!!xe.taskLabel;return J!==ne?J?-1:1:(xe.lastActivity||0)-(q.lastActivity||0)}return(xe.lastActivity||0)-(q.lastActivity||0)}const fe=L.get(q.id)||0;return(L.get(xe.id)||0)-fe});if(!$.groupByArea)return V(W);const Y=[],z=new Set;for(const[K,q]of c){if(q.archived)continue;const xe=W.filter(de=>F.get(de.id)===K);if(xe.length>0){const de=V(xe);Y.push(...de);for(const ee of de)z.add(ee.id)}}const Q=V(W.filter(K=>!z.has(K.id)));return Y.push(...Q),W=Y,W},[t,c,d,e,s]),[y,v]=b.useState(0),[S,C]=b.useState(""),k=b.useRef(null),[N,j]=b.useState(null),_=e?x.findIndex(B=>B.id===e):-1,D=_>0?x[_-1]:x[x.length-1],E=_<x.length-1?x[_+1]:x[0],I=b.useRef(null),O=b.useCallback(()=>{if(!e||x.length<=1)return;const B=x.findIndex(U=>U.id===e);if(B===-1)return;const $=(B-1+x.length)%x.length;j("left"),v(0),C(""),H.setLastSelectionViaSwipe(!0),H.selectAgent(x[$].id)},[e,x]),T=b.useCallback(()=>{if(!e||x.length<=1)return;const B=x.findIndex(U=>U.id===e);if(B===-1)return;const $=(B+1)%x.length;j("right"),v(0),C(""),H.setLastSelectionViaSwipe(!0),H.selectAgent(x[$].id)},[e,x]),M=b.useCallback(B=>{v(B),C("is-swiping")},[]),R=b.useCallback(()=>{C("is-animating"),v(0),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{C("")},100)},[]);return b.useEffect(()=>{if(!N||a)return;const B=N;j(null),requestAnimationFrame(()=>{C(B==="left"?"swipe-in-left":"swipe-in-right"),k.current=setTimeout(()=>{C("")},120)})},[N,a]),b.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),xk(I,{enabled:n&&x.length>1,onSwipeLeft:T,onSwipeRight:O,onSwipeMove:M,onSwipeCancel:R,threshold:40,maxVerticalMovement:50,vibrationIntensity:h}),xk(i,{enabled:n&&x.length>1,onSwipeLeft:T,onSwipeRight:O,onSwipeMove:M,onSwipeCancel:R,threshold:50,maxVerticalMovement:35,vibrationIntensity:h}),b.useEffect(()=>{const B=$=>{if(!n||x.length<=1||r)return;const U=H.getShortcuts(),L=U.find(Q=>Q.id==="prev-working-agent"),F=U.find(Q=>Q.id==="next-working-agent"),W=U.find(Q=>Q.id==="prev-agent-terminal"),V=U.find(Q=>Q.id==="next-agent-terminal"),Y=$.altKey&&$.shiftKey&&!$.ctrlKey&&!$.metaKey&&$.code==="KeyJ",z=$.altKey&&$.shiftKey&&!$.ctrlKey&&!$.metaKey&&$.code==="KeyK";if(An($,L)){$.preventDefault();const Q=H.getState();let K=x.filter(de=>Q.agentsWithUnseenOutput.has(de.id));if(K.length===0&&(K=x.filter(de=>de.status==="working")),K.length===0)return;const q=e?K.findIndex(de=>de.id===e):-1,xe=q===-1?K.length-1:(q-1+K.length)%K.length;H.selectAgent(K[xe].id);return}if(An($,F)){$.preventDefault();const Q=H.getState();let K=x.filter(de=>Q.agentsWithUnseenOutput.has(de.id));if(K.length===0&&(K=x.filter(de=>de.status==="working")),K.length===0)return;const q=e?K.findIndex(de=>de.id===e):-1,xe=q===-1?0:(q+1)%K.length;H.selectAgent(K[xe].id);return}if(An($,W)||z){$.preventDefault(),O();return}if(An($,V)||Y){$.preventDefault(),T();return}};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[n,x,e,O,T,r]),{sortedAgents:x,swipeOffset:y,swipeAnimationClass:S,currentAgentIndex:_,prevAgent:D,nextAgent:E,headerRef:I,outputRef:i,handleSwipeLeft:O,handleSwipeRight:T}}const qU=3e4;function VU(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=Ni(),m={};h&&(m.Authorization=`Bearer ${h}`);const x=Sa(),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 C=await S.json();C.branch&&y.set(v,{branch:C.branch,ahead:C.ahead||0,behind:C.behind||0})}}catch{}})),n(y)},[i]);b.useEffect(()=>{if(!i||i.length===0){n(new Map);return}return d(),r.current=setInterval(d,qU),()=>{r.current&&clearInterval(r.current)}},[c,d]);const f=b.useCallback(async h=>{a(m=>new Set(m).add(h));try{await Bt(Dt("/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 GU={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"}},J1={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"}},YU={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"}},KU={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"}},QU={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"}},XU={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"}},JU={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"}},ZU={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"}},e6={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"}},t6={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"}},n6={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"}},s6={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"}},a6={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"}},r6={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"}},i6={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"}},o6={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"}},l6={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"}},c6={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"}},Js=[c6,n6,s6,GU,J1,YU,KU,QU,XU,JU,ZU,e6,t6,a6,r6,i6,o6,l6];function du(t){return Js.find(e=>e.id===t)||J1}const u6="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 Yx(){try{const t=localStorage.getItem("tide-theme");if(t&&Js.some(e=>e.id===t))return t}catch{}return u6}function d6(){const t=Yx(),e=du(t);lp(e)}const f6=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:C,isSnapshotView:k=!1,onSaveSnapshot:N,overviewPanelOpen:j=!1,setOverviewPanelOpen:_,agentInfoOpen:D=!1,onToggleAgentInfo:E,isFullscreen:I=!1,onToggleFullscreen:O,onNavigateBack:T,onNavigateForward:M,canNavigateBack:R=!1,canNavigateForward:B=!1,gitPanelOpen:$=!1,setGitPanelOpen:U,buildingsPanelOpen:L=!1,setBuildingsPanelOpen:F,workflowPanelOpen:W=!1,setWorkflowPanelOpen:V,hasWorkflow:Y=!1,trackingBoardVisible:z=!1,setTrackingBoardVisible:Q}){var le,me;const{t:K}=pt(["terminal","common"]),q=ZO();Br();const xe=Ej(n),de=()=>{const se=rg.indexOf(r),Re=rg[(se+1)%rg.length];i(Re),er(ft.VIEW_MODE,Re)},ee=()=>{const se=!h;m(se),se&&!x&&(y(!0),hs.setEnabled(!0))},fe=()=>{c?f():d()},je=()=>{window.confirm(K("common:confirm.removeAgent",{name:e.name}))&&H.removeAgentFromServer(n)},ge=e.currentTask||e.lastAssignedTask||(xe==null?void 0:xe.text),Ee=e.taskLabel||ge,Be=(le=q.lastReport)==null?void 0:le.agentSummaries.find(se=>se.agentId===e.id||se.agentName===e.name),Ve={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888"},ne=(e.class==="boss"||e.isBoss)&&e.subordinateIds&&e.subordinateIds.length>0,Te=xL(n),qe=Ij(e.class in po?null:e.class),at=(qe==null?void 0:qe.icon)||((me=po[e.class])==null?void 0:me.icon)||"🤖",Se=rr(),Fe=Ce.useMemo(()=>{var se;for(const Re of Se.values())if((se=Re.assignedAgentIds)!=null&&se.includes(n))return Re;return null},[Se,n]),[ie,he]=b.useState(!1),We=b.useRef(null),[st,ut]=b.useState(!1),[ue,X]=b.useState(!1),[ae,we]=b.useState(()=>Yx()),Z=b.useRef(null),ve=K(r==="simple"?"terminal:header.simpleView":r==="chat"?"terminal:header.chatView":"terminal:header.advancedView"),He=r==="simple"?"○":r==="chat"?"◐":"◉",Pe=b.useCallback(()=>{he(!1)},[]),oe=b.useCallback(()=>{ut(!1),X(!1)},[]),Le=se=>{const Re=du(se);lp(Re),we(se)};return b.useEffect(()=>{if(!ie)return;const se=Re=>{We.current&&!We.current.contains(Re.target)&&Pe()};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[ie,Pe]),b.useEffect(()=>{if(!st)return;const se=Re=>{Z.current&&!Z.current.contains(Re.target)&&oe()};return document.addEventListener("mousedown",se),document.addEventListener("touchstart",se),()=>{document.removeEventListener("mousedown",se),document.removeEventListener("touchstart",se)}},[st,oe]),o.jsxs("div",{className:`guake-header ${s.length>1?"has-multiple-agents":""} ${a>.1?"swiping-right":""} ${a<-.1?"swiping-left":""}`,ref:C,style:Fe?{borderBottomColor:`color-mix(in srgb, ${Fe.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:"🔄"})})}),E?o.jsxs("button",{className:`guake-title-btn ${D?"active":""}`,onClick:E,title:K("terminal:header.showAgentInfo"),children:[o.jsx("span",{className:"guake-agent-avatar",children:at}),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||ge)&&o.jsx("span",{className:"guake-title-task-chip",children:e.taskLabel||ge})]}),Ee&&o.jsx("span",{className:"guake-mobile-title-context",children:Ee})]}),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:at}),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||ge)&&o.jsx("span",{className:"guake-title-task-chip",children:e.taskLabel||ge})]}),Ee&&o.jsx("span",{className:"guake-mobile-title-context",children:Ee})]}),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:[Be&&o.jsx("span",{className:"guake-status-line",title:`${Be.statusDescription}
117
+ ${Be.recentWorkSummary}`,children:o.jsx("span",{className:"guake-supervisor-badge",style:{color:Ve[Be.progress]||"#888"},children:Be.progress.replace("_"," ")})}),Te.filter(se=>se.status==="spawning"||se.status==="working").length>0&&o.jsx("span",{className:"guake-subagents-indicator",children:Te.filter(se=>se.status==="spawning"||se.status==="working").map(se=>o.jsxs("span",{className:"guake-subagent-badge active",title:`${se.name} (${se.subagentType}) - ${se.status}`,children:[o.jsx("span",{className:"guake-subagent-icon",children:"⑂"}),o.jsx("span",{className:"guake-subagent-name",children:se.name})]},se.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:!B,children:o.jsx("span",{className:"guake-action-icon",children:"→"})})]}),!k&&_&&o.jsx("button",{className:`guake-icon-action guake-overview-toggle ${j?"active":""}`,onClick:()=>_(!j),title:K(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:"🔄"})}),!k&&Q&&o.jsx("button",{className:`guake-icon-action guake-tracking-board-toggle ${z?"active":""}`,onClick:()=>Q(!z),title:z?"Hide Tracking Board":"Show Tracking Board",children:o.jsx("span",{className:"guake-action-icon",children:"▥"})}),o.jsx("button",{className:`guake-icon-action guake-fullscreen-toggle ${I?"active":""}`,onClick:O,title:K(I?"terminal:header.exitFullscreen":"terminal:header.enterFullscreen"),children:o.jsx("span",{className:"guake-action-icon",children:I?"🗗":"⛶"})}),o.jsx("button",{className:`guake-icon-action guake-search-toggle ${c?"active":""}`,onClick:fe,title:K("terminal:header.search"),children:o.jsx("span",{className:"guake-action-icon",children:"🔍"})}),o.jsx("button",{className:"guake-icon-action danger",onClick:()=>S("clear"),title:K("terminal:header.clearContext"),children:o.jsx("span",{className:"guake-action-icon",children:"🧹"})})]}),!k&&o.jsxs("div",{className:"guake-desktop-more hide-on-mobile",ref:We,children:[o.jsx("button",{className:`guake-desktop-more-btn ${ie?"active":""}`,onClick:()=>he(!ie),title:K("terminal:header.moreActions","More actions"),children:"⋮"}),ie&&o.jsxs("div",{className:"guake-desktop-menu",children:[o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{de(),Pe()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:He}),"View: ",ve]}),N&&v>0&&o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{N(),Pe()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"⭐"}),K("terminal:header.saveSnapshot")]}),F&&o.jsxs("button",{className:`guake-desktop-menu-item ${L?"active":""}`,onClick:()=>{F(!L),Pe()},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:()=>{ee(),Pe()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"🐛"}),K(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"),Pe()},disabled:e.status!=="idle",children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"📦"}),K("terminal:header.collapseContext")]}),ne&&o.jsxs("button",{className:"guake-desktop-menu-item danger",onClick:()=>{S("clear-subordinates"),Pe()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"👑"}),K("terminal:header.clearAllSubordinates")]}),o.jsx("div",{className:"guake-desktop-menu-divider"}),o.jsxs("button",{className:"guake-desktop-menu-item danger",onClick:()=>{je(),Pe()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"❌"}),K("terminal:header.removeAgent")]})]})]}),!k&&o.jsxs("div",{className:"guake-mobile-more show-on-mobile",ref:Z,children:[o.jsx("button",{className:`guake-mobile-more-btn ${st?"active":""}`,onClick:()=>ut(!st),title:K("terminal:header.moreActions","More actions"),children:"⋮"}),st&&o.jsxs("div",{className:"guake-mobile-menu",children:[o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{T==null||T(),oe()},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(),oe()},disabled:!B,children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"→"}),"Forward"]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{de(),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:r==="simple"?"○":r==="chat"?"◐":"◉"}),K(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),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🗑"}),K("terminal:header.clearOutput")]}),N&&v>0&&o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{N(),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"⭐"}),K("terminal:header.saveSnapshot")]}),o.jsxs("button",{className:`guake-mobile-menu-item ${I?"active":""}`,onClick:()=>{O==null||O(),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:I?"🗗":"⛶"}),K(I?"terminal:header.exitFullscreen":"terminal:header.enterFullscreen")]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{fe(),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:c?"✕":"🔍"}),K("terminal:header.search")]}),_&&o.jsxs("button",{className:`guake-mobile-menu-item ${j?"active":""}`,onClick:()=>{_(!j),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"📊"}),K(j?"terminal:header.hideOverview":"terminal:header.showOverview")]}),U&&o.jsxs("button",{className:`guake-mobile-menu-item ${$?"active":""}`,onClick:()=>{U(!$),oe()},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),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🔄"}),W?"Hide Workflow":"Show Workflow"]}),F&&o.jsxs("button",{className:`guake-mobile-menu-item ${L?"active":""}`,onClick:()=>{F(!L),oe()},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:()=>{ee(),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🐛"}),K(h?"terminal:header.hideDebug":"terminal:header.showDebug")]}),o.jsxs("button",{className:`guake-mobile-menu-item ${ue?"active":""}`,onClick:()=>X(!ue),children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🎨"}),K("terminal:themeSelector.selectTheme"),o.jsx("span",{className:"guake-mobile-theme-arrow",children:ue?"▲":"▼"})]}),ue&&o.jsx("div",{className:"guake-mobile-theme-list",children:Js.map(se=>o.jsxs("button",{className:`guake-mobile-theme-option ${se.id===ae?"active":""}`,onClick:()=>Le(se.id),children:[o.jsx("span",{className:"guake-mobile-theme-preview",style:{background:`linear-gradient(135deg, ${se.colors.bgPrimary} 0%, ${se.colors.bgSecondary} 50%, ${se.colors.accentPurple} 100%)`}}),o.jsx("span",{className:"guake-mobile-theme-name",children:se.name}),se.id===ae&&o.jsx("span",{className:"guake-mobile-theme-check",children:"✓"})]},se.id))}),o.jsx("div",{className:"guake-mobile-menu-divider"}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{S("collapse"),oe()},disabled:e.status!=="idle",children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"📦"}),K("terminal:header.collapseContext")]}),o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{S("clear"),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🧹"}),K("terminal:header.clearContext")]}),ne&&o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{S("clear-subordinates"),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"👑🗑️"}),K("terminal:header.clearAllSubordinates")]}),o.jsx("div",{className:"guake-mobile-menu-divider"}),o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{je(),oe()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"❌"}),K("terminal:header.removeAgent")]})]})]}),o.jsx("button",{className:"guake-close-btn show-on-mobile",onClick:()=>H.setMobileView("3d"),title:K("terminal:header.closeTerminal"),children:"✕"})]})]})});function p6({searchInputRef:t,searchQuery:e,setSearchQuery:n,closeSearch:s,matchCount:a,currentMatch:r,navigateNext:i,navigatePrev:c,loadingFullHistory:d}){const{t:f}=pt(["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 h6({agent:t,content:e,isOpen:n,onClose:s}){const{t:a}=pt(["tools","common","terminal"]),r=b.useCallback(()=>{navigator.clipboard.writeText(e)},[e]),{handleMouseDown:i,handleClick:c}=wa(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 m6({url:t,name:e,onClose:n}){const{handleMouseDown:s,handleClick:a}=wa(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 g6({state:t,onClose:e}){const{t:n}=pt(["terminal","common"]),{handleMouseDown:s,handleClick:a}=wa(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:mo(t.command,"bash")}})}),o.jsx("div",{className:`bash-modal-content ${t.isLive?"is-loading":""}`,children:o.jsx("pre",{dangerouslySetInnerHTML:{__html:Sl(t.output)}})})]})})})}function b6({action:t,selectedAgentId:e,subordinateCount:n,onClose:s,onClearHistory:a}){const{t:r}=pt(["terminal","common"]),{handleMouseDown:i,handleClick:c}=wa(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 x6(){const t=px(),e=Dl(),n=t?e.get(t):null;return n?o.jsx(Xj,{agent:n,isOpen:!!t,onClose:()=>H.closeContextModal(),onRefresh:()=>{t&&H.refreshAgentContext(t)}}):null}function y6(){const t=fx(),e=nL(),n=sL();return t?o.jsx(c1,{isOpen:!!t,onClose:()=>H.clearFileViewerPath(),filePath:t,action:e?"modified":"read",editData:e||void 0,searchRoot:n||void 0}):null}function v6({agent:t,content:e,onClose:n}){return t?o.jsx(h6,{agent:t,content:e||"",isOpen:!!e,onClose:n}):null}function cA(t){if(!t)return"N/A";try{return new Date(t).toLocaleString()}catch{return"N/A"}}function w6({agent:t,isOpen:e,onClose:n}){var j,_,D,E,I;const{t:s}=pt(["terminal","common"]),{handleMouseDown:a,handleClick:r}=wa(n),i=iL((t==null?void 0:t.id)||null),c=Ij((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=((_=t.customInstructions)==null?void 0:_.trim())||"",m=f.length>0,x=h.length>0,y=m||x,v=m&&x,S=[f,h].filter(Boolean).join(`
118
+
119
+ `),C=Math.max(1,((D=t.contextStats)==null?void 0:D.contextWindow)||t.contextLimit||2e5),k=((E=t.contextStats)==null?void 0:E.totalTokens)||t.contextUsed||0,N=((I=t.contextStats)==null?void 0:I.usedPercent)||Math.round(k/C*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()," / ",C.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:cA(t.lastActivity)})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.created")}),o.jsx("strong",{children:cA(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 uA(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 dA(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 k6=({agentId:t,onClose:e})=>{const{t:n}=pt(["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,C]=b.useState(!1),[k,N]=b.useState({total:0,sent:0,received:0,messageTypes:[]}),[j,_]=b.useState(new Set),[D,E]=b.useState(new Set),[I,O]=b.useState("all"),[T,M]=b.useState("all"),[R,B]=b.useState("all"),[$,U]=b.useState(!1),[L,F]=b.useState(""),[W,V]=b.useState(!0),Y=b.useRef(null),z=b.useRef(null),Q=b.useCallback(()=>{const Se=hs.getMessages(t);i([...Se]),N(hs.getStats(t))},[t]),K=b.useCallback(()=>{const Se=hs.getLogs();d([...Se])},[]),q=b.useCallback(async()=>{v(!0),x("");try{const Se=await Bt(Dt(`/api/agents/${encodeURIComponent(t)}/process-output`)),Fe=await Se.json();if(!Se.ok){h(null),x((Fe==null?void 0:Fe.error)||"Failed to load process output");return}h(Fe)}catch(Se){h(null),x(Se instanceof Error?Se.message:"Failed to load process output")}finally{v(!1),C(!0)}},[t]);b.useEffect(()=>(Q(),hs.subscribe(Fe=>{(Fe===t||Fe==="all")&&Q()})),[t,Q]),b.useEffect(()=>(K(),hs.subscribeLogs(()=>{K()})),[K]);const xe=b.useMemo(()=>r.filter(Se=>{if($){const Fe=Se.payload;if(!(Fe!=null&&Fe.text)||typeof Fe.text!="string")return!1}if(I!=="all"&&Se.direction!==I||T!=="all"&&Se.type!==T)return!1;if(L){const Fe=L.toLowerCase(),ie=Se.type.toLowerCase().includes(Fe),he=JSON.stringify(Se.payload).toLowerCase().includes(Fe);return ie||he}return!0}),[r,I,T,$,L]),de=b.useMemo(()=>c.filter(Se=>{var Fe;if(R!=="all"&&Se.level!==R)return!1;if(L){const ie=L.toLowerCase(),he=Se.message.toLowerCase().includes(ie),We=((Fe=Se.source)==null?void 0:Fe.toLowerCase().includes(ie))||!1,st=Se.data?JSON.stringify(Se.data).toLowerCase().includes(ie):!1;return he||We||st}return!0}),[c,R,L]);b.useEffect(()=>{W&&Y.current&&s==="messages"&&(Y.current.scrollTop=Y.current.scrollHeight)},[xe,W,s]),b.useEffect(()=>{W&&z.current&&s==="logs"&&(z.current.scrollTop=z.current.scrollHeight)},[de,W,s]),b.useEffect(()=>{s==="process"&&!S&&!y&&q()},[s,S,y,q]),b.useEffect(()=>{h(null),x(""),v(!1),C(!1)},[t]);const ee=Se=>{_(Fe=>{const ie=new Set(Fe);return ie.has(Se)?ie.delete(Se):ie.add(Se),ie})},fe=()=>{_(new Set(xe.map(Se=>Se.id)))},je=()=>{_(new Set)},ge=Se=>{navigator.clipboard.writeText(Se.raw)},Ee=()=>{const Se=xe.map(Fe=>Fe.raw).join(`
120
+
121
+ `);navigator.clipboard.writeText(Se)},Be=()=>{hs.clearMessages(t)},Ve=()=>{hs.clearLogs()},J=()=>{if(!f)return;const Se=[`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(Se)},ne=Se=>{E(Fe=>{const ie=new Set(Fe);return ie.has(Se)?ie.delete(Se):ie.add(Se),ie})},Te=Se=>{switch(Se){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"}}},qe=Se=>new Date(Se).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),at=Se=>Se<1024?`${Se}B`:Se<1024*1024?`${(Se/1024).toFixed(1)}KB`:`${(Se/(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:I,onChange:Se=>O(Se.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:Se=>M(Se.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allTypes")}),k.messageTypes.map(Se=>o.jsx("option",{value:Se,children:Se},Se))]}),o.jsx("input",{type:"text",placeholder:n("terminal:debug.search"),value:L,onChange:Se=>F(Se.target.value),className:"search-input"})]}),o.jsxs("div",{className:"agent-debug-actions",children:[o.jsx("button",{onClick:fe,className:"action-btn",title:n("tools:display.expandAll"),children:n("tools:display.expandAll")}),o.jsx("button",{onClick:je,className:"action-btn",title:n("tools:display.collapseAll"),children:n("tools:display.collapseAll")}),o.jsx("button",{onClick:Ee,className:"action-btn",title:n("terminal:debug.copyAll"),children:n("terminal:debug.copyAll")}),o.jsx("button",{onClick:Be,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:Se=>V(Se.target.checked)}),o.jsx("span",{className:"toggle-switch"}),n("terminal:debug.autoScroll")]})]}),o.jsx("div",{className:"agent-debug-messages",ref:Y,children:xe.length===0?o.jsx("div",{className:"no-messages",children:r.length===0?n("terminal:debug.noMessagesCaptured"):n("terminal:debug.noMessagesMatch")}):xe.map(Se=>{const Fe=j.has(Se.id),ie=Se.payload,he=ie!=null&&ie.text&&typeof ie.text=="string"?ie.text:"",We=Se.type==="event"&&(ie==null?void 0:ie.type)==="tool_start",st=Se.type==="event"&&(ie==null?void 0:ie.type)==="tool_result",ut=Se.type==="output"&&(he.startsWith("Using tool:")||he.startsWith("Tool input:")||he.startsWith("Tool result:")),ue=he.startsWith("Using tool:"),X=he.startsWith("Tool input:"),ae=he.startsWith("Tool result:");let we="",Z=null,ve="";if(ue)we=he.replace("Using tool:","").trim();else if(X)try{const lt=he.replace("Tool input:","").trim();Z=JSON.parse(lt)}catch{}else ae&&(ve=he.replace("Tool result:","").trim());const Pe=We||st||ut,oe=We||ue||X,Le=st||ae,le=(ie==null?void 0:ie.toolName)||we,me=(ie==null?void 0:ie.toolInput)||Z,se=(ie==null?void 0:ie.toolOutput)||ve,Re=he&&!ut,Ke=Se.type==="event"?ie==null?void 0:ie.type:null,tt=(()=>{var lt;if(Se.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 it=ie.tokens;return it?`${it.input||0} in / ${it.output||0} out`:null;case"error":return((lt=ie.errorMessage)==null?void 0:lt.slice(0,40))||null;case"thinking":return ie.text?`"${ie.text.slice(0,30)}..."`:null;default:return null}})(),nt=oe&&me?(()=>{if(!me)return null;const lt=Object.keys(me);if(lt.length===0)return null;const it=["file_path","path","pattern","command","content","query"];return lt.sort((jt,be)=>{const _e=it.indexOf(jt),Ge=it.indexOf(be);return _e===-1&&Ge===-1?0:_e===-1?1:Ge===-1?-1:_e-Ge}).slice(0,3).map(jt=>{let be=me[jt];return typeof be=="string"?be.length>60&&(be=be.slice(0,60)+"..."):typeof be=="object"&&(be=JSON.stringify(be).slice(0,40)+"..."),{key:jt,value:be}})})():null;return o.jsxs("div",{className:`debug-message debug-message-${Se.direction} ${Re?"has-text-preview":""} ${Pe?"is-tool-event":""} ${oe?"tool-start":""} ${Le?"tool-result":""}`,children:[o.jsxs("div",{className:"message-header",onClick:()=>ee(Se.id),children:[o.jsx("span",{className:"expand-icon",children:Fe?"▼":"▶"}),o.jsx("span",{className:`direction direction-${Se.direction}`,children:Se.direction==="sent"?"↑ SENT":"↓ RECEIVED"}),o.jsx("span",{className:"message-type",children:Pe?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:Se.type}),o.jsx("span",{className:"event-subtype",children:Ke})]}):Se.type}),Pe&&le&&o.jsx("span",{className:"tool-name-inline",children:le}),!Pe&&tt&&o.jsx("span",{className:"event-summary",children:tt}),o.jsx("span",{className:"message-time",children:qe(Se.timestamp)}),o.jsx("span",{className:"message-size",children:at(Se.size)}),o.jsx("button",{className:"copy-btn",onClick:lt=>{lt.stopPropagation(),ge(Se)},title:"Copy message",children:"📋"})]}),Fe&&o.jsxs("div",{className:"message-body",children:[oe&&(me||X&&!Z)&&o.jsxs("div",{className:"tool-preview",children:[nt&&nt.length>0&&o.jsx("div",{className:"tool-inputs",children:nt.map(({key:lt,value:it})=>o.jsxs("div",{className:"tool-input-item",children:[o.jsxs("span",{className:"tool-input-key",children:[lt,":"]}),o.jsx("span",{className:"tool-input-value",children:String(it)})]},lt))}),X&&!Z&&o.jsx("div",{className:"tool-raw-input",children:he.replace("Tool input:","").trim().slice(0,200)})]}),Le&&se&&o.jsx("div",{className:"tool-preview tool-result-preview",children:o.jsx("div",{className:"tool-output-preview",children:typeof se=="string"?se.slice(0,200)+(se.length>200?"...":""):JSON.stringify(se).slice(0,200)})}),Re&&!Pe&&o.jsx("div",{className:"message-text-preview expanded",children:o.jsx("span",{className:"text-content",children:ie.text})}),o.jsx("pre",{children:uA(JSON.stringify(Se.payload,(lt,it)=>it===void 0?null:typeof it=="object"&&it!==null&&!(it instanceof Date)&&!Array.isArray(it)&&typeof it[Symbol.iterator]=="function"?Array.from(it):typeof it=="function"?`[Function: ${it.name||"anonymous"}]`:it,2))})]})]},Se.id)})})]}),s==="logs"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-controls",children:[o.jsxs("select",{value:R,onChange:Se=>B(Se.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:Se=>F(Se.target.value),className:"search-input"})]}),o.jsxs("div",{className:"agent-debug-actions",children:[o.jsx("button",{onClick:Ve,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:Se=>V(Se.target.checked)}),o.jsx("span",{className:"toggle-switch"}),n("terminal:debug.autoScroll")]})]}),o.jsx("div",{className:"agent-debug-messages agent-debug-logs",ref:z,children:de.length===0?o.jsx("div",{className:"no-messages",children:c.length===0?n("terminal:debug.noLogsYet"):n("terminal:debug.noLogsMatch")}):de.map(Se=>{const Fe=D.has(Se.id),ie=Te(Se.level);return o.jsxs("div",{className:`debug-message debug-log ${ie.className}`,children:[o.jsxs("div",{className:"message-header",onClick:()=>ne(Se.id),children:[o.jsx("span",{className:"expand-icon",children:Fe?"▼":"▶"}),o.jsx("span",{className:"log-level-icon",children:ie.icon}),o.jsx("span",{className:"log-level",children:Se.level.toUpperCase()}),Se.source&&o.jsxs("span",{className:"log-source",children:["[",Se.source,"]"]}),o.jsx("span",{className:"log-message",children:Se.message}),o.jsx("span",{className:"message-time",children:qe(Se.timestamp)})]}),Fe&&Se.data!==void 0?o.jsx("div",{className:"message-body",children:o.jsx("pre",{children:o.jsx(o.Fragment,{children:uA(JSON.stringify(Se.data,(he,We)=>We===void 0?null:typeof We=="object"&&We!==null&&!(We instanceof Date)&&!Array.isArray(We)&&typeof We[Symbol.iterator]=="function"?Array.from(We):typeof We=="function"?`[Function: ${We.name||"anonymous"}]`:We,2))})})}):null]},Se.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:J,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:dA(f.output||"(empty)")}),o.jsx("div",{className:"process-stream-label",children:"stderr"}),o.jsx("pre",{className:"ansi-output",children:dA(f.errorOutput||"(empty)")})]}):o.jsx("div",{className:"no-messages",children:n(y?"terminal:debug.loadingProcessOutput":"terminal:debug.noProcessOutput")})})]})]})};function S6(t){return t.isDirectory?"":Kf[t.extension]||Kf.default}function Bp(t){return Kf[t]||Kf.default}function wV(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function C6(t,e){if(!e)return null;const n=t.toLowerCase().indexOf(e.toLowerCase());return n===-1?null:{start:n,end:n+e.length}}function Vg(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 A6(t,e){for(const n of t)n.isDirectory&&(e.add(n.path),A6(n.children,e))}const j6=3,N6=3;function T6(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 Bt(Dt(`/api/files/tree?path=${encodeURIComponent(t)}&depth=${j6}`)),j=await N.json();if(N.ok&&j.tree){const _=Mf(j.tree),D={name:j.name,path:t,isDirectory:!0,size:0,extension:"",children:_};n([D]);const E=new Set([t]);Wb(_,E),d(E),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 Bt(Dt(`/api/files/tree?path=${encodeURIComponent(N)}&depth=${N6}`)),_=await j.json();if(j.ok&&_.tree){const D=Mf(_.tree);return n(E=>{const I=JSON.parse(JSON.stringify(E)),O=Jc(I,N);return O&&(O.children=D),I}),d(E=>{const I=new Set(E);return I.add(N),Wb(_.tree,I),I}),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=>E===N?j:E.startsWith(`${N}/`)?`${j}${E.slice(N.length)}`:E,D=E=>{const I=E.map(O=>{const T=_(O.path),M=O.children?D(O.children):void 0;return{...O,path:T,name:T.split("/").pop()||O.name,extension:O.isDirectory?"":_6(T),children:M}});return Mf(I)};n(E=>D(E)),d(E=>{const I=new Set;for(const O of E)I.add(_(O));return I})},[]),C=b.useCallback(async N=>{if(m.current.has(N))i(_=>{const D=new Set(_);return D.delete(N),D});else{i(D=>{const E=new Set(D);return E.add(N),E});let _=Jc(f.current,N);for(;_&&_.isDirectory;){let D=_.children;if((!D||D.length===0)&&!h.current.has(_.path)&&(D=await y(_.path)||[]),!D||D.length===0)break;const E=D.filter(T=>T.isDirectory);if(D.some(T=>!T.isDirectory)||E.length!==1)break;const O=E[0];i(T=>{const M=new Set(T);return M.add(O.path),M}),_=O}}},[y]),k=b.useCallback(async N=>{var T;if(!N)return;const j=(t==null?void 0:t.replace(/\/+$/,""))||null,_=()=>new Promise(M=>{requestAnimationFrame(()=>M())}),D=async(M,R=20)=>{for(let B=0;B<R;B++){const $=Jc(f.current,M);if($)return $;await _()}return null},E=[];if(j&&N.startsWith(j)){E.push(j);const R=N.substring(j.length).split("/").filter(Boolean);let B=j;for(const $ of R)B=`${B}/${$}`,E.push(B)}else E.push(N);for(const M of E){const R=await D(M);R!=null&&R.isDirectory&&(h.current.has(R.path)||(await y(R.path),await _()))}const I=new Set(m.current);let O=0;for(;O<E.length;){const M=E[O],R=Jc(f.current,M);if(!(R!=null&&R.isDirectory)){O++;continue}let B=R;for(;B.children&&B.children.length===1&&((T=B.children[0])!=null&&T.isDirectory);)B=B.children[0];for(I.add(B.path);O<E.length;){if(E[O]===B.path){O++;break}O++}}i(I),await _()},[t,y]);return{tree:e,loading:s,expandedPaths:r,loadTree:x,reloadDirectory:v,renamePathInTree:S,togglePath:C,expandToPath:k,setExpandedPaths:i}}function _6(t){const e=t.lastIndexOf(".");return e===-1?"":t.slice(e).toLowerCase()}function Jc(t,e){for(const n of t){if(n.path===e)return n;if(n.children){const s=Jc(n.children,e);if(s)return s}}return null}function Wb(t,e){for(const n of t)n.isDirectory&&n.children&&n.children.length>0&&(e.add(n.path),Wb(n.children,e))}function E6(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 E6(t).map(n=>n.isDirectory&&n.children?{...n,children:Mf(n.children)}:n)}function fA(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 M6(t){return[...t].sort((e,n)=>e.isDirectory&&!n.isDirectory?-1:!e.isDirectory&&n.isDirectory?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase()))}function qb(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 D6({text:t,query:e}){const n=C6(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 R6({node:t,depth:e,selectedPath:n,expandedPaths:s,onSelect:a,onToggle:r,onContextMenu:i,searchQuery:c}){const d=b.useMemo(()=>qb(t),[t]),f=s.has(d.expansionPath),h=n===t.path||n===d.expansionPath,m=fA(t.gitStatus),x=b.useMemo(()=>d.terminalNode.children?M6(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:fA(t.gitStatus)||"#c89a5a"}})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"tree-arrow-spacer"}),o.jsx("span",{className:"tree-icon",style:{backgroundImage:`url('${S6(t)}')`},role:"img","aria-label":"file"})]}),o.jsx("span",{className:"tree-name",style:m?{color:m}:void 0,children:o.jsx(D6,{text:d.displayName,query:c})})]}),t.isDirectory&&f&&x.length>0&&o.jsx("div",{className:"tree-children",children:x.map(S=>o.jsx(Kx,{node:S,depth:e+1,selectedPath:n,expandedPaths:s,onSelect:a,onToggle:r,onContextMenu:i,searchQuery:c},S.path))})]})}const Kx=b.memo(R6,(t,e)=>{if(t.node!==e.node||t.depth!==e.depth||t.searchQuery!==e.searchQuery||t.onContextMenu!==e.onContextMenu)return!1;const n=qb(t.node).expansionPath,s=qb(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});Kx.displayName="TreeNodeItem";function Gg(t){const e=t.lastIndexOf(".")>=0?t.substring(t.lastIndexOf(".")):"";return Af(e)}function O6(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 Z1({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(Z1,{node:y,depth:e+1,expandedDirs:n,onToggleDir:s,onFileClick:a,onContextMenu:r,onDiscard:i,repoDir:c},y.path))]})}const d=t.file,f=a1[d.status],h=Bp(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 L6({agentId:t,agents:e,onClose:n,branchInfoMap:s,fetchRemote:a,fetchingDirs:r}){const{t:i}=pt(["terminal","common"]),c=rr(),[d,f]=b.useState([]),[h,m]=b.useState(!1),[x,y]=b.useState(new Set),[v,S]=b.useState(new Set),[C,k]=b.useState(null),[N,j]=b.useState(!1),[_,D]=b.useState(()=>va(ft.GIT_PANEL_VIEW_MODE,"flat")==="tree"?"tree":"flat"),[E,I]=b.useState(()=>va(ft.GIT_PANEL_MODE,"changes")==="explorer"?"explorer":"changes"),[O,T]=b.useState(()=>ta(ft.GIT_PANEL_FOLDER_IDX,0)),M=b.useCallback(ue=>{D(ue),er(ft.GIT_PANEL_VIEW_MODE,ue)},[]),R=b.useCallback(ue=>{I(ue),er(ft.GIT_PANEL_MODE,ue)},[]),B=b.useCallback(ue=>{T(ue),ya(ft.GIT_PANEL_FOLDER_IDX,ue)},[]),[$,U]=b.useState(null),[L,F]=b.useState(null),[W,V]=b.useState(null),Y=Ce.useRef(!1),z=Ce.useRef(t),Q=b.useMemo(()=>{const ue=new Set,X=[];for(const we of c.values())if(!(we.archived||we.directories.length===0)&&we.assignedAgentIds.includes(t)){ue.add(we.id);for(const Z of we.directories)Z&&Z.trim()&&X.push(Z)}const ae=e.get(t);if(ae){for(const we of c.values())if(!(we.archived||we.directories.length===0||ue.has(we.id))&&O6({x:ae.position.x,z:ae.position.z},we))for(const Z of we.directories)Z&&Z.trim()&&X.push(Z)}return ae!=null&&ae.cwd&&!X.includes(ae.cwd)&&X.unshift(ae.cwd),[...new Set(X)]},[t,e,c]),K=Q.length>0?Q[O]||Q[0]:null,q=T6(E==="explorer"?K:null);b.useEffect(()=>{E==="explorer"&&K&&q.loadTree()},[E,K]);const xe=b.useMemo(()=>{if(q.tree.length===0||d.length===0||!K)return q.tree;const ue=new Map;for(const ae of d)for(const we of ae.gitStatus.files){const Z=we.path.startsWith("/")?we.path:`${ae.dir.replace(/\/$/,"")}/${we.path}`;ue.set(Z,we.status)}if(ue.size===0)return q.tree;const X=ae=>ae.map(we=>{if(we.isDirectory){const ve=we.children?X(we.children):void 0,He=ve?ve.some(Pe=>Pe.gitStatus||Pe.hasGitChanges):!1;return He||ve!==we.children?{...we,children:ve,hasGitChanges:He}:we}const Z=ue.get(we.path);return Z?{...we,gitStatus:Z}:we});return X(q.tree)},[q.tree,d,K]);b.useEffect(()=>{z.current!==t&&(z.current=t,Y.current=!1,f([]),y(new Set),S(new Set),k(null),B(0),U(null))},[t]);const de=Ce.useRef(0),ee=b.useCallback(async()=>{if(Q.length===0)return;const ue=++de.current;m(!0);try{const X=[];if(await Promise.all(Q.map(async ae=>{try{const we=await Bt(Dt(`/api/files/git-status?path=${encodeURIComponent(ae)}`));if(we.ok){const Z=await we.json();if(Z.isGitRepo&&Z.files.length>0){const ve=ae.split("/").filter(Boolean).pop()||ae;X.push({dir:ae,dirName:ve,gitStatus:Z})}}}catch{}})),ue!==de.current)return;X.sort((ae,we)=>ae.dirName.localeCompare(we.dirName)),f(X),!Y.current&&X.length>0&&(Y.current=!0,y(new Set(X.map(ae=>ae.dir))))}finally{ue===de.current&&m(!1)}},[Q]);b.useEffect(()=>{ee();const ue=setInterval(ee,15e3);return()=>clearInterval(ue)},[ee]);const fe=b.useCallback(async()=>{Q.length!==0&&(await Promise.all(Q.map(ue=>a(ue))),await ee())},[Q,a,ee]),je=b.useCallback(ue=>{y(X=>{const ae=new Set(X);return ae.has(ue)?ae.delete(ue):ae.add(ue),ae})},[]),ge=b.useCallback(ue=>{S(X=>{const ae=new Set(X);return ae.has(ue)?ae.delete(ue):ae.add(ue),ae})},[]),Ee=b.useCallback(async(ue,X)=>{const ae=ue.path.startsWith("/")?ue.path:`${X.replace(/\/$/,"")}/${ue.path}`;j(!0);try{if(bf(ue.status)){let we="",Z="";if(ue.status!=="deleted")try{const ve=await Bt(Dt(`/api/files/read?path=${encodeURIComponent(ae)}`));if(ve.ok){const He=await ve.json();He.content!=null&&(Z=He.content)}}catch{}try{const ve=await Bt(Dt(`/api/files/git-original?path=${encodeURIComponent(ae)}`));if(ve.ok){const He=await ve.json();He.content!=null&&(we=He.content)}}catch{}k({type:"diff",data:{filePath:ae,fileName:ue.name,originalContent:we,modifiedContent:Z,language:Gg(ue.name)}})}else{let we="";try{const Z=await Bt(Dt(`/api/files/read?path=${encodeURIComponent(ae)}`));if(Z.ok){const ve=await Z.json();ve.content!=null&&(we=ve.content)}}catch{}k({type:"content",data:{filePath:ae,fileName:ue.name,content:we,language:Gg(ue.name)},isNewFile:!0})}}catch{}finally{j(!1)}},[]),Be=b.useCallback(async ue=>{if(!ue.isDirectory){U(ue.path),j(!0);try{const X=ue.name,ae=Gg(X);if(ue.gitStatus&&bf(ue.gitStatus)){let we="",Z="";if(ue.gitStatus!=="deleted")try{const ve=await Bt(Dt(`/api/files/read?path=${encodeURIComponent(ue.path)}`));if(ve.ok){const He=await ve.json();He.content!=null&&(Z=He.content)}}catch{}try{const ve=await Bt(Dt(`/api/files/git-original?path=${encodeURIComponent(ue.path)}`));if(ve.ok){const He=await ve.json();He.content!=null&&(we=He.content)}}catch{}k({type:"diff",data:{filePath:ue.path,fileName:X,originalContent:we,modifiedContent:Z,language:ae}})}else{let we="";try{const Z=await Bt(Dt(`/api/files/read?path=${encodeURIComponent(ue.path)}`));if(Z.ok){const ve=await Z.json();ve.content!=null&&(we=ve.content)}}catch{}k({type:"content",data:{filePath:ue.path,fileName:X,content:we,language:ae},isNewFile:ue.gitStatus==="added"||ue.gitStatus==="untracked"})}}finally{j(!1)}}},[]),Ve=b.useMemo(()=>{const ue=[],X=(ae,we,Z)=>{for(const ve of ae)if(ve.isDirectory)X(ve.children,we,Z);else{const He=we.find(Pe=>Pe.path===ve.path);He&&ue.push({file:He,repoDir:Z})}};for(const ae of d)if(x.has(ae.dir))if(_==="tree"){const we=Vg(ae.gitStatus.files);X(we,ae.gitStatus.files,ae.dir)}else for(const we of ae.gitStatus.files)ue.push({file:we,repoDir:ae.dir});return ue},[d,_,x]),J=b.useCallback(async ue=>{if(!C)return;const X=C.data.filePath,ae=Ve.findIndex(({file:He,repoDir:Pe})=>(He.path.startsWith("/")?He.path:`${Pe.replace(/\/$/,"")}/${He.path}`)===X);if(ae<0)return;const we=ae+ue;if(we<0||we>=Ve.length)return;const{file:Z,repoDir:ve}=Ve[we];await Ee(Z,ve)},[C,Ve,Ee]),ne=b.useMemo(()=>{if(!C)return-1;const ue=C.data.filePath;return Ve.findIndex(({file:X,repoDir:ae})=>(X.path.startsWith("/")?X.path:`${ae.replace(/\/$/,"")}/${X.path}`)===ue)},[C,Ve]),Te=b.useCallback(()=>k(null),[]),qe=b.useCallback(()=>F(null),[]),at=b.useCallback(async ue=>{try{const X=await Bt(Dt("/api/files/delete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:ue.path})});if(X.ok){if(ue.status==="added")try{await Bt(Dt("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ue.path,status:"added"}],directory:ue.repoDir})})}catch{}}else{const ae=await X.json().catch(()=>({error:"Unknown error"}));console.error("Delete failed:",ae.error)}ee(),E==="explorer"&&q.loadTree()}catch(X){console.error("Delete request failed:",X)}finally{V(null)}},[ee,E,q]),[Se,Fe]=b.useState(null),ie=b.useCallback(async ue=>{try{await Bt(Dt("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ue.path,status:ue.status}],directory:ue.repoDir})}),ee()}catch{}finally{Fe(null)}},[ee]),he=b.useCallback((ue,X,ae)=>{ue.stopPropagation();const we=X.path.startsWith("/")?X.path:`${ae.replace(/\/$/,"")}/${X.path}`;X.status==="untracked"||X.status==="added"?V({path:we,name:X.name,status:X.status,repoDir:ae}):Fe({path:we,name:X.name,status:X.status,repoDir:ae})},[]),We=b.useCallback((ue,X,ae)=>{ue.preventDefault(),ue.stopPropagation();const we=X.path.startsWith("/")?X.path:`${ae.replace(/\/$/,"")}/${X.path}`,Z=[];Z.push({id:"view",label:bf(X.status)?"View Diff":"View File",icon:bf(X.status)?"📊":"📄",onClick:()=>Ee(X,ae)}),Z.push({id:"div1",label:"",divider:!0,onClick:()=>{}}),Z.push({id:"copy-path",label:"Copy Full Path",icon:"🧷",onClick:()=>{navigator.clipboard.writeText(we)}}),Z.push({id:"copy-rel",label:"Copy Relative Path",icon:"📋",onClick:()=>{navigator.clipboard.writeText(X.path)}}),X.status!=="deleted"&&(Z.push({id:"div2",label:"",divider:!0,onClick:()=>{}}),Z.push({id:"open-editor",label:"Open in Editor",icon:"✏️",onClick:async()=>{try{await Bt(Dt("/api/files/open-in-editor"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:we})})}catch{}}})),(X.status==="modified"||X.status==="deleted"||X.status==="renamed")&&(Z.push({id:"div3",label:"",divider:!0,onClick:()=>{}}),Z.push({id:"discard",label:"Discard Changes",icon:"↩️",danger:!0,onClick:async()=>{try{await Bt(Dt("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:we,status:X.status}],directory:ae})}),ee()}catch{}}})),X.status!=="deleted"&&(X.status==="modified"||X.status==="renamed"||Z.push({id:"div-del",label:"",divider:!0,onClick:()=>{}}),Z.push({id:"delete",label:"Delete File",icon:"🗑️",danger:!0,onClick:()=>V({path:we,name:X.name,status:X.status,repoDir:ae})})),F({isOpen:!0,position:{x:ue.clientX,y:ue.clientY},actions:Z})},[Ee]),st=b.useCallback((ue,X)=>{ue.preventDefault(),ue.stopPropagation();const ae=[];if(X.isDirectory||(ae.push({id:"view",label:"View File",icon:"📄",onClick:()=>Be(X)}),ae.push({id:"div1",label:"",divider:!0,onClick:()=>{}})),ae.push({id:"copy-path",label:"Copy Full Path",icon:"🧷",onClick:()=>{navigator.clipboard.writeText(X.path)}}),K){const we=X.path.startsWith(K)?X.path.slice(K.replace(/\/$/,"").length+1):X.path;ae.push({id:"copy-rel",label:"Copy Relative Path",icon:"📋",onClick:()=>{navigator.clipboard.writeText(we)}})}X.isDirectory||(ae.push({id:"div2",label:"",divider:!0,onClick:()=>{}}),ae.push({id:"open-editor",label:"Open in Editor",icon:"✏️",onClick:async()=>{try{await Bt(Dt("/api/files/open-in-editor"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:X.path})})}catch{}}}),ae.push({id:"div-del",label:"",divider:!0,onClick:()=>{}}),ae.push({id:"delete",label:"Delete File",icon:"🗑️",danger:!0,onClick:()=>V({path:X.path,name:X.name,status:X.gitStatus||"untracked",repoDir:K||""})})),F({isOpen:!0,position:{x:ue.clientX,y:ue.clientY},actions:ae})},[Be,K]),ut=d.reduce((ue,X)=>ue+X.gitStatus.files.length,0);return b.useEffect(()=>{if(!C&&!W&&!Se)return;const ue=X=>{X.key==="Escape"&&(X.stopImmediatePropagation(),X.preventDefault(),Se?Fe(null):W?V(null):Te())};return document.addEventListener("keydown",ue,!0),()=>document.removeEventListener("keydown",ue,!0)},[C,Te,W,Se]),Qt("guake-git-diff-modal",C!==null,Te),Qt("guake-git-delete-confirm",W!==null,()=>V(null)),Qt("guake-git-discard-confirm",Se!==null,()=>Fe(null)),b.useEffect(()=>{if(_==="tree"&&v.size===0&&d.length>0){const ue=new Set;for(const X of d){const ae=Vg(X.gitStatus.files),we=Z=>{for(const ve of Z)ve.isDirectory&&(ue.add(ve.path),we(ve.children))};we(ae)}S(ue)}},[_,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:ue=>ue.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"})]})]})}),Se&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:()=>Fe(null),children:o.jsxs("div",{className:"guake-git-delete-confirm",onClick:ue=>ue.stopPropagation(),children:[o.jsxs("p",{children:["Discard changes to ",o.jsx("strong",{children:Se.name}),"?"]}),o.jsx("p",{className:"guake-git-delete-path",children:Se.path}),o.jsxs("div",{className:"guake-git-delete-actions",children:[o.jsx("button",{className:"guake-git-delete-cancel",onClick:()=>Fe(null),children:"Cancel"}),o.jsx("button",{className:"guake-git-delete-btn",onClick:()=>ie(Se),children:"Discard"})]})]})}),C&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:Te,children:o.jsxs("div",{className:"guake-git-diff-modal",onClick:ue=>ue.stopPropagation(),children:[o.jsxs("div",{className:"guake-git-diff-modal-header",children:[E==="changes"&&o.jsxs("div",{className:"guake-git-diff-nav",children:[o.jsx("button",{className:"guake-git-diff-nav-btn",onClick:()=>J(-1),disabled:ne<=0,title:"Previous file",children:"‹"}),o.jsx("button",{className:"guake-git-diff-nav-btn",onClick:()=>J(1),disabled:ne<0||ne>=Ve.length-1,title:"Next file",children:"›"}),ne>=0&&o.jsxs("span",{className:"guake-git-diff-nav-counter",children:[ne+1," / ",Ve.length]})]}),o.jsxs("span",{className:"guake-git-diff-filename",title:C.data.filePath,children:[C.data.filePath,C.type==="content"&&C.isNewFile&&o.jsx("span",{className:"guake-git-content-badge",children:"new file"})]}),o.jsx("button",{className:"guake-git-close",onClick:Te,title:"Close (Esc)",children:"×"})]}),o.jsx("div",{className:"guake-git-diff-content",children:C.type==="diff"?o.jsx(Ib,{originalContent:C.data.originalContent,modifiedContent:C.data.modifiedContent,filename:C.data.fileName,language:C.data.language}):o.jsx(Ib,{originalContent:"",modifiedContent:C.data.content,filename:C.data.fileName,language:C.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 ${E==="changes"?"active":""}`,onClick:()=>R("changes"),children:["🌿 Changes",ut>0&&o.jsx("span",{className:"guake-git-badge",children:ut})]}),o.jsx("button",{className:`guake-git-tab ${E==="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:fe,title:"Git fetch",disabled:r.size>0,children:r.size>0?"⏳":"⇣"}),E==="changes"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`guake-git-view-toggle ${_==="flat"?"active":""}`,onClick:()=>M("flat"),title:"Flat view",children:"☰"}),o.jsx("button",{className:`guake-git-view-toggle ${_==="tree"?"active":""}`,onClick:()=>M("tree"),title:"Tree view",children:"🌲"}),o.jsx("button",{className:"guake-git-refresh",onClick:ee,title:"Refresh",disabled:h,children:h?"⏳":"↻"})]}),E==="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:[E==="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:ue,dirName:X,gitStatus:ae})=>{const we=s.get(ue);return o.jsxs("div",{className:"guake-git-repo",children:[o.jsxs("div",{className:`guake-git-repo-header ${x.has(ue)?"expanded":""}`,onClick:()=>je(ue),children:[o.jsx("span",{className:"guake-git-repo-arrow",children:x.has(ue)?"▼":"▶"}),o.jsx("span",{className:"guake-git-repo-name",children:X}),ae.branch&&o.jsxs("span",{className:"guake-git-repo-branch",children:["⎇ ",ae.branch]}),we&&we.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",children:["↑",we.ahead]}),we&&we.behind>0&&o.jsxs("span",{className:"guake-branch-behind",children:["↓",we.behind]}),o.jsx("span",{className:"guake-git-repo-count",children:ae.files.length})]}),x.has(ue)&&_==="flat"&&o.jsx("div",{className:"guake-git-file-list",children:ae.files.map(Z=>{const ve=a1[Z.status],He=Bp(Z.name);return o.jsxs("div",{className:"guake-git-file","data-status":Z.status,onClick:()=>Ee(Z,ue),onContextMenu:Pe=>We(Pe,Z,ue),title:Z.path,children:[He&&o.jsx("img",{src:He,alt:"",className:"guake-git-file-icon"}),o.jsx("span",{className:"guake-git-file-name",children:Z.name}),o.jsx("span",{className:"guake-git-file-dir",children:Z.path.includes("/")?Z.path.substring(0,Z.path.lastIndexOf("/")):""}),o.jsx("span",{className:"guake-git-file-status",style:{color:ve.color},title:ve.label,children:ve.icon}),o.jsx("button",{className:"guake-git-discard-btn",title:Z.status==="untracked"||Z.status==="added"?"Delete file":"Discard changes",onClick:Pe=>he(Pe,Z,ue),children:"↩"})]},Z.path)})}),x.has(ue)&&_==="tree"&&o.jsx("div",{className:"guake-git-file-list",children:Vg(ae.files).map(Z=>o.jsx(Z1,{node:Z,depth:0,expandedDirs:v,onToggleDir:ge,onFileClick:Ee,onContextMenu:We,onDiscard:he,repoDir:ue},Z.path))})]},ue)})]}),E==="explorer"&&o.jsxs(o.Fragment,{children:[Q.length>1&&o.jsx("div",{className:"guake-git-folder-selector",children:Q.map((ue,X)=>{const ae=ue.split("/").filter(Boolean).pop()||ue,we=s.get(ue);return o.jsxs("button",{className:`guake-git-folder-btn ${X===O?"active":""}`,onClick:()=>B(X),title:ue,children:["📂 ",ae,we&&o.jsxs("span",{className:"guake-git-folder-branch",children:[" ⎇ ",we.branch]}),we&&we.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",children:["↑",we.ahead]}),we&&we.behind>0&&o.jsxs("span",{className:"guake-branch-behind",children:["↓",we.behind]})]},ue)})}),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:xe.map(ue=>o.jsx(Kx,{node:ue,depth:0,selectedPath:$,expandedPaths:q.expandedPaths,onSelect:Be,onToggle:q.togglePath,onContextMenu:st,searchQuery:""},ue.path))})]})]})]}),L&&o.jsx(go,{isOpen:L.isOpen,position:L.position,worldPosition:{x:0,z:0},actions:L.actions,onClose:qe})]})}const os={Read:"📖",Write:"✏️",Edit:"📝",Bash:"💻",Glob:"🔍",Grep:"🔎",Task:"📋",Agent:"🤖",WebFetch:"🌐",WebSearch:"🌍",TodoWrite:"✅",NotebookEdit:"📓",AskFollowupQuestion:"❓",AskUserQuestion:"❓",AttemptCompletion:"✨",ListFiles:"📂",SearchFiles:"🔎",ExecuteCommand:"⚙️",spawn_agent:"🧬",send_input:"📨",wait:"⏳",default:"⚡"},P6={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 eT(t,e){const n=P6[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 tT(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 sT(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 nT(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 sT(t){return nT(t)||t}const pA=/(^|[\s("'`])((?:\.{1,2}\/|~\/|\/)?[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*\.[A-Za-z0-9._-]+(?::\d+(?::\d+)?)?)/g;function I6(t){return!t||t.startsWith("-")||t.includes("://")||t.includes("*")?!1:t.includes(".")&&!t.endsWith(".")}function aT(t){if(!t)return[{text:""}];const e=[];let n=0;pA.lastIndex=0;let s;for(;(s=pA.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}),I6(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://",B6=/(^|[\s(>])((?:\.\.?\/|\/)?(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+(?:\.[A-Za-z0-9._-]+)+(?:#L\d+(?:C\d+)?)?(?::\d+(?::\d+)?)?)(?=$|[\s),.;])/g,F6=/`((?:\.\.?\/|\/)?(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+(?:\.[A-Za-z0-9._-]+)+(?:#L\d+(?:C\d+)?)?(?::\d+(?::\d+)?)?)`/g,z6=/\.(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 hA(t){if(!t||t.includes("://")||t.startsWith("www.")||t.includes("@"))return!1;const e=t.split("/")[0];return z6.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(F6,(c,d)=>{if(!hA(d))return c;const f=encodeURIComponent(d);return`[\`${d}\`](${up}${f})`});return i.replace(B6,(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==="]"||!hA(f))return c;const v=encodeURIComponent(f);return`${d}[${f}](${up}${v})`})}).join(`
124
+ `)}function $6(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 ji(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}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]+)$/);if(a&&(n=`${a[1]} -lc`,s=ji(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=ji(c||i);return d?{shellPrefix:n,commandBody:s,searchTerm:d}:null}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]+)$/);a&&(n=`${a[1]} -lc`,s=ji(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=ji(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 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=ji(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=ji(r[1]).replace(/\\"/g,'"').match(/"taskLabel"\s*:\s*"([^"]*)"/);return c!=null&&c[1]?{shellPrefix:n,commandBody:s,taskLabel:c[1]}:null}function lT(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=ji(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=ji(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 Fp(t,e){const n=Ni(),s=await fetch(`${Sa()}${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 H6(t){return Fp("/api/agents/bulk/delete",{agentIds:t})}async function U6(t){return Fp("/api/agents/bulk/stop",{agentIds:t})}async function W6(t){return Fp("/api/agents/bulk/clear-context",{agentIds:t})}async function q6(t,e){return Fp("/api/agents/bulk/move-area",{agentIds:t,areaId:e})}function V6(t){return Array.from(t.values())}const G6={">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 Y6(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 mA(t,e){for(const n of e)if(n.assignedAgentIds.includes(t.id))return n;return null}function K6({isOpen:t,onClose:e}){const n=vp(),s=rr(),a=V6(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,C]=b.useState(""),[k,N]=b.useState(new Set),[j,_]=b.useState(null),[D,E]=b.useState(""),[I,O]=b.useState(null),[T,M]=b.useState(null),[R,B]=b.useState(!1);b.useEffect(()=>{t&&(N(new Set),O(null),M(null),_(null))},[t]);const $=b.useMemo(()=>{const Y=Date.now(),z=S.toLowerCase().trim();return n.filter(Q=>{if(r!=="all"&&Q.status!==r||c!=="any"&&Y-Q.lastActivity<G6[c])return!1;if(f!=="all"){const K=mA(Q,a);if(f==="unassigned"){if(K!==null)return!1}else if(!K||K.id!==f)return!1}if(m!=="all"&&Q.provider!==m||y!=="all"&&(Q.model||"sonnet")!==y)return!1;if(z){const K=Q.name.toLowerCase().includes(z),q=Q.class.toLowerCase().includes(z);if(!K&&!q)return!1}return!0})},[n,a,r,c,f,m,y,S]);b.useEffect(()=>{const Y=new Set($.map(z=>z.id));N(z=>{const Q=new Set;for(const K of z)Y.has(K)&&Q.add(K);return Q.size!==z.size?Q:z})},[$]);const U=b.useCallback(Y=>{N(z=>{const Q=new Set(z);return Q.has(Y)?Q.delete(Y):Q.add(Y),Q})},[]),L=b.useCallback(()=>{N(new Set($.map(Y=>Y.id)))},[$]),F=b.useCallback(()=>{N(new Set)},[]),W=b.useCallback(async Y=>{const z=Array.from(k);if(z.length!==0){B(!0),O(null),M(null);try{let Q,K="";switch(Y){case"delete":Q=await H6(z),K="Deleted",Q.failed.length===0&&N(new Set);break;case"stop":Q=await U6(z),K="Stopped";break;case"clear-context":Q=await W6(z),K="Cleared context for";break;case"move-area":Q=await q6(z,D||null),K="Moved";break}Q&&(Q.failed.length>0?M(`${K} ${Q.succeeded.length} agent(s). Failed: ${Q.failed.length}`):M(`${K} ${Q.succeeded.length} agent(s)`))}catch(Q){O(Q instanceof Error?Q.message:"Action failed")}finally{B(!1),_(null)}}},[k,D]),V=b.useCallback(Y=>{Y.key==="Escape"&&(j?_(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=>C(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:F,children:"Select none"})]})]}),I&&o.jsxs("div",{className:"bulk-alert bulk-alert-error",children:[o.jsx("span",{className:"alert-icon",children:"!"}),I]}),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?F():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 z=mA(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:Q=>Q.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:Y6(Y.lastActivity)}),o.jsx("td",{className:"col-area",children:z?o.jsx("span",{className:"bulk-area-badge",style:{borderColor:z.color},children:z.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:()=>_(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:()=>_("delete"),children:"Delete Selected"}),o.jsx("button",{className:"btn btn-secondary",disabled:k.size===0||R,onClick:()=>_("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=>E(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 Q6={working:"🟢",idle:"💤",waiting_input:"🟡",waiting_permission:"🟠",error:"🔴",stopped:"⚫"},gA={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 X6(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 J6(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 Z6({activeAgentId:t,onClose:e,onSelectAgent:n,agentListRef:s,twoFingerState:a}){const{t:r}=pt(["terminal","common"]),i=vp(),[c]=ix(),d=b.useMemo(()=>c?i.filter(be=>{const _e=H.getAreaForAgent(be.id);return xp((_e==null?void 0:_e.id)??null)}):i,[i,c]),f=$j(),h=hx(),m=bL(),x=rr(),y=Lj();b.useEffect(()=>{for(const be of d)!H.hasHistoryBeenFetched(be.id)&&!H.isLoadingHistoryForAgent(be.id)&&H.requestAgentSupervisorHistory(be.id)},[d]);const v=b.useMemo(()=>ta(ft.AOP_CONFIG,{groupByArea:!0,sortMode:"recent",filterMode:"all",allExpanded:!1,sameAreaOnly:!1,showSubagents:!0,showRecentActivity:!0,visibleAreaIds:null}),[]),[S,C]=b.useState(()=>v.allExpanded?new Set(d.map(be=>be.id)):new Set),[k,N]=b.useState(new Set),[j,_]=b.useState(null),[D,E]=b.useState(""),[I,O]=b.useState(v.sortMode),[T,M]=b.useState(v.filterMode),[R,B]=b.useState(""),[$,U]=b.useState(v.groupByArea),[L,F]=b.useState(v.allExpanded),[W,V]=b.useState(v.sameAreaOnly),[Y,z]=b.useState(v.showSubagents),[Q,K]=b.useState(v.showRecentActivity),[q,xe]=b.useState(v.visibleAreaIds?new Set(v.visibleAreaIds):null),[de,ee]=b.useState(!1),[fe,je]=b.useState(""),[ge,Ee]=b.useState(!1),Be=b.useRef(null),[Ve,J]=b.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 768px)").matches:!1),[ne,Te]=b.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 768px)").matches:!1),[qe,at]=b.useState(null),[Se,Fe]=b.useState(null),ie=b.useRef(null),he=b.useRef(null),We=s||he,st=b.useRef(!1),ut=b.useRef(new Map),ue=a||{hoveredAgentId:null};b.useEffect(()=>{if(typeof window>"u")return;const be=window.matchMedia("(max-width: 768px)"),_e=et=>{J(et),Te(et)};_e(be.matches);const Ge=et=>_e(et.matches);return be.addEventListener("change",Ge),()=>be.removeEventListener("change",Ge)},[]),b.useEffect(()=>{if(!de){je("");return}const be=_e=>{Be.current&&!Be.current.contains(_e.target)&&(ee(!1),je(""))};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[de]),b.useEffect(()=>{const be=_e=>{var et,Nt;_e.altKey&&_e.shiftKey&&!_e.ctrlKey&&!_e.metaKey&&_e.code==="KeyF"&&(_e.preventDefault(),(et=ie.current)==null||et.focus(),(Nt=ie.current)==null||Nt.select())};return document.addEventListener("keydown",be,!0),()=>document.removeEventListener("keydown",be,!0)},[]),b.useEffect(()=>{ya(ft.AOP_CONFIG,{groupByArea:$,sortMode:I,filterMode:T,allExpanded:L,sameAreaOnly:W,showSubagents:Y,showRecentActivity:Q,visibleAreaIds:q?Array.from(q):null})},[$,I,T,L,W,Y,Q,q]);const X=b.useMemo(()=>{const be=[];for(const[,_e]of x)_e.archived||be.push({id:_e.id,name:_e.name,color:_e.color});return be.sort((_e,Ge)=>_e.name.localeCompare(Ge.name,void 0,{sensitivity:"base"})),be},[x]),ae=q===null,we=b.useCallback(be=>{xe(_e=>{if(_e===null){const et=new Set(X.map(Nt=>Nt.id));return et.add("__unassigned__"),et.delete(be),et}const Ge=new Set(_e);return Ge.has(be)?Ge.delete(be):Ge.add(be),Ge.size>=X.length+1?null:Ge})},[X]),Z=b.useCallback(()=>xe(null),[]),ve=b.useMemo(()=>{const be=new Map;for(const _e of d){const Ge=H.getAreaForAgent(_e.id);!Ge||Ge.archived||be.set(_e.id,{color:Ge.color,name:Ge.name})}return be},[d,x]),He=b.useMemo(()=>{const be=new Map;for(const _e of h){const Ge=be.get(_e.agentId)||[];Ge.push(_e),be.set(_e.agentId,Ge)}return be},[h]),Pe=b.useMemo(()=>{const be=new Map;for(const[,_e]of m){const Ge=be.get(_e.parentAgentId)||[];Ge.push(_e),be.set(_e.parentAgentId,Ge)}return be},[m]),oe=b.useMemo(()=>{const be=new Map;for(const _e of d){const Ge=H.getAreaForAgent(_e.id);!Ge||Ge.archived||be.set(_e.id,Ge.id)}return be},[d,x]),[Le,le]=b.useMemo(()=>{const be=oe.get(t)??null,_e=new Map;return[d.filter(et=>{if(T==="working"&&et.status!=="working"||T==="idle"&&et.status!=="idle"||T==="error"&&et.status!=="error"||W&&(oe.get(et.id)??null)!==be)return!1;if(R){const Nt=R.toLowerCase();if(et.name.toLowerCase().includes(Nt)||et.id.includes(Nt)||(et.class||"").toLowerCase().includes(Nt)||(et.taskLabel||"").toLowerCase().includes(Nt))return!0;const zt=et.lastAssignedTask||"";if(zt.toLowerCase().includes(Nt))return _e.set(et.id,{type:"task",text:zt}),!0;const Lt=H.getAgentSupervisorHistory(et.id);for(const Pt of Lt){const Vt=Pt.analysis.recentWorkSummary,mt=Pt.analysis.statusDescription;if(Vt.toLowerCase().includes(Nt))return _e.set(et.id,{type:"history",text:Vt}),!0;if(mt.toLowerCase().includes(Nt))return _e.set(et.id,{type:"history",text:mt}),!0}for(const Pt of y)if(Pt.agentId===et.id&&Pt.filePath.toLowerCase().includes(Nt))return _e.set(et.id,{type:"file",text:Pt.filePath}),!0;return!1}return!0}),_e]},[d,T,R,W,oe,t,y]),me=b.useCallback((be,_e="__default__")=>{const Ge=new Set(be.map(ct=>ct.id)),et=ut.current.get(_e),Nt=!et||et.length!==be.length||et.some(ct=>!Ge.has(ct)),zt=ct=>{const xt=!!(ct.isBoss||ct.class==="boss");if(I==="name")return`${xt?"0":"1"}`;if(I==="status"){const kn=["working","waiting_input","waiting_permission","error","idle","stopped"].indexOf(ct.status),cn=f.has(ct.id)?"0":"1";return`${xt?"0":"1"}-${kn}-${cn}`}return`${xt?"0":"1"}`};let Lt=!1;if(et&&!Nt){const ct=ut.current.get(_e+"__buckets");if(ct)for(const xt of be){const Mt=et.indexOf(xt.id);if(Mt>=0&&ct[Mt]!==zt(xt)){Lt=!0;break}}else Lt=!0}let Pt;if(Nt||Lt||I==="recent")Pt=[...be].sort((ct,xt)=>{var Ba,Ts;const Mt=!!(ct.isBoss||ct.class==="boss"),kn=!!(xt.isBoss||xt.class==="boss");if(Mt!==kn)return Mt?-1:1;if(I==="name")return ct.name.localeCompare(xt.name);if(I==="status"){const Hs=["working","waiting_input","waiting_permission","error","idle","stopped"],Fa=Hs.indexOf(ct.status)-Hs.indexOf(xt.status);if(Fa!==0)return Fa;const ws=f.has(ct.id),Zn=f.has(xt.id);if(ws!==Zn)return ws?-1:1;if(ct.status==="working"&&xt.status==="working")return ct.name.localeCompare(xt.name);if(ct.status==="idle"&&xt.status==="idle"){const Et=!!ct.taskLabel,rs=!!xt.taskLabel;return Et!==rs?Et?-1:1:(xt.lastActivity||0)-(ct.lastActivity||0)}return(xt.lastActivity||0)-(ct.lastActivity||0)}const cn=((Ba=(He.get(ct.id)||[])[0])==null?void 0:Ba.timestamp)||ct.lastActivity||0;return(((Ts=(He.get(xt.id)||[])[0])==null?void 0:Ts.timestamp)||xt.lastActivity||0)-cn});else{const ct=new Map(be.map(xt=>[xt.id,xt]));Pt=et.map(xt=>ct.get(xt)).filter(Boolean)}const Vt=Pt.map(ct=>ct.id),mt=Pt.map(ct=>zt(ct));return ut.current.set(_e,Vt),ut.current.set(_e+"__buckets",mt),Pt},[I,He,f]),se=b.useMemo(()=>{if(!$)return[{area:null,agents:me(Le,"__flat__")}];const be=new Map,_e=[];for(const et of Le){const Nt=H.getAreaForAgent(et.id);if(!Nt||Nt.archived){_e.push(et);continue}const zt=be.get(Nt.id);zt?zt.push(et):be.set(Nt.id,[et])}const Ge=[];for(const[et,Nt]of x){if(Nt.archived||q&&!q.has(et))continue;const zt=be.get(et)||[];zt.length>0&&Ge.push({area:Nt,agents:me(zt,`area_${et}`)})}return _e.length>0&&(!q||q.has("__unassigned__"))&&Ge.push({area:null,agents:me(_e,"__unassigned__")}),Ge},[x,Le,me,$,q]),Re=b.useCallback(be=>{const _e=Lt=>f.has(Lt.id),Ge=be.findIndex(Lt=>_e(Lt)&&Lt.status!=="working"),et=Ge>=0,Nt=be.findIndex(Lt=>Lt.status==="idle"&&!_e(Lt)),zt=Nt>=0&&be.slice(0,Nt).some(Lt=>Lt.status==="working"||_e(Lt));return be.map((Lt,Pt)=>o.jsxs(Ce.Fragment,{children:[et&&Pt===Ge&&o.jsx("div",{className:"aop-status-separator aop-status-separator--unread",role:"separator","aria-label":"unread notifications",children:o.jsx("span",{children:"Unread notifications"})}),zt&&Pt===Nt&&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(e5,{agent:Lt,isActive:Lt.id===t,isExpanded:S.has(Lt.id),isMobile:Ve,hasPendingRead:f.has(Lt.id),isTwoFingerHovered:ue.hoveredAgentId===Lt.id,showSubagents:Y,showRecentActivity:Q,showAreaChip:!$,toolExecs:He.get(Lt.id)||[],subagents:Pe.get(Lt.id)||[],areaInfo:ve.get(Lt.id),matchContext:le.get(Lt.id),onToggle:()=>ze(Lt.id),onSelect:()=>n(Lt.id),onClearContext:()=>H.clearContext(Lt.id),onContextMenu:Vt=>Fe({agentId:Lt.id,position:Vt})})]},Lt.id))},[r,t,S,f,ue.hoveredAgentId,Y,Q,$,He,Pe,ve,le,n]),Ke=b.useMemo(()=>{const be={total:d.length,working:0,idle:0,error:0};for(const _e of d)_e.status==="working"?be.working++:_e.status==="error"?be.error++:_e.status==="idle"&&be.idle++;return be},[d]),ze=be=>{C(_e=>{const Ge=new Set(_e);return Ge.has(be)?Ge.delete(be):Ge.add(be),Ge})},tt=be=>{N(_e=>{const Ge=new Set(_e);return Ge.has(be)?Ge.delete(be):Ge.add(be),Ge})},ot=()=>{C(new Set(d.map(be=>be.id))),F(!0)},nt=()=>{C(new Set),F(!1)},lt=b.useCallback(be=>{window.dispatchEvent(new CustomEvent("tide:open-spawn-modal",{detail:{areaId:be.id,position:{x:be.center.x,z:be.center.z}}}))},[]),it=b.useCallback((be,_e)=>{at({areaId:be.id,position:_e})},[]),ht=b.useMemo(()=>{if(!qe)return[];const be=x.get(qe.areaId);return be?[{id:"spawn-agent",label:r("common:agentBar.newAgent"),icon:"+",onClick:()=>lt(be)}]:[]},[qe,x,lt,r]),jt=b.useMemo(()=>{if(!Se)return[];const be=d.find(Ge=>Ge.id===Se.agentId);if(!be)return[];const _e=S.has(be.id);return[{id:"toggle-expand",label:_e?r("terminal:overview.collapse",{defaultValue:"Collapse"}):r("terminal:overview.expand",{defaultValue:"Expand"}),icon:_e?"▾":"▸",onClick:()=>ze(be.id)},{id:"clear-context",label:r("terminal:overview.clearContext",{defaultValue:"Clear context"}),icon:"🧹",onClick:()=>H.clearContext(be.id)},{id:"remove-agent",label:r("terminal:overview.removeAgent",{defaultValue:"Remove agent"}),icon:"🗑",danger:!0,onClick:()=>H.removeAgent(be.id)}]},[Se,d,S,r]);return b.useEffect(()=>{const be=We.current;if(!be)return;const _e=requestAnimationFrame(()=>{const Ge=be.querySelector(".aop-agent-card.active");if(!Ge)return;const et=be.getBoundingClientRect(),Nt=Ge.getBoundingClientRect(),zt=Nt.top-et.top,Lt=be.scrollTop+zt-(et.height-Nt.height)/2,Pt=Math.max(0,Lt);Math.abs(be.scrollTop-Pt)<2||(be.scrollTo({top:Pt,behavior:st.current?"smooth":"auto"}),st.current=!0)});return()=>cancelAnimationFrame(_e)},[t]),o.jsxs("div",{className:`agent-overview-panel${Ve&&ne?" 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:()=>{Te(!1),requestAnimationFrame(()=>{var be;return(be=ie.current)==null?void 0:be.focus()})},title:"Search agents",children:"🔍"}),o.jsx("button",{type:"button",className:`aop-filters-toggle${ne?" collapsed":""}`,onClick:()=>Te(be=>!be),title:ne?"Show filters":"Hide filters",children:ne?"Filters":"Hide filters"}),o.jsxs("select",{value:T,onChange:be=>M(be.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:I,onChange:be=>O(be.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:be=>B(be.target.value),onKeyDown:be=>{be.key==="Enter"&&(be.nativeEvent.isComposing||R.trim().length!==0&&Le.length!==0&&(be.preventDefault(),n(Le[0].id),B("")))},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(yj,{}),o.jsx("button",{onClick:ot,className:"action-btn",title:r("common:buttons.expand"),children:r("common:buttons.expand")}),o.jsx("button",{onClick:nt,className:"action-btn",title:r("common:buttons.collapse"),children:r("common:buttons.collapse")}),o.jsx("button",{onClick:()=>U(be=>!be),className:`action-btn action-btn--toggle${$?" active":""}`,title:r("terminal:overview.areas"),children:r("terminal:overview.areas")}),$&&X.length>0&&o.jsxs("div",{className:"aop-area-filter",ref:Be,children:[o.jsxs("button",{className:`action-btn action-btn--toggle${ae?"":" active"}`,onClick:()=>ee(be=>!be),title:"Filter areas",children:[ae?"All areas":`${q.size} areas`,o.jsx("span",{className:"aop-area-filter-caret",children:de?"▴":"▾"})]}),de&&o.jsxs("div",{className:"aop-area-filter-dropdown",children:[X.length>=5&&o.jsx("div",{className:"aop-area-filter-search",children:o.jsx("input",{type:"text",placeholder:"Filter areas...",value:fe,onChange:be=>je(be.target.value),onClick:be=>be.stopPropagation(),autoFocus:!0})}),(()=>{const be=fe.toLowerCase().trim(),_e=be?X.filter(et=>et.name.toLowerCase().includes(be)):X,Ge=!be||"unassigned".includes(be);return o.jsxs(o.Fragment,{children:[!be&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"aop-area-filter-option",onClick:Z,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(et=>{const Nt=ae||((q==null?void 0:q.has(et.id))??!1);return o.jsxs("label",{className:"aop-area-filter-option",onClick:zt=>{zt.preventDefault(),we(et.id)},children:[o.jsx("input",{type:"checkbox",checked:Nt,readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:et.color}}),o.jsx("span",{className:"aop-area-filter-name",children:et.name})]},et.id)}),Ge&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"aop-area-filter-divider"}),o.jsxs("label",{className:"aop-area-filter-option",onClick:et=>{et.preventDefault(),we("__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"})]})]}),be&&_e.length===0&&!Ge&&o.jsx("div",{className:"aop-area-filter-empty",children:"No matching areas"})]})})()]})]}),o.jsx("button",{onClick:()=>V(be=>!be),className:`action-btn action-btn--toggle${W?" active":""}`,title:r("terminal:overview.sameAreaOnly"),children:r("terminal:overview.sameAreaOnly")}),o.jsx("button",{onClick:()=>z(be=>!be),className:`action-btn action-btn--toggle${Y?" active":""}`,title:"Subagents",children:"Subagents"}),o.jsx("button",{onClick:()=>K(be=>!be),className:`action-btn action-btn--toggle${Q?" active":""}`,title:r("terminal:overview.recentActivity"),children:"Activity"}),o.jsx("button",{onClick:()=>Ee(!0),className:"action-btn",title:"Bulk manage agents",children:"Bulk Manage"})]}),o.jsx("div",{className:"aop-agent-list",ref:We,children:se.length===0?o.jsx("div",{className:"aop-empty",children:d.length===0?r("terminal:overview.noAgentsDeployed"):r("terminal:overview.noAgentsMatch")}):se.map(be=>{var zt,Lt,Pt;const _e=((zt=be.area)==null?void 0:zt.id)||"__unassigned__",Ge=((Lt=be.area)==null?void 0:Lt.name)||($?r("terminal:overview.unassigned"):""),et=((Pt=be.area)==null?void 0:Pt.color)||"#6272a4",Nt=k.has(_e);return o.jsxs("div",{className:"aop-area-group",children:[$&&o.jsxs("div",{className:"aop-area-header",onClick:()=>tt(_e),style:{borderLeftColor:et},children:[o.jsx("span",{className:"aop-area-expand",children:Nt?"▸":"▾"}),o.jsx("span",{className:"aop-area-color",style:{background:et}}),o.jsx("span",{className:"aop-area-name",onContextMenu:Vt=>{be.area&&(Vt.preventDefault(),Vt.stopPropagation(),it(be.area,{x:Vt.clientX,y:Vt.clientY}))},children:Ge}),o.jsx("button",{type:"button",className:"aop-area-eye-btn",title:"Hide area",onClick:Vt=>{Vt.preventDefault(),Vt.stopPropagation(),we(_e)},children:"◉"}),be.area&&o.jsx("button",{type:"button",className:"aop-area-eye-btn",title:"Edit area prompt",onClick:Vt=>{Vt.preventDefault(),Vt.stopPropagation();const mt=be.area;j===mt.id?_(null):(E(mt.prompt||""),_(mt.id))},children:"✎"}),be.area&&(()=>{const Vt=be.area;return o.jsx("button",{type:"button",className:"aop-area-add-btn",title:r("common:agentBar.newAgent"),onClick:mt=>{mt.preventDefault(),mt.stopPropagation();const ct=mt.currentTarget.getBoundingClientRect();it(Vt,{x:ct.left,y:ct.bottom+6})},children:"+"})})(),o.jsx("span",{className:"aop-area-count",children:be.agents.length})]}),j===_e&&be.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=>E(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(be.area.id,{prompt:D}),_(null)},children:"Save"}),o.jsx("button",{className:"aop-area-prompt-cancel",onClick:()=>_(null),children:"Cancel"})]})]}),(!$||!Nt)&&o.jsx("div",{className:$?"aop-area-content":void 0,children:Re(be.agents)})]},_e)})}),o.jsx(go,{isOpen:qe!==null,position:(qe==null?void 0:qe.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:ht,onClose:()=>at(null)}),o.jsx(go,{isOpen:Se!==null,position:(Se==null?void 0:Se.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:jt,onClose:()=>Fe(null)}),o.jsx(K6,{isOpen:ge,onClose:()=>Ee(!1)})]})}function e5({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:C}){const{t:k}=pt(["terminal","common"]),N=Pa(),j=Ia(t.class,N),_=t.isBoss||t.class==="boss",D=Q6[t.status]||"❓",E=gA[t.status]?k(`terminal:${gA[t.status]}`):t.status,I=f.slice(0,s?4:8),O=X6(t.id),T=J6(t.id),M=s?40:80,R=b.useMemo(()=>{var We,st,ut,ue,X,ae,we;const ie=[],he=new Set;for(const Z of h)ie.push({id:Z.id,name:Z.name,type:Z.subagentType,description:Z.description,status:Z.status,timestamp:Z.startedAt}),he.add(Z.name);for(const Z of f){if(Z.toolName!=="Task"&&Z.toolName!=="Agent")continue;const He=((We=Z.toolInput)==null?void 0:We.description)||((st=Z.toolInput)==null?void 0:st.name)||""||((ue=(ut=Z.toolInput)==null?void 0:ut.prompt)==null?void 0:ue.slice(0,40))||"Task";he.has(He)||(he.add(He),ie.push({id:`task-${Z.timestamp}`,name:He,type:((X=Z.toolInput)==null?void 0:X.subagent_type)||"unknown",description:(we=(ae=Z.toolInput)==null?void 0:ae.prompt)==null?void 0:we.slice(0,100),status:"completed",timestamp:Z.timestamp}))}return ie.sort((Z,ve)=>ve.timestamp-Z.timestamp),ie},[h,f]),B=R.filter(ie=>ie.status==="working"||ie.status==="spawning"),$=i&&R.length>0,U=c&&I.length>0,L=$||U,F=t.contextLimit>0?t.contextUsed/t.contextLimit:0,W=Math.min(100,F*100),V=Math.min(1,Math.max(0,F)),z=`hsl(${Math.round((1-V)*120)} 80% 45% / 0.55)`,Q=112,K=56,[q,xe]=b.useState(0),[de,ee]=b.useState(!1),[fe,je]=b.useState(!1),ge=b.useRef(0),Ee=b.useRef(0),Be=b.useRef(0),Ve=b.useRef(!1),J=b.useRef(!1),ne=b.useRef(!1);b.useEffect(()=>{s||(xe(0),ee(!1),je(!1))},[s]);const Te=b.useCallback(()=>{if(ne.current){ne.current=!1;return}if(de){xe(0),ee(!1),ne.current=!0;return}v()},[v,de]),qe=b.useCallback(ie=>{if(!s||ie.touches.length!==1)return;const he=ie.touches[0];ge.current=he.clientX,Ee.current=he.clientY,Be.current=de?Q:0,Ve.current=!1,J.current=!1,je(!0)},[s,de]),at=b.useCallback(ie=>{if(!s||!fe||ie.touches.length!==1)return;const he=ie.touches[0],We=he.clientX-ge.current,st=he.clientY-Ee.current;if(!Ve.current){if(Math.abs(We)<8&&Math.abs(st)<8)return;Ve.current=!0,J.current=Math.abs(We)>Math.abs(st)}if(!J.current)return;ie.preventDefault();const ut=Math.max(0,Math.min(Q,Be.current-We));xe(ut)},[s,fe]),Se=b.useCallback(()=>{if(!s||!fe)return;if(je(!1),!J.current){de||xe(0);return}const ie=q>=K,he=ie!==de||q!==(ie?Q:0);ee(ie),xe(ie?Q:0),he&&(ne.current=!0)},[s,fe,q,de]),Fe=b.useCallback(ie=>{ie.stopPropagation(),S(),ee(!1),xe(0),ne.current=!0},[S]);return o.jsxs("div",{className:`aop-agent-swipe${s?" swipe-enabled":""}${de?" revealed":""}`,children:[s&&o.jsxs("button",{type:"button",className:"aop-swipe-clear-action",onClick:Fe,title:k("terminal:overview.clearContext",{defaultValue:"Clear context"}),children:["🧹 ",k("terminal:overview.clearContext",{defaultValue:"Clear"})]}),o.jsxs("div",{className:`aop-agent-card ${_?"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:Te,onTouchStart:qe,onTouchMove:at,onTouchEnd:Se,onTouchCancel:Se,style:s?{transform:`translateX(-${q}px)`,transition:fe?"none":"transform 0.18s ease"}:void 0,children:[o.jsxs("div",{className:"aop-agent-header",onContextMenu:ie=>{ie.preventDefault(),ie.stopPropagation(),C({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:E,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:[_&&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}),B.length>0&&o.jsxs("span",{className:"aop-subagent-count",title:B.map(ie=>`${ie.name}: ${ie.description||ie.type}`).join(`
126
+ `),children:["⑂",B.length]}),R.length>0&&B.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")}),I.map((ie,he)=>{var st,ut;const We=ie.toolInput&&(ie.toolInput.file_path||((st=ie.toolInput.command)==null?void 0:st.slice(0,40))||ie.toolInput.pattern||ie.toolInput.description||((ut=ie.toolInput.prompt)==null?void 0:ut.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:os[ie.toolName]||os.default}),o.jsx("span",{className:"tl-tool",children:ie.toolName}),We&&o.jsx("span",{className:"tl-param",children:We})]},`${ie.timestamp}-${he}`)})]}),!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(F*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:z}})})]})]})}function t5(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 n5(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 s5({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,C]=b.useState(!1),k=b.useRef(null),N=b.useRef(!1);b.useEffect(()=>{if(!c){N.current=!1;return}if(!a){C(!1);return}i||N.current||(N.current=!0,C(!0),r().finally(()=>{C(!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++)t5(n[R]).toLowerCase().includes(T)&&n5(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 _=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]),E=b.useCallback(()=>{d(T=>(T&&(h(""),x(0),v(null),C(!1)),!T))},[]),I=b.useCallback(()=>{d(!1),h(""),x(0),v(null),C(!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:E,closeSearch:I,highlightQuery:O,matchIndices:j,currentMatch:m,navigateNext:_,navigatePrev:D,scrollToIndex:y,loadingFullHistory:S}}const a5=new Map,r5=[];function i5({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 B=va(`${ft.INPUT_TEXT_PREFIX}${t}`);B&&n(U=>new Map(U).set(t,B));const $=va(`${ft.PASTED_TEXTS_PREFIX}${t}`);if($)try{const U=JSON.parse($),L=new Map(U);i(W=>new Map(W).set(t,L));const F=Math.max(0,...U.map(([W])=>W));f.current.set(t,F)}catch{}},[t,e]);const m=t&&e.get(t)||"",x=t&&s.get(t)||!1,y=(t?r.get(t):void 0)||a5,v=(t?c.get(t):void 0)||r5,S=m.includes(`
128
+ `),k=typeof window<"u"&&window.innerWidth<=768||x||S||m.length>50,N=b.useCallback(B=>{t&&(n($=>new Map($).set(t,B)),B?er(`${ft.INPUT_TEXT_PREFIX}${t}`,B):gk(`${ft.INPUT_TEXT_PREFIX}${t}`))},[t]),j=b.useCallback(B=>{t&&a($=>new Map($).set(t,B))},[t]),_=b.useCallback(B=>{t&&i($=>{const U=new Map($),L=$.get(t)||new Map,F=typeof B=="function"?B(L):B;if(U.set(t,F),F.size>0){const W=JSON.stringify(Array.from(F.entries()));er(`${ft.PASTED_TEXTS_PREFIX}${t}`,W)}else gk(`${ft.PASTED_TEXTS_PREFIX}${t}`);return U})},[t]),D=b.useCallback(B=>{t&&d($=>{const U=new Map($),L=$.get(t)||[],F=typeof B=="function"?B(L):B;return U.set(t,F),U})},[t]),E=b.useCallback(()=>{if(!t)return 0;const $=(f.current.get(t)||0)+1;return f.current.set(t,$),$},[t]),I=b.useCallback(()=>{t&&f.current.set(t,0)},[t]),O=b.useCallback(B=>{D($=>$.filter(U=>U.id!==B))},[D]),T=b.useCallback(async(B,$)=>{try{const U=$||(B instanceof File?B.name:""),L=encodeURIComponent(U),F=await Bt(Dt("/api/files/upload"),{method:"POST",headers:{"Content-Type":B.type||"application/octet-stream","X-Filename":L},body:B});if(!F.ok)return console.error("Upload failed:",await F.text()),null;const W=await F.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(B=>{let $=B;for(const[U,L]of y){const F=new RegExp(`\\[Pasted text #${U} \\+\\d+ lines\\]`,"g");$=$.replace(F,L)}return $},[y]),R=b.useCallback(()=>{const B=(m.match(/\n/g)||[]).length+1,$=Math.ceil(m.length/60),U=Math.max(B,$,2);return Math.min(U,10)},[m]);return b.useMemo(()=>({command:m,setCommand:N,forceTextarea:x,setForceTextarea:j,useTextarea:k,pastedTexts:y,setPastedTexts:_,incrementPastedCount:E,resetPastedCount:I,attachedFiles:v,setAttachedFiles:D,removeAttachedFile:O,uploadFile:T,expandPastedTexts:M,getTextareaRows:R}),[m,N,x,j,k,y,_,E,I,v,D,O,T,M,R])}const Yg=10;function o5({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,E,I=200)=>{x.current&&cancelAnimationFrame(x.current);const O=D.scrollTop,T=E-O,M=performance.now(),R=B=>{const $=B-M,U=Math.min($/I,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 E=s.current,I=E.querySelector(`[data-message-index="${D}"]`);if(I){const O=E.getBoundingClientRect(),T=I.getBoundingClientRect(),M=20;if(T.top<O.top+M){const R=E.scrollTop+(T.top-O.top)-M;v(E,R,180)}else if(T.bottom>O.bottom-M){const R=E.scrollTop+(T.bottom-O.bottom)+M;v(E,R,180)}}},[s,v]);b.useEffect(()=>()=>{x.current&&cancelAnimationFrame(x.current)},[]);const C=b.useCallback(()=>{t!==0&&f(D=>{let E;return D===-1?E=t-1:D>0?E=D-1:E=0,requestAnimationFrame(()=>S(E)),E})},[t,S]),k=b.useCallback(()=>{t!==0&&f(D=>{let E;if(D===-1)E=t-1;else if(D<t-1)E=D+1;else return-1;return requestAnimationFrame(()=>S(E)),E})},[t,S]),N=b.useCallback(()=>{t!==0&&f(D=>{let E;return D===-1?E=t-1:E=Math.max(0,D-Yg),requestAnimationFrame(()=>S(E)),E})},[t,S]),j=b.useCallback(()=>{t!==0&&f(D=>{let E;if(D===-1)E=t-1;else{if(D+Yg>=t)return-1;E=D+Yg}return requestAnimationFrame(()=>S(E)),E})},[t,S]),_=b.useCallback(D=>d===D,[d]);return b.useEffect(()=>{const D=E=>{if(!e||n)return;const I=H.getShortcuts(),O=I.find(L=>L.id==="prev-message"),T=I.find(L=>L.id==="next-message"),M=I.find(L=>L.id==="page-up-messages"),R=I.find(L=>L.id==="page-down-messages"),B=I.find(L=>L.id==="activate-message");if(An(E,O)){E.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),C();return}if(An(E,T)){E.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),k();return}if(An(E,M)){E.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),N();return}if(An(E,R)){E.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),j();return}if(E.key==="Escape"&&d!==-1){E.preventDefault(),m();return}const $=E.target,U=$.tagName==="INPUT"||$.tagName==="TEXTAREA"||$.isContentEditable;if(An(E,B)&&d!==-1&&!U){E.preventDefault();const L=s.current;if(!L)return;const F=L.querySelector(`[data-message-index="${d}"]`);if(!F)return;const W=[".clickable-path",".output-tool-use.bash-clickable",".clickable-bash",".history-view-md-btn"];for(const Y of W){const z=F.querySelector(Y);if(z){z.click();return}}const V=F.querySelector(".output-tool-use");V!=null&&V.classList.contains("bash-clickable")&&V.click();return}if(d!==-1&&!U){const L=An(E,O)||An(E,T)||An(E,M)||An(E,R),F=["Escape","Tab","Shift","Control","Alt","Meta","CapsLock"].includes(E.key),W=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(E.key),V=E.key.startsWith("F")&&E.key.length<=3;if(!L&&!F&&!W&&!V&&!E.ctrlKey&&!E.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,C,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:C,navigateNext:k,navigatePageUp:N,navigatePageDown:j,isSelected:_}}const bA=300;function l5(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 c5(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 cT({outputs:t,viewMode:e}){return b.useMemo(()=>{if(e==="advanced")return t;if(e==="chat")return t.filter(s=>s.isUserPrompt?!0:s.text?c5(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=tT(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>bA&&(i=i.substring(0,bA-3)+"...");const m=r==="Bash"&&!f;n.push({...a,_toolKeyParam:i||void 0,_editData:c,_todoInput:d,_bashOutput:f,_bashCommand:h,_isRunning:m});continue}l5(a.text)&&n.push(a)}return n},[t,e])}function uT({outputs:t,viewMode:e}){const n=b.useRef(0),s=b.useRef(0),a=cT({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;bu.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 u5(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 fu(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(fu).join(""):Ce.isValidElement(t)?fu(t.props.children):""}const d5=/\.(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 Qx(t){const e=t.split("/")[0].split("?")[0].split("#")[0];return d5.test(e)}function f5(t){return!t||t.startsWith("#")||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t)||Qx(t)?!1:t.includes(".")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")}function p5(t){if(!t||t.includes(`
129
+ `))return!1;const e=t.trim();return!e||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||Qx(e)?!1:e.includes(".")&&(e.includes("/")||/^[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+$/.test(e))}const Pu=({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=fu(e),s=u5(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=fu(e);if(a&&E4(a)){const i=mo(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=$6(s),r=fu(e).trim(),i=a||(s&&f5(s)?s:null)||((!s||s==="#")&&p5(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("://")&&Qx(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});Pu();function Xx(t){const e=t.trimStart();if(!e.startsWith(Sb))return{hasContext:!1,context:null,userMessage:t};const n=e.lastIndexOf(Xk);if(n===-1)return{hasContext:!1,context:null,userMessage:t};const s=e.slice(Sb.length,n).trim(),a=e.slice(n+Xk.length).trim();return{hasContext:!0,context:s,userMessage:a}}function Jx(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 dT(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 fT(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 pT(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 hT(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 mT(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}=pt(["tools"]),[a,r]=b.useState(e),i=Pu({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(Dr,{remarkPlugins:[Rr],components:i,children:t})})]})}function gT({delegation:t}){const{t:e}=pt(["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 h5({bossName:t,taskCommand:e}){const{t:n}=pt(["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 bT({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 xT({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 yT({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 m5={high:"🔴",medium:"🟡",low:"🟢"},g5={scout:"🔍",builder:"🔨",debugger:"🐛",architect:"📐",warrior:"⚔️",support:"🛡️"};function vT({workPlan:t}){const{t:e}=pt(["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:m5[d.priority]}),o.jsxs("span",{className:"work-plan-task-class",title:`Suggested: ${d.suggestedClass}`,children:[g5[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 b5({request:t,onApprove:e,onDeny:n}){const{t:s}=pt(["tools"]),a=os[t.tool]||os.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 ll(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 Zx(t){const e=Sa();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 wT(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 hl(t,e,n){const s=/\[(Image|File):\s*([^\]]+)\]/g,a=[];let r=0,i;const c=Pu({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(Dr,{remarkPlugins:[Rr],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=Zx(f);a.push(o.jsxs("span",{className:"image-reference clickable",onClick:()=>e==null?void 0:e(m,h),title:_n.t("terminal:content.clickToViewImage"),children:[o.jsx("img",{src:m,alt:h,className:"image-reference-thumb"}),h]},`img-${i.index}`))}else{const m=wT(h);a.push(o.jsxs("span",{className:"file-reference clickable",onClick:()=>n==null?void 0:n(f),title:_n.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(Dr,{remarkPlugins:[Rr],components:c,children:d})},`text-${r}`))}return a.length===0?o.jsx("div",{className:"markdown-content",children:o.jsx(Dr,{remarkPlugins:[Rr],components:c,children:Df(t)})}):o.jsx(o.Fragment,{children:a})}function pu(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=Zx(d);a.push(o.jsxs("span",{className:"image-reference clickable",onClick:()=>e==null?void 0:e(h,f),title:_n.t("terminal:content.clickToViewImage"),children:[o.jsx("img",{src:h,alt:f,className:"image-reference-thumb"}),f]},`img-${i.index}`))}else{const h=wT(f);a.push(o.jsxs("span",{className:"file-reference clickable",onClick:()=>n==null?void 0:n(d),title:_n.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 x5({id:t,lineCount:e,fullText:n,onRemove:s}){const{t:a}=pt(["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(y5,{id:t,lineCount:e,content:n,onClose:()=>i(!1)})]})}function y5({id:t,lineCount:e,content:n,onClose:s}){const{t:a}=pt(["tools","common"]),{handleMouseDown:r,handleClick:i}=wa(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 v5={language:"Spanish",model:"medium"};function kT(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={...v5,...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 C=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg",""];let k="";for(const _ of C)if(!_||MediaRecorder.isTypeSupported(_)){k=_;break}console.log("[STT] Using MIME type:",k||"browser default");const N={};k&&(N.mimeType=k);const j=new MediaRecorder(S,N);j.ondataavailable=_=>{_.data.size>0&&d.current.push(_.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 C=c.current;C.onstop=async()=>{var j,_;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 w5(N);console.log("[STT] Sending audio for transcription...");const I=await(await Bt(Dt("/api/stt/transcribe"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audio:D,language:h.language,model:h.model})})).json();I.success&&I.text?(console.log("[STT] Transcription:",I.text),(_=h.onTranscription)==null||_.call(h,I.text),S(I.text)):(console.error("[STT] Transcription failed:",I.error),i(I.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)},C.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 w5(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 k5=b.memo(function({agentId:e,isWorking:n,timestamp:s}){const{t:a}=pt(["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:ST(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 xA(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 ST(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),s=e%60;return`${n}:${s.toString().padStart(2,"0")}`}const yA=72,S5=128,C5=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:C,resetPastedCount:k,handleInputFocus:N,handleInputBlur:j,pendingPermissions:_,showCompletion:D,completionElapsed:E,onImageClick:I,inputRef:O,textareaRef:T,isSnapshotView:M=!1,onClearHistory:R,onSendCommand:B,canSwipeClose:$=!1,onSwipeCloseOffsetChange:U,onSwipeClose:L}){const{t:F}=pt(["terminal","common"]),W=b.useRef(null),V=b.useRef(null),Y=O||W,z=T||V,Q=b.useRef(null),K=b.useRef(null),q=b.useRef(d),xe=b.useRef(0),de=b.useRef(null),ee=b.useRef({isTracking:!1,startY:0,startX:0}),[fe,je]=b.useState(0),[ge,Ee]=b.useState("idle"),Be=Br(),Ve=Ej(n),J=e.status==="working",ne=b.useCallback(()=>{const le=Q.current,me=d?z.current:Y.current;le==null||le.focus({preventScroll:!0}),me==null||me.focus({preventScroll:!0})},[Y,z,d]),{recording:Te,transcribing:qe,toggleRecording:at}=kT({language:"Spanish",model:"medium",onTranscription:le=>{le.trim()&&n&&H.sendCommand(n,le.trim())}}),Se=b.useCallback(()=>{de.current&&(clearTimeout(de.current),de.current=null)},[]),Fe=b.useCallback((le="idle")=>{Se(),je(0),Ee(le),U==null||U(0),le==="returning"&&(de.current=setTimeout(()=>{Ee("idle"),de.current=null},160))},[Se,U]),ie=b.useCallback(le=>{if(!$||!L||window.innerWidth>768||le.touches.length!==1)return;Se();const me=le.touches[0];ee.current={isTracking:!0,startY:me.clientY,startX:me.clientX},Ee("idle"),je(0),U==null||U(0)},[$,L,Se,U]),he=b.useCallback(le=>{if(!ee.current.isTracking)return;const me=le.touches[0],se=me.clientY-ee.current.startY,Re=Math.abs(me.clientX-ee.current.startX);if(Re>48&&Re>Math.abs(se)){ee.current.isTracking=!1,Fe("returning");return}if(se>=0){je(0),Ee("idle");return}const Ke=Math.min(S5,Math.abs(se));Ke>8&&le.preventDefault(),je(Ke),Ee("dragging"),U==null||U(Ke)},[Fe,U]),We=b.useCallback(()=>{if(ee.current.isTracking){if(ee.current.isTracking=!1,!$||!L){Fe("returning");return}if(fe>=yA){L();return}Fe("returning")}},[$,L,fe,Fe,U]),st=b.useCallback(()=>{ee.current.isTracking=!1,Fe("returning")},[Fe]);b.useEffect(()=>()=>Se(),[Se]),b.useEffect(()=>{$||(ee.current.isTracking=!1,Fe("idle"))},[$,Fe]);const ut=le=>{xe.current=le.target.selectionStart||le.target.value.length,r(le.target.value)};b.useEffect(()=>{const le=z.current;if(!le||!d)return;const se=window.innerWidth<=768?200:180;requestAnimationFrame(()=>{le.style.height="0px",le.style.overflow="hidden";const Re=le.scrollHeight,Ke=Math.max(46,Math.min(Re,se));le.style.height=`${Ke}px`,le.style.overflow=Ke>=se?"auto":"hidden"})},[a,d]),b.useEffect(()=>{q.current!==d&&(q.current=d,requestAnimationFrame(()=>{const le=xe.current;d&&z.current?(ne(),z.current.setSelectionRange(le,le)):!d&&Y.current&&(ne(),Y.current.setSelectionRange(le,le))}))},[ne,Y,z,d]);const ue=b.useRef(!1);b.useEffect(()=>{const le=ue.current;ue.current=s;const me=typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches,se=H.consumeSwipeSelectionFlag(),Re=H.consumeDirectClickSelectionFlag();if(s&&(!le||n)&&!(me&&(se||Re))){const ze=setTimeout(()=>{ne()},50);return()=>clearTimeout(ze)}},[s,ne,n]);const X=le=>{const me=new RegExp(`\\[Pasted text #${le} \\+\\d+ lines\\]\\s*`,"g");r(a.replace(me,"").trim()),C(se=>{const Re=new Map(se);return Re.delete(le),Re})},we=(()=>{const le=/\[Pasted text #(\d+) \+(\d+) lines\]/g,me=[];let se;for(;(se=le.exec(a))!==null;)me.push({id:parseInt(se[1],10),lineCount:parseInt(se[2],10)});return me})(),Z=()=>{var se,Re;if(!a.trim()&&f.length===0||!n)return;if(a.trim()==="/clear"&&f.length===0){H.clearContext(n),R(),r(""),c(!1),C(new Map),h([]),k();return}let le=v(a.trim());if(f.length>0){const Ke=f.map(ze=>ze.isImage?`[Image: ${ze.path}]`:`[File: ${ze.path}]`).join(`
133
+ `);le?le=`${le}
134
+
135
+ ${Ke}`:le=Ke}H.sendCommand(n,le),B==null||B(),r(""),c(!1),C(new Map),h([]),k(),window.innerWidth<=768&&((se=Y.current)==null||se.blur(),(Re=z.current)==null||Re.blur())},ve=le=>{const me=window.innerWidth<=768;if(le.key==="Enter"){if(me){d||(le.preventDefault(),c(!0),setTimeout(()=>{r(a+`
136
+ `)},0));return}if(le.shiftKey){d||(le.preventDefault(),c(!0));return}le.preventDefault(),Z()}},He=le=>{},Pe=le=>{le.button===1&&(le.preventDefault(),le.stopPropagation())},oe=async le=>{const me=le.clipboardData.items;for(const nt of me){if(nt.type.startsWith("image/")){le.preventDefault();const lt=nt.getAsFile();if(lt){const it=await x(lt);it&&h(ht=>[...ht,it])}return}if(nt.kind==="file"){le.preventDefault();const lt=nt.getAsFile();if(lt){const it=await x(lt);it&&h(ht=>[...ht,it])}return}}const se=le.clipboardData.files;if(se.length>0){le.preventDefault();for(const nt of se){const lt=await x(nt);lt&&h(it=>[...it,lt])}return}const Re=le.clipboardData.getData("text"),Ke=!Re.includes(`
137
+ `),ze=/^[/~][^\s]*$|^[A-Za-z]:\\[^\s]*$/.test(Re.trim()),tt=/\.[a-zA-Z0-9]{1,5}$/.test(Re.trim());if(Ke&&ze&&tt){le.preventDefault();try{const nt=await fetch("/api/files/by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Re.trim()})});if(nt.ok){const lt=await nt.blob(),it=Re.trim().split(/[/\\]/).pop()||"file",ht=await x(lt,it);ht&&h(jt=>[...jt,ht]);return}}catch{}r(a+Re);return}const ot=(Re.match(/\n/g)||[]).length+1;if(ot>5){le.preventDefault();const nt=S();C(Ge=>new Map(Ge).set(nt,Re));const lt=`[Pasted text #${nt} +${ot} lines]`,it=le.target,ht=it.selectionStart||0,jt=it.selectionEnd||0,be=a.slice(0,ht)+lt+a.slice(jt),_e=ht+lt.length;xe.current=_e,r(be),d?requestAnimationFrame(()=>{z.current&&z.current.setSelectionRange(_e,_e)}):c(!0)}},Le=async le=>{const me=le.target.files;if(me){for(const se of me){const Re=await x(se);Re&&h(Ke=>[...Ke,Re])}K.current&&(K.current.value="")}};return o.jsxs(o.Fragment,{children:[_.length>0&&o.jsx("div",{className:"permission-bar",children:_.map(le=>o.jsx(b5,{request:le,onApprove:me=>H.respondToPermissionRequest(le.id,!0,void 0,me),onDeny:()=>H.respondToPermissionRequest(le.id,!1)},le.id))}),we.length>0&&o.jsx("div",{className:"guake-pasted-texts",children:we.map(({id:le,lineCount:me})=>{const se=y.get(le)||"";return o.jsx(x5,{id:le,lineCount:me,fullText:se,onRemove:()=>X(le)},le)})}),f.length>0&&o.jsx("div",{className:"guake-attachments",children:f.map(le=>{var Ke;const me=le.isImage?Zx(le.path):null,se=((Ke=le.name.split(".").pop())==null?void 0:Ke.toLowerCase())||"",Re=["pdf","doc","docx","xls","xlsx","ppt","pptx"].includes(se);return o.jsxs("div",{className:`guake-attachment ${le.isImage?"is-image clickable":""} ${Re?"is-document":""}`,onClick:()=>{le.isImage&&I(me,le.name)},children:[le.isImage&&me?o.jsx("img",{src:me,alt:le.name,className:"guake-attachment-thumb"}):o.jsx("img",{src:`/assets/vscode-icons/${xA(se)}`,alt:le.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/${xA(se)}`,alt:se,className:"guake-attachment-type-icon",style:{width:"11px",height:"11px"}}),o.jsx("span",{className:"guake-attachment-name",title:le.path,children:le.name})]}),o.jsxs("span",{className:"guake-attachment-size",children:["(",Math.round(le.size/1024),"KB)"]})]}),o.jsx("button",{className:"guake-attachment-remove",onClick:ze=>{ze.stopPropagation(),m(le.id)},title:F("terminal:input.removeAttachment"),children:"×"})]},le.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 ${ge!=="idle"?"swipe-close-active":""} ${fe>=yA?"swipe-close-ready":""}`,onTouchStart:ie,onTouchMove:he,onTouchEnd:We,onTouchCancel:st,children:[!M&&(()=>{const le=e.contextStats,me=le?le.totalTokens:e.contextUsed||0,se=le?le.contextWindow:e.contextLimit||2e5,Re=le?le.usedPercent:Math.round(me/se*100),Ke=Math.max(0,Math.min(100,Re)),ze=Math.max(0,100-Ke),tt=Ke>=80?"#ff4a4a":Ke>=60?"#ff9e4a":Ke>=40?"#ffd700":"#4aff9e",ot=(me/1e3).toFixed(1),nt=(se/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:tt}}),o.jsxs("span",{className:"mobile-context-bar-text",children:[o.jsxs("span",{style:{color:tt},children:[ot,"k/",nt,"k"]}),o.jsxs("span",{className:"mobile-context-bar-pct",children:["(",ze,"% free)"]})]})]})})(),o.jsx(k5,{agentId:n,isWorking:J,timestamp:Ve==null?void 0:Ve.timestamp}),D&&E!==null&&o.jsx("div",{className:"guake-completion-time",children:ST(E)}),o.jsxs("div",{className:`guake-input ${d?"guake-input-expanded":""}`,children:[o.jsx("input",{ref:K,type:"file",multiple:!0,onChange:Le,style:{display:"none"},accept:"*"}),o.jsxs("div",{ref:Q,className:"guake-input-container",tabIndex:-1,onAuxClick:Pe,children:[o.jsx("button",{className:"guake-attach-btn",onClick:()=>{var le;return(le=K.current)==null?void 0:le.click()},title:F("terminal:input.attachOrPaste"),children:"📎"}),Be.experimentalTTS&&o.jsx("button",{className:`guake-mic-btn ${Te?"recording":""} ${qe?"transcribing":""}`,onClick:at,title:F(Te?"terminal:input.stopRecording":qe?"terminal:input.transcribing":"terminal:input.voiceInput"),disabled:qe,children:qe?"⏳":Te?"🔴":"🎤"}),d?o.jsx("textarea",{ref:z,placeholder:F("terminal:input.placeholder",{agent:e.name}),value:a,onChange:ut,onKeyDown:ve,onPaste:oe,onMouseDown:He,onFocus:N,onBlur:j}):o.jsx("input",{ref:Y,type:"text",placeholder:F("terminal:input.placeholder",{agent:e.name}),value:a,onChange:ut,onKeyDown:ve,onPaste:oe,onMouseDown:He,onFocus:N,onBlur:j}),o.jsx("button",{onClick:Z,disabled:!a.trim()&&f.length===0,title:F("terminal:input.send"),children:"➤"})]})]})]})})]})});function A5(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 j5(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 CT({content:t,onFileClick:e}){const{t:n}=pt(["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=A5(x),N={added:0,removed:0};for(const j of k)for(const _ of j.lines)_.type==="added"&&N.added++,_.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,_)=>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,E)=>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:C}=j5(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:[C.added>0&&o.jsxs("span",{className:"edit-stat added",children:["+",C.added]}),C.removed>0&&o.jsxs("span",{className:"edit-stat removed",children:["-",C.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 AT({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}=pt(["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 jT({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 Vb({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(Dr,{remarkPlugins:[Rr],children:a})}):o.jsx("div",{className:"plan-tool-collapsed-preview",children:i})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function N5(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 T5(t){return Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>({key:e,value:typeof n=="string"?n:JSON.stringify(n)}))}function NT(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 _5(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=N5(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=NT(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)?T5(c):[];return{selectedTools:a,fallback:r!==void 0?String(r):null,showHide:i!==void 0?String(i):null,queryParams:m}}function E5(t){const e=NT(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 TT(t){try{const e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return _5(e)}catch{}return E5(t)}function _T(t){return TT(t)!==null}function pp({content:t,agentName:e}){const[n,s]=b.useState(!1),a=TT(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 vA({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 ey(){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 Bt(Dt("/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 M5(t){const e=t.split("/").pop()||t,n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}function D5(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 ET=b.memo(function({message:e,agentId:n,highlight:s,simpleView:a,onImageClick:r,onFileClick:i,onBashClick:c,onViewMarkdown:d}){var Ee,Be;const{t:f}=pt(["tools","common","terminal"]),[h,m]=b.useState(new Set),[x,y]=b.useState(!1),v=Dj(),S=Br(),{type:C,content:k,toolName:N,timestamp:j,_bashOutput:_,_bashCommand:D}=e,E=su(k,v),{toggle:I,speaking:O}=ey(),T=Pu({onFileClick:i?Ve=>i(Ve):void 0}),M=n?(Ee=H.getState().agents.get(n))==null?void 0:Ee.name:null,R=n?(Be=H.getState().agents.get(n))==null?void 0:Be.provider:void 0,B=R==="codex"?"Codex":R==="opencode"?"OpenCode":"Claude",U=C==="tool_use"&&(N==="Task"||N==="Agent")&&e.toolInput&&(e.toolInput.name||e.toolInput.description)||null||M,L=j?cp(new Date(j).getTime()):"",F=j?new Date(j).getTime():0,W=D5(e);if(C==="assistant"&&!E.trim())return o.jsxs("div",{className:"output-line output-empty-message",children:[L&&o.jsx("span",{className:"output-timestamp",title:`${F} | ${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"}),B]}),o.jsx("span",{className:"empty-message-label",children:f("terminal:history.emptyMessage","empty message")})]});if(E.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:`${F} | ${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(Dr,{remarkPlugins:[Rr],components:T,children:E})})]});const Y=E.trimStart().startsWith(Sb),z=!Y&&E.includes("<local-command-stdout>")&&E.includes("Context Usage");if(!Y&&(E.includes("## Context Usage")||E.includes("Context Usage")&&E.includes("Tokens:")&&E.includes("Free space")||z)){const Ve=E.match(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/),J=Ve?Ve[1]:E,ne=J.match(/\*?\*?Tokens:\*?\*?\s*([\d.]+)k?\s*\/\s*([\d.]+)k?\s*\((\d+)%\)/),qe=(ie=>{const he=new RegExp(`\\|\\s*${ie}\\s*\\|\\s*([\\d.]+)k?\\s*\\|\\s*([\\d.]+)%`,"i"),We=J.match(he);if(We)return{tokens:We[1]+"k",percent:We[2]+"%"};const st=new RegExp(`${ie}\\s+([\\d.]+)k?\\s+([\\d.]+)%`,"i"),ut=J.match(st);return ut?{tokens:ut[1]+"k",percent:ut[2]+"%"}:null})("Messages"),at=ne?parseInt(ne[3]):0,Se=100-at,Fe=()=>{n&&H.setContextModalAgentId(n)};return o.jsxs("div",{className:"output-line output-context-stats",style:{cursor:n?"pointer":"default"},onClick:Fe,title:n?f("terminal:history.clickForContextStats"):void 0,children:[L&&o.jsxs("span",{className:"output-timestamp context-timestamp",title:`${F} | ${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:ne?`${ne[1]}k/${ne[2]}k`:"?"}),o.jsxs("span",{className:"context-free",children:["(",f("terminal:history.percentFree",{percent:Se.toFixed(0)}),")"]}),qe&&o.jsx("span",{className:"context-msgs",children:f("terminal:history.msgsLabel",{tokens:qe.tokens})})]})}if(!Y&&(E.includes("<local-command-caveat>")||E.includes("<command-name>/context</command-name>")||E.includes("<command-name>/cost</command-name>")||E.includes("<command-name>/compact</command-name>")))return null;const K=C==="user"?Xx(E):null,q=Ve=>{if(!Ve)return null;let J=Ve;if(J.includes("<persisted-output>")){J=J.replace(/<\/?persisted-output>/g,"").trim();const Fe=J.match(/Preview \(first [^)]+\):\s*([\s\S]*)/);if(Fe)J=Fe[1].trim();else{const ie=J.indexOf("{");ie!==-1&&(J=J.slice(ie))}}const ne=Fe=>{try{const ie=JSON.parse(Fe);if(ie&&typeof ie=="object"&&typeof ie.output=="string")return ie.output.split(`
142
+ `).filter(he=>he.length>0)}catch{}return null},Te=ne(J);if(Te)return Te;const qe=J.indexOf("{"),at=J.lastIndexOf("}");if(qe!==-1&&at>qe){const Fe=ne(J.slice(qe,at+1));if(Fe)return Fe}const Se=J.match(/"output"\s*:\s*"([\s\S]*)/);if(Se){let Fe=Se[1];const ie=Fe.match(/","(?:duration|exitCode|taskId|success)":/);ie&&ie.index!==void 0&&(Fe=Fe.slice(0,ie.index)),Fe=Fe.replace(/\.\.\.\s*$/,"");try{Fe=JSON.parse(`"${Fe}"`)}catch{Fe=Fe.replace(/\\u([0-9a-fA-F]{4})/g,(We,st)=>String.fromCharCode(parseInt(st,16))).replace(/\\n/g,`
143
+ `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}const he=Fe.split(`
144
+ `).filter(We=>We.length>0);if(he.length>0)return he}return null};if(C==="tool_use"){const Ve=os[N||""]||os.default,J=N?eT(N,f):"",ne=e.toolInput?JSON.stringify(e.toolInput):E;if(a){let Te=N&&ne?tT(N,ne):null;N==="Bash"&&Te&&Te.length>300&&(Te=Te.substring(0,297)+"...");const at=["Read","Edit","Write","Glob","Grep","NotebookEdit"].includes(N||""),Se=Te&&(at||Te.startsWith("/")||Te.includes("/")),Fe=at&&Se&&i,ie=N==="Bash"&&c,he=D||Te||"",We=ie&&he?rT(he):null,st=ie&&he?iT(he):null,ut=ie&&he?oT(he):null,ue=ie&&he?lT(he):null,X=()=>{if(Fe&&Te){if(N==="Edit"&&ne)try{const Pe=JSON.parse(ne);if(Pe.old_string!==void 0||Pe.new_string!==void 0||Pe.unified_diff!==void 0){i(Te,{oldString:Pe.old_string||"",newString:Pe.new_string||"",operation:typeof Pe.operation=="string"?Pe.operation:void 0,unifiedDiff:typeof Pe.unified_diff=="string"?Pe.unified_diff:void 0});return}}catch{}if(N==="Read"&&ne)try{const Pe=JSON.parse(ne);if(Pe.offset!==void 0&&Pe.limit!==void 0){i(Te,{highlightRange:{offset:Pe.offset,limit:Pe.limit}});return}}catch{}i(Te)}},ae=()=>{ie&&he&&c(he,_||f("tools:display.noOutputAvailable"))},we=()=>{var Le;if(!Te)return null;if(!i)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(Te,"bash")}});const Pe=n?(Le=H.getState().agents.get(n))==null?void 0:Le.cwd:void 0;return aT(Te).map((le,me)=>{if(!le.fileRef)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(le.text,"bash")}},`cmd-${me}`);const se=Tp(le.fileRef,Pe);return o.jsx("span",{className:"clickable-path",onClick:Re=>{Re.stopPropagation(),i(se.path)},title:f("tools:display.clickToViewFile"),style:{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},children:le.text},`cmd-file-${me}`)})},Z=ie?f("tools:display.clickToViewOutput"):Fe?f("tools:display.clickToViewFile"):void 0,ve=/\bcurl\b[\s\S]*\/api\/exec\b/.test(he);let He=null;if(ve&&_){const Pe=q(_);Pe&&Pe.length>0&&(He={output:Pe})}if(N==="TodoWrite"&&ne)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:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J}),o.jsx(fp,{content:ne})]});if((N==="AskUserQuestion"||N==="AskFollowupQuestion")&&ne){let Pe=!1;try{const oe=JSON.parse(ne);Pe=Array.isArray(oe.questions)&&oe.questions.length>0}catch{}if(Pe)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:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J}),o.jsx(jT,{content:ne})]})}return N==="ExitPlanMode"&&ne?o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-plan-inline",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J}),o.jsx(Vb,{content:ne})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`output-line output-tool-use output-tool-simple ${ie?"clickable-bash":""} ${st?"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:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J}),ie&&st?o.jsxs("span",{className:"output-tool-param bash-command bash-notify-param",onClick:ae,title:st.commandBody,style:{cursor:"pointer"},children:[st.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:st.shellPrefix}),o.jsx("span",{className:"bash-notify-chip",children:"notify"}),st.title&&o.jsx("span",{className:"bash-notify-title",children:st.title}),st.message&&o.jsx("span",{className:"bash-notify-message",children:st.message})]}):ie&&ut?o.jsxs("span",{className:"output-tool-param bash-command bash-task-label-param",onClick:ae,title:ut.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:"bash-task-label-chip",children:"📋 task"}),o.jsx("span",{className:"bash-task-label-value",children:ut.taskLabel})]}):ie&&ue?o.jsxs("span",{className:"output-tool-param bash-command bash-report-task-param",onClick:ae,title:ue.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:`bash-report-task-chip ${ue.status==="failed"?"status-failed":"status-completed"}`,children:ue.status==="failed"?"❌ report":"✅ report"}),ue.summary&&o.jsx("span",{className:"bash-report-task-summary",children:ue.summary})]}):ie&&We?o.jsxs("span",{className:"output-tool-param bash-command bash-search-param",onClick:ae,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})]}):Te&&o.jsxs("span",{className:`output-tool-param ${Fe?"clickable-path":""}`,onClick:Fe?X:void 0,title:Z,style:Fe?{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"}:void 0,children:[at&&Se&&(()=>{const Pe=M5(Te),oe=Pe?Bp(Pe):"";return oe?o.jsx("img",{className:"output-tool-file-icon",src:oe,alt:""}):null})(),ie?we():Te]})]}),ve&&He&&o.jsx("div",{className:"exec-task-output-container",children:o.jsx("div",{className:"exec-task-inline status-completed",children:(()=>{const Pe=`history-curl-${j}`,oe=h.has(Pe),Le=He.output.slice(-6),le=He.output.length>6,me=oe?He.output:Le;return o.jsxs(o.Fragment,{children:[le&&o.jsxs("div",{className:"exec-task-toggle",onClick:()=>m(se=>{const Re=new Set(se);return Re.has(Pe)?Re.delete(Pe):Re.add(Pe),Re}),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:He.output.length})})]}),o.jsx("div",{className:"exec-task-inline-terminal",children:o.jsx("pre",{className:"exec-task-inline-output",children:me.map((se,Re)=>o.jsx("div",{dangerouslySetInnerHTML:{__html:Sl(se)}},Re))})})]})})()})})]})}return N==="Edit"&&ne?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(CT,{content:ne,onFileClick:i})})]}):N==="Read"&&ne?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(AT,{content:ne,onFileClick:i})})]}):N==="TodoWrite"&&ne?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(fp,{content:ne})})]}):N==="ExitPlanMode"&&ne?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(Vb,{content:ne})})]}):N==="ToolSearch"&&ne?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:ne,agentName:U})})]}):ne&&_T(ne)?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:ne,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:`${F} | ${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:Ve}),o.jsx("span",{className:"output-tool-name",children:J})]}),ne&&o.jsx("div",{className:"output-line output-tool-input",children:o.jsx("pre",{className:"output-input-content",children:ll(ne,s)})})]})}if(C==="tool_result"){if(a)return null;const Ve=E.toLowerCase().includes("error")||E.toLowerCase().includes("failed");if(N==="Bash"){const J=Ve||E.toLowerCase().includes("command not found")||E.toLowerCase().includes("permission denied"),ne=E.includes("... (truncated,");return o.jsxs("div",{className:`output-line output-bash-result ${J?"is-error":""}`,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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")}),ne&&o.jsx("span",{className:"bash-output-truncated",children:f("tools:display.truncated")})]}),o.jsx("pre",{className:"bash-output-content",dangerouslySetInnerHTML:{__html:Sl(E)}})]})]})}return o.jsxs("div",{className:`output-line output-tool-result ${Ve?"is-error":""}`,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsx("span",{className:"output-result-icon",children:Ve?"❌":"✓"}),o.jsx("pre",{className:"output-result-content",children:ll(E,s)})]})}const xe=C==="user",de=!xe&&/^\s*(?:[\u{1F300}-\u{1FAFF}\u2600-\u27BF]\s*)?\[System\]/u.test(E),ee=xe?"history-line history-user":de?"history-line history-system":"history-line history-assistant",fe=de?f("tools:display.system"):B;if(xe&&K){const J=Jx(K.userMessage).userMessage,ne=dT(J.trim());if(ne.isDelegatedTask)return o.jsxs("div",{className:ee,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsx("span",{className:"history-content",children:o.jsx(bT,{bossName:ne.bossName,bossId:ne.bossId,taskCommand:ne.taskCommand})})]});const Te=fT(J.trim());if(Te.isTaskReport)return o.jsxs("div",{className:ee,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:"history-content",children:[K.hasContext&&K.context&&o.jsx(dp,{context:K.context,onFileClick:i?at=>i(at):void 0},`boss-${j||E.slice(0,50)}`),o.jsx(xT,{agentName:Te.agentName,agentId:Te.agentId,status:Te.status,originalTask:Te.originalTask,summary:Te.summary})]})]});const qe=pT(J.trim());return qe.hasNotification?o.jsxs("div",{className:ee,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:"history-content",children:[o.jsx(yT,{agentId:qe.agentId,status:qe.status}),qe.contentWithoutNotification&&o.jsx("span",{className:"user-prompt-text",children:s?o.jsx("div",{children:ll(qe.contentWithoutNotification,s)}):pu(qe.contentWithoutNotification,r,i)})]})]}):o.jsxs("div",{className:ee,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${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:[K.hasContext&&K.context&&o.jsx(dp,{context:K.context,onFileClick:i?at=>i(at):void 0},`boss-${j||E.slice(0,50)}`),s?o.jsx("div",{children:ll(J,s)}):pu(J,r,i)]})]})}const je=hT(E),ge=mT(je.contentWithoutBlock);return je.hasDelegation||ge.hasWorkPlan?o.jsxs("div",{className:ee,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:"history-role",children:[!de&&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")}),fe]}),o.jsxs("span",{className:"history-content markdown-content",children:[s?o.jsx("div",{children:ll(ge.contentWithoutBlock,s)}):hl(ge.contentWithoutBlock,r,i),ge.hasWorkPlan&&ge.workPlan&&o.jsx(vT,{workPlan:ge.workPlan}),je.hasDelegation&&je.delegations.map((Ve,J)=>o.jsx(gT,{delegation:Ve},`del-${J}`))]}),o.jsxs("div",{className:"message-action-btns",children:[S.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:Ve=>{Ve.stopPropagation(),I(E)},title:f(O?"terminal:history.stopSpeaking":"terminal:history.speakSpanish"),children:O?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:Ve=>{Ve.stopPropagation(),d(E)},title:f("terminal:history.viewAsMarkdown"),children:"📄"})]})]}):o.jsxs("div",{className:ee,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${F} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:`history-role ${xe?"history-role-chip":""}`,children:[!xe&&!de&&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")}),xe?f("common:labels.you"):fe]}),o.jsx("span",{className:`history-content ${xe?"user-prompt-text":"markdown-content"}`,children:s?o.jsx("div",{children:ll(E,s)}):xe?pu(E,r,i):hl(E,r,i)}),!xe&&o.jsxs("div",{className:"message-action-btns",children:[S.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:Ve=>{Ve.stopPropagation(),I(E)},title:f(O?"terminal:history.stopSpeaking":"terminal:history.speakSpanish"),children:O?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:Ve=>{Ve.stopPropagation(),d(E)},title:f("terminal:history.viewAsMarkdown"),children:"📄"})]})]})});function R5(t){const e=t.split("/").pop()||t,n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}const O5=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:os[c.toolName||""]||os.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 L5(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 P5({output:t,debugHash:e,agentId:n,onClose:s}){const{t:a}=pt(["tools","common"]),r=b.useRef(null);b.useEffect(()=>{const C=k=>{r.current&&!r.current.contains(k.target)&&s()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const i=C=>{navigator.clipboard.writeText(C)},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 C={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&&(C.isDelegation=!0),t.toolName&&(C.toolName=t.toolName),t.toolInput&&(C.toolInput=t.toolInput),t.toolOutput&&(C.toolOutputLen=t.toolOutput.length),t.subagentName&&(C.subagentName=t.subagentName),t.isUserPrompt&&(C.isUserPrompt=!0),t.skillUpdate&&(C.skillUpdate=t.skillUpdate),navigator.clipboard.writeText(JSON.stringify(C,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:C,value:k,mono:N})=>o.jsxs("div",{className:"msg-meta-tooltip__row",children:[o.jsx("span",{className:"msg-meta-tooltip__label",children:C}),o.jsx("span",{className:`msg-meta-tooltip__value ${N?"mono":""}`,onClick:()=>i(k),title:a("tools:metadata.clickToCopy"),children:k})]},C))})]})}function Fn({output:t,timeStr:e,debugHash:n,agentId:s}){const{t:a}=pt(["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(P5,{output:t,debugHash:n,agentId:s||null,onClose:d})]})}const ty=b.memo(function({output:e,agentId:n,execTasks:s=[],subagents:a,onImageClick:r,onFileClick:i,onBashClick:c,onViewMarkdown:d}){var Se,Fe,ie;const{t:f}=pt(["tools","common"]),h=Dj(),m=Br(),[x,y]=b.useState(new Set),{text:v,isStreaming:S,isUserPrompt:C,timestamp:k,skillUpdate:N,_toolKeyParam:j,_editData:_,_todoInput:D,_bashOutput:E,_bashCommand:I,_isRunning:O}=e,T=su(v,h),M=e.toolName,R=e.toolInput,B=e.toolOutput;let $=j;if(!$&&R&&typeof R=="object"){const he=R;if(M==="Glob"&&he.pattern)$=he.path?`${he.pattern} in ${he.path}`:he.pattern;else if(M==="Grep"&&he.pattern)$=he.path?`"${he.pattern}" in ${he.path}`:`"${he.pattern}"`;else if((M==="AskUserQuestion"||M==="AskFollowupQuestion")&&he.questions){const We=he.questions;Array.isArray(We)&&((Se=We[0])!=null&&Se.question)&&($=We[0].question)}else if((M==="Task"||M==="Agent")&&typeof he.description=="string"){const We=he.description,st=he.subagent_type;$=st?`[${st}] ${We}`:We}else if(M==="ExitPlanMode"||M==="EnterPlanMode"){const We=he.allowedPrompts;Array.isArray(We)&&We.length>0?$=We.map(st=>st.prompt||st.tool||"").filter(Boolean).join(", "):M==="ExitPlanMode"&&typeof he.plan=="string"&&he.plan.trim().length>0?$=he.plan.trim():$=M==="ExitPlanMode"?"Plan ready":"Entering plan mode"}else if(M==="spawn_agent"||M==="send_input"||M==="wait"){const We=he.prompt,st=he.receiver_thread_ids;We?$=We.length>100?We.slice(0,97)+"...":We:st&&st.length>0?$=`waiting on ${st.length} thread(s)`:M==="wait"&&($="waiting for subagents")}else if(M==="TodoWrite"&&Array.isArray(he.todos)){const We=he.todos,st=We.filter(ae=>ae.status==="completed").length,ut=We.filter(ae=>ae.status==="in_progress").length,ue=We.filter(ae=>ae.status==="pending").length,X=[];st>0&&X.push(`${st} done`),ut>0&&X.push(`${ut} active`),ue>0&&X.push(`${ue} pending`),$=`${We.length} items (${X.join(", ")})`}else if($=he.file_path||he.path||he.notebook_path||he.command||he.pattern||he.url||he.query||he.description,!$)try{const We=JSON.stringify(he);We&&We!=="{}"&&($=We.length>200?We.slice(0,197)+"...":We)}catch{}}const U=n?(Fe=H.getState().agents.get(n))==null?void 0:Fe.name:null,L=e.subagentName||U,F=n?(ie=H.getState().agents.get(n))==null?void 0:ie.provider:void 0,W=F==="codex"?"Codex":F==="opencode"?"OpenCode":"Claude",[V,Y]=b.useState(!1),[z,Q]=b.useState(!1),{toggle:K,speaking:q}=ey(),xe=cp(k||Date.now()),de=L5(e);if(N)return o.jsxs("div",{className:"output-line output-skill-update",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,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((he,We)=>o.jsxs("span",{className:"skill-update-item",title:he.description,children:[he.name,We<N.skills.length-1?", ":""]},he.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:xe,debugHash:de,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:hl(T,r,i)})]});const fe=n?H.getLastDelegationReceived(n):null;if(C){const he=T.trim();if(he==="/context"||he==="/cost"||he==="/compact")return null;const We=Xx(T),st=Jx(We.userMessage),ut=st.userMessage,ue=dT(ut.trim());if(ue.isDelegatedTask)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(bT,{bossName:ue.bossName,bossId:ue.bossId,taskCommand:ue.taskCommand})]});const X=fT(ut.trim());if(X.isTaskReport)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),We.hasContext&&We.context&&o.jsx(dp,{context:We.context,onFileClick:i},`boss-stream-${T.slice(0,50)}`),o.jsx(xT,{agentName:X.agentName,agentId:X.agentId,status:X.status,originalTask:X.originalTask,summary:X.summary})]});const ae=pT(ut.trim());if(ae.hasNotification)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(yT,{agentId:ae.agentId,status:ae.status}),ae.contentWithoutNotification&&o.jsx("span",{className:"history-content user-prompt-text",children:pu(ae.contentWithoutNotification,r,i)})]});const we=fe&&T.trim()===fe.taskCommand.trim();return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),we?o.jsx(h5,{bossName:fe.bossName,taskCommand:fe.taskCommand}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"output-role output-role-chip output-role-user-chip",children:f("common:labels.you")}),We.hasContext&&We.context&&o.jsx(dp,{context:We.context,onFileClick:i},`boss-stream-${T.slice(0,50)}`),pu(st.userMessage,r,i)]})]})}if(T.startsWith("Using tool:")){const he=T.replace("Using tool:","").trim(),We=eT(he,f),st=os[he]||os.default,ut=new Set(["Bash","Read","Write","Edit","Glob","Grep","NotebookEdit","Task","Agent","TodoWrite","AskUserQuestion","AskFollowupQuestion","ExitPlanMode","EnterPlanMode","web_search","ToolSearch","spawn_agent","send_input","wait"]),ue=D||(he==="TodoWrite"&&R&&typeof R=="object"&&Array.isArray(R.todos)?JSON.stringify(R):void 0);if(he==="TodoWrite"&&ue)return o.jsxs("div",{className:`output-line output-tool-use output-todo-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:st}),o.jsx("span",{className:"output-tool-name",children:We}),o.jsx(fp,{content:ue})]});const X=(he==="AskUserQuestion"||he==="AskFollowupQuestion")&&R&&typeof R=="object"&&Array.isArray(R.questions)?JSON.stringify(R):void 0;if((he==="AskUserQuestion"||he==="AskFollowupQuestion")&&X)return o.jsxs("div",{className:`output-line output-tool-use output-ask-question-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:st}),o.jsx("span",{className:"output-tool-name",children:We}),o.jsx(jT,{content:X})]});const ae=he==="ExitPlanMode"&&R&&typeof R=="object"&&typeof R.plan=="string"?JSON.stringify(R):void 0;if(he==="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:xe,debugHash:de,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:st}),o.jsx("span",{className:"output-tool-name",children:We}),o.jsx(Vb,{content:ae})]});const we=he==="ToolSearch"&&R&&typeof R=="object"?JSON.stringify(R):void 0;if(he==="ToolSearch"&&we)return o.jsxs("div",{className:`output-line output-tool-use output-toolsearch-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"}),o.jsx(pp,{content:we,agentName:L})]});if(["spawn_agent","send_input","wait"].includes(he)){const mt=R,ct=mt==null?void 0:mt.prompt,xt=mt==null?void 0:mt.receiver_thread_ids,Mt=ct?ct.length>120?ct.slice(0,117)+"...":ct:void 0,kn=he==="spawn_agent"?"Spawn Agent":he==="send_input"?"Send Input":"Wait";return o.jsxs("div",{className:`output-line output-tool-use output-collab-tool output-collab-${he} ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:st}),o.jsx("span",{className:"output-tool-name collab-tool-name",children:kn}),xt&&xt.length>0&&o.jsx("span",{className:"collab-thread-ids",children:xt.map(cn=>cn.slice(-8)).join(", ")}),Mt&&o.jsx("span",{className:"collab-prompt-preview",title:ct,children:Mt})]})}const ve=R&&typeof R=="object"?JSON.stringify(R,null,2):void 0,Pe=["Read","Edit","Write","Glob","Grep","NotebookEdit"].includes(he),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,le=j||Le,me=!!le&&(Pe||le.startsWith("/")||le.includes("/")),se=Pe&&me&&i,Re=he==="Edit"&&oe?{oldString:String(oe.old_string??""),newString:String(oe.new_string??""),operation:typeof oe.operation=="string"?oe.operation:void 0}:void 0,Ke=he==="Read"&&oe&&typeof oe.offset=="number"&&typeof oe.limit=="number"?{highlightRange:{offset:oe.offset,limit:oe.limit}}:void 0,ze=he==="Bash"&&c,tt=!!E||!!B,ot=I||j||$||"",nt=sT(ot),lt=/\bcurl\b[\s\S]*\/api\/exec\b/.test(ot),it=k?new Date(k).getTime():0,ht=lt?nT(ot):null,jt=lt&&s.length>0?(()=>{if(ht){const ct=s.filter(xt=>xt.command===ht);if(ct.length>0)return[ct.reduce((Mt,kn)=>kn.startedAt>Mt.startedAt?kn:Mt)]}const mt=s.filter(ct=>ct.startedAt>=it&&ct.startedAt<=it+5e3);return mt.length>0?[mt.reduce((xt,Mt)=>Mt.startedAt>xt.startedAt?Mt:xt)]:[]})():[],be=!!(ze&&lt&&jt.length>0),_e=(he==="Task"||he==="Agent")&&a&&e.uuid?(()=>{for(const[,mt]of a)if(mt.toolUseId===e.uuid)return mt})():void 0,Ge=ze&&ot?rT(ot):null,et=ze&&ot?iT(ot):null,Nt=ze&&ot?oT(ot):null,zt=ze&&ot?lT(ot):null,Lt=mt=>{if(mt.stopPropagation(),se&&le){const ct=_||Re;he==="Edit"&&ct?i(le,ct):he==="Read"&&Ke?i(le,Ke):i(le)}},Pt=()=>{if(ze&&ot){const mt=O?f("tools:display.running"):E||f("tools:display.noOutputCaptured");c(ot,mt)}},Vt=()=>{var xt;if(!nt)return null;if(!i)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(nt,"bash")}});const mt=n?(xt=H.getState().agents.get(n))==null?void 0:xt.cwd:void 0;return aT(nt).map((Mt,kn)=>{if(!Mt.fileRef)return o.jsx("span",{dangerouslySetInnerHTML:{__html:mo(Mt.text,"bash")}},`cmd-${kn}`);const cn=Tp(Mt.fileRef,mt);return o.jsx("span",{className:"clickable-path",onClick:ls=>{ls.stopPropagation(),i(cn.path)},title:f("tools:display.clickToViewFile"),style:{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},children:Mt.text},`cmd-file-${kn}`)})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`output-line output-tool-use ${S?"output-streaming":""} ${ze?"bash-clickable":""} ${et?"bash-notify-use":""}`,onClick:ze?Pt:void 0,title:ze?f("tools:display.clickToViewOutput"):void 0,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:st}),o.jsx("span",{className:"output-tool-name",children:We}),ze&&ot&&(et?o.jsxs("span",{className:"output-tool-param bash-command bash-notify-param",onClick:Pt,title:et.commandBody,style:{cursor:"pointer"},children:[et.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:et.shellPrefix}),o.jsx("span",{className:"bash-notify-chip",children:"notify"}),et.title&&o.jsx("span",{className:"bash-notify-title",children:et.title}),et.message&&o.jsx("span",{className:"bash-notify-message",children:et.message})]}):Nt?o.jsxs("span",{className:"output-tool-param bash-command bash-task-label-param",onClick:Pt,title:Nt.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:"bash-task-label-chip",children:"📋 task"}),o.jsx("span",{className:"bash-task-label-value",children:Nt.taskLabel})]}):zt?o.jsxs("span",{className:"output-tool-param bash-command bash-report-task-param",onClick:Pt,title:zt.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:`bash-report-task-chip ${zt.status==="failed"?"status-failed":"status-completed"}`,children:zt.status==="failed"?"❌ report":"✅ report"}),zt.summary&&o.jsx("span",{className:"bash-report-task-summary",children:zt.summary})]}):Ge?o.jsxs("span",{className:"output-tool-param bash-command bash-search-param",onClick:Pt,title:Ge.commandBody,style:{cursor:"pointer"},children:[Ge.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:Ge.shellPrefix}),o.jsx("span",{className:"bash-search-chip",children:"search"}),o.jsx("span",{className:"bash-search-term",children:Ge.searchTerm})]}):o.jsx("span",{className:"output-tool-param bash-command",onClick:Pt,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 ${se?"clickable-path":""}`,onClick:se?Lt:void 0,title:se?f(he==="Edit"&&(_||Re)?"tools:display.clickToViewDiff":"tools:display.clickToViewFile"):void 0,style:se?{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"}:void 0,children:[Pe&&me&&(()=>{const mt=R5(le),ct=mt?Bp(mt):"";return ct?o.jsx("img",{className:"output-tool-file-icon",src:ct,alt:""}):null})(),$]}),ze&&!O&&o.jsx("span",{className:"bash-output-indicator",children:s.some(mt=>mt.status==="completed")?"✅":tt?"📄":"💻"}),S&&o.jsx("span",{className:"output-tool-loading",children:"..."})]}),!ut.has(he)&&ve&&o.jsxs("div",{className:"output-line output-tool-input output-tool-input-fallback",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(vA,{toolName:he,content:ve})]}),be&&o.jsx("div",{className:"exec-task-output-container",children:jt.map(mt=>{const ct=x.has(mt.taskId),xt=mt.output.slice(-6),Mt=mt.output.length>6,kn=ct?mt.output:xt;return o.jsxs("div",{className:`exec-task-inline status-${mt.status}`,children:[Mt&&o.jsxs("div",{className:"exec-task-toggle",onClick:()=>y(cn=>{const ls=new Set(cn);return ls.has(mt.taskId)?ls.delete(mt.taskId):ls.add(mt.taskId),ls}),children:[o.jsx("span",{className:"exec-task-toggle-arrow",children:ct?"▼":"▶"}),o.jsx("span",{className:"exec-task-toggle-text",children:ct?f("tools:skills.hide"):f("tools:skills.showAll",{count:mt.output.length})})]}),o.jsx("div",{className:"exec-task-inline-terminal",children:o.jsxs("pre",{className:"exec-task-inline-output",children:[kn.map((cn,ls)=>o.jsx("div",{dangerouslySetInnerHTML:{__html:Sl(cn)}},ls)),mt.status==="running"&&o.jsx("span",{className:"exec-task-cursor",children:"▌"})]})})]},mt.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((mt,ct)=>o.jsxs("div",{className:"subagent-activity-item",children:[o.jsx("span",{className:"activity-icon",children:os[mt.toolName]||os.default}),o.jsx("span",{className:"activity-tool",children:mt.toolName}),o.jsx("span",{className:"activity-desc",children:mt.description.length>80?mt.description.slice(0,77)+"...":mt.description})]},ct)),_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(O5,{entries:_e.streamEntries,isWorking:_e.status==="working"})]})})]})}if(T.startsWith("Tool input:")){const he=T.replace("Tool input:","").trim();if(_T(he))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(pp,{content:he,agentName:L})]});try{const We=JSON.parse(he);if(We.file_path&&(We.old_string!==void 0||We.new_string!==void 0))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(CT,{content:he,onFileClick:i})]});if(We.file_path&&We.old_string===void 0&&We.new_string===void 0)return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(AT,{content:he,onFileClick:i})]});if(Array.isArray(We.todos))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(fp,{content:he})]})}catch{}return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx(vA,{toolName:M||"UnknownTool",content:he})]})}if(T.startsWith("Tool result:")){const he=T.replace("Tool result:","").trim(),We=he.toLowerCase().includes("error")||he.toLowerCase().includes("failed");return o.jsxs("div",{className:`output-line output-tool-result ${We?"is-error":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsx("span",{className:"output-result-icon",children:We?"❌":"✓"}),o.jsx("pre",{className:"output-result-content",children:he})]})}if(T.startsWith("Bash output:")){const he=T.replace("Bash output:","").trim(),We=he.toLowerCase().includes("error")||he.toLowerCase().includes("failed")||he.toLowerCase().includes("command not found")||he.toLowerCase().includes("permission denied"),st=he.includes("... (truncated,");return o.jsxs("div",{className:`output-line output-bash-result ${We?"is-error":""}`,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,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")}),st&&o.jsx("span",{className:"bash-output-truncated",children:f("tools:display.truncated")})]}),o.jsx("pre",{className:"bash-output-content",dangerouslySetInnerHTML:{__html:Sl(he)}})]})]})}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 ge=T.startsWith("[thinking]"),Ee=ge?T.replace(/^\[thinking\]\s*/,""):"",Be=ge?(Ee||"(processing)").replace(/\*+/g,"").replace(/\s+/g," ").trim():"",Ve=/^\s*(?:[\u{1F300}-\u{1FAFF}\u2600-\u27BF]\s*)?\[System\]/u.test(T),J=!!(e.subagentName&&B&&/^[✅❌]\s*Subagent\s/.test(T));let ne="output-line",Te=!0,qe=!1;if(T.startsWith("Session started:")||T.startsWith("Session initialized")?(ne+=" output-session",Te=!1):T.startsWith("Tokens:")||T.startsWith("Cost:")?(ne+=" output-stats",Te=!1):ge?(ne+=" output-thinking output-tool-use",Te=!1):T.startsWith("[raw]")?(ne+=" output-raw",Te=!1):Ve?ne+=" output-text output-system markdown-content":(ne+=" output-text output-claude markdown-content",qe=!0),S&&(ne+=" output-streaming"),qe&&!S){const he=hT(T),We=mT(he.contentWithoutBlock);if(he.hasDelegation||We.hasWorkPlan)return o.jsxs("div",{className:ne,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),o.jsxs("span",{className:"output-role",children:[F&&o.jsx("img",{src:F==="codex"?"/assets/codex.png":F==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"output-role-icon",title:F==="codex"?"Codex Agent":F==="opencode"?"OpenCode Agent":"Claude Agent"}),W]}),o.jsx("div",{className:"markdown-content",children:hl(We.contentWithoutBlock,r,i)}),We.hasWorkPlan&&We.workPlan&&o.jsx(vT,{workPlan:We.workPlan}),he.hasDelegation&&he.delegations.map((st,ut)=>o.jsx(gT,{delegation:st},`del-${ut}`)),o.jsxs("div",{className:"message-action-btns",children:[m.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:st=>{st.stopPropagation(),K(T)},title:q?"Stop speaking":"Speak (Spanish)",children:q?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:st=>{st.stopPropagation(),d(B||T)},title:"View as Markdown",children:"📄"})]})]})}const at=qe?W:Ve?f("tools:display.system"):null;return o.jsxs("div",{className:ne,children:[o.jsx(Fn,{output:e,timeStr:xe,debugHash:de,agentId:n}),at&&o.jsxs("span",{className:"output-role",children:[qe&&F&&o.jsx("img",{src:F==="codex"?"/assets/codex.png":F==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"output-role-icon",title:F==="codex"?"Codex Agent":F==="opencode"?"OpenCode Agent":"Claude Agent"}),at]}),Te?o.jsx("div",{className:"markdown-content",children:hl(T,r,i)}):ge?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(F==="codex"?"tools:display.codexThinking":"tools:display.thinking")}),o.jsx("span",{className:"output-tool-param output-thinking-content",title:Be,children:Be})]}):T,J&&B&&o.jsxs("div",{className:"subagent-result-section",children:[o.jsxs("button",{className:"subagent-result-toggle",onClick:he=>{he.stopPropagation(),Q(!z)},children:[o.jsx("span",{className:"subagent-result-arrow",children:z?"▼":"▶"}),z?"Hide result":"Show result"]}),z&&o.jsx("div",{className:"subagent-result-content markdown-content",children:hl(B,r,i)})]}),qe&&!S&&o.jsxs("div",{className:"message-action-btns",children:[m.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:he=>{he.stopPropagation(),K(T)},title:q?"Stop speaking":"Speak (Spanish)",children:q?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:he=>{he.stopPropagation(),d(B||T)},title:"View as Markdown",children:"📄"})]})]})}),cl={user:60,assistant:120,tool_use:40,tool_result:80,default:60};function I5(t){var n,s;if("type"in t)return cl[t.type]||cl.default;const e=t;return e.isUserPrompt?cl.user:(n=e.text)!=null&&n.startsWith("Using tool:")?cl.tool_use:(s=e.text)!=null&&s.startsWith("Tool result:")?cl.tool_result:cl.assistant}const B5=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(ET,{message:e,agentId:s,simpleView:i,highlight:f,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y}):o.jsx(ty,{output:e,agentId:s,execTasks:a,subagents:r,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y})})}),F5=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:C,isLoadingMore:k,hasMore:N,shouldAutoScroll:j,onUserScroll:_,pinToBottom:D=!1,onPinCancel:E,isLoadingHistory:I}){const O=b.useMemo(()=>[...e,...n],[e,n]),T=e.length,M=b.useRef(!1),R=b.useRef(O.length),B=b.useRef(!1),$=b.useRef(O.length);$.current=O.length;const U=b.useRef(0),L=d1({count:O.length,getScrollElement:()=>S.current,estimateSize:Q=>I5(O[Q]),overscan:10,initialRect:{width:500,height:800},measureElement:Q=>Q.getBoundingClientRect().height});b.useEffect(()=>()=>{L.elementsCache.clear()},[L]);const F=b.useCallback(()=>{const Q=S.current;if(!Q)return;const K=$.current;K<=0||(L.scrollToIndex(K-1,{align:"end"}),Q.scrollTop=Q.scrollHeight)},[S,L]);b.useLayoutEffect(()=>{D&&(I||O.length!==0&&(M.current=!0,B.current=!0,F()))},[D,I,O.length,F]),b.useEffect(()=>{if(!D){M.current=!1,B.current=!1;return}if(I||O.length===0)return;let Q;const K=()=>{M.current=!0,F(),Q=requestAnimationFrame(K)};return Q=requestAnimationFrame(K),()=>cancelAnimationFrame(Q)},[D,I,O.length,F]),b.useEffect(()=>{if(j&&O.length!==0){if(O.length<=R.current){R.current=O.length;return}R.current=O.length,M.current=!0,F(),requestAnimationFrame(()=>{M.current=!1})}},[O.length,j,F]);const W=L.getTotalSize();b.useEffect(()=>{const Q=U.current;U.current=W,j&&(D||W<=Q||W-Q<2||(M.current=!0,F(),requestAnimationFrame(()=>{M.current=!1})))},[W,j,D,F]);const V=b.useCallback(()=>{if(!S.current)return;const{scrollTop:Q,scrollHeight:K,clientHeight:q}=S.current;D&&!M.current&&(E==null||E()),!(K-Q-q<150)&&!M.current&&!B.current&&_&&_(),Q<200&&N&&!k&&C&&C()},[N,k,C,_,S,D,E]);b.useEffect(()=>{const Q=S.current;if(Q)return Q.addEventListener("scroll",V,{passive:!0}),()=>Q.removeEventListener("scroll",V)},[V,S]),b.useEffect(()=>{const Q=S.current;if(!Q)return;const K=new ResizeObserver(()=>{M.current=!0,Q.dispatchEvent(new Event("scroll")),requestAnimationFrame(()=>{M.current=!1})});return K.observe(Q),()=>K.disconnect()},[S]),b.useEffect(()=>{if(f!==null&&f>=0&&f<O.length){M.current=!0,L.scrollToIndex(f,{align:"center"});const Q=setTimeout(()=>{M.current=!1},100);return()=>clearTimeout(Q)}},[f,L,O.length]),b.useEffect(()=>{if(d!=null&&d>=0&&d<O.length){M.current=!0,L.scrollToIndex(d,{align:"center"});const Q=setTimeout(()=>{M.current=!1},100);return()=>clearTimeout(Q)}},[d,L,O.length]);const Y=L.getVirtualItems(),z=i!=="advanced";return o.jsx("div",{style:{height:`${L.getTotalSize()}px`,width:"100%",position:"relative"},children:Y.map(Q=>{const K=O[Q.index],q=Q.index<T;return o.jsx("div",{"data-index":Q.index,ref:L.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Q.start}px)`},children:o.jsx(B5,{item:K,isHistory:q,agentId:s,execTasks:a,subagents:r,simpleView:z,isSelected:h(Q.index),messageIndex:Q.index,searchHighlight:c,onImageClick:m,onFileClick:x,onBashClick:y,onViewMarkdown:v})},Q.key)})})});function z5({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}=pt(["tools"]),y=b.useMemo(()=>Pu({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,C=()=>{const N=t.completedAt||Date.now(),j=Math.floor((N-t.startedAt)/1e3);if(j<60)return`${j}s`;const _=Math.floor(j/60),D=j%60;return`${_}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:C()}),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(Dr,{remarkPlugins:[Rr],components:y,children:Df(t.taskDescription)})})}),t.output.length>0&&o.jsx("div",{className:"agent-progress-output-section",children:o.jsx($5,{output:t.output,agentId:t.agentId,maxHeight:200,onFileClick:a,onBashClick:r})})]})]})}function $5({output:t,agentId:e,maxHeight:n=200,onFileClick:s,onBashClick:a}){const r=b.useRef(null),c=cT({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(ty,{output:d,agentId:e,onFileClick:s,onBashClick:a},`progress-${f}`))})}const wA=1e4,H5=3e4,U5=12e4;function Kg(t){const e=Xx(t);return Jx(e.userMessage).userMessage.trim().replace(/\r\n/g,`
145
+ `)}function yf(t){return t.trim().replace(/\r\n/g,`
146
+ `)}function W5(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 kA=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},C){var Re,Ke;const{t:k}=pt(["terminal","common"]),N=Bj(),j=Fj(),_=ux(),D=_j(e),E=KO(e),I=!!(n!=null&&n.sessionId)&&!r,O=(n==null?void 0:n.class)==="boss"||(n==null?void 0:n.isBoss),T=lL(!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]),[B,$]=b.useState(!0),U=cL(r?null:e),L=yL(r?null:e),F=tL(),W=b.useMemo(()=>r||!e?[]:Array.from(F.values()).filter(ze=>ze.agentId===e&&ze.status==="pending"),[r,e,F]),V=b.useRef(null),Y=b.useRef(null),z=b.useRef(null),Q=b.useMemo(()=>r&&i?i.outputs.map(ze=>({text:ze.text||"",timestamp:ze.timestamp,isStreaming:!1,isUserPrompt:!1})):D,[r,i,D]),K=Cj({selectedAgentId:e,hasSessionId:I,reconnectCount:N,historyRefreshTrigger:j,lastPrompts:_,outputScrollRef:V}),q=i5({selectedAgentId:e}),xe=b.useMemo(()=>{const{history:ze}=K,tt=new Map;for(const nt of ze)nt.type==="tool_result"&&nt.toolUseId&&tt.set(nt.toolUseId,nt.content);return(nt=>nt.map(lt=>{if(lt.type==="tool_use"&&lt.toolName==="Bash"&&lt.toolUseId){const it=tt.get(lt.toolUseId);let ht;try{ht=(lt.toolInput||(lt.content?JSON.parse(lt.content):{})).command}catch{}return{...lt,_bashOutput:it,_bashCommand:ht}}return lt}))(ze)},[K.history]),de=uT({outputs:Q,viewMode:s}),ee=b.useMemo(()=>{const ze=[],tt=new Set,ot=new Set;let nt=null,lt=0;for(const it of xe){if(it.type==="assistant"){const _e=it.uuid?`uuid:${it.uuid}:${yf(it.content)}`:`sig:${it.timestamp}:${yf(it.content)}`;if(tt.has(_e))continue;tt.add(_e),ze.push(it);continue}if(it.type!=="user"){ze.push(it);continue}const ht=Kg(it.content),jt=it.uuid?`uuid:${it.uuid}:${ht}`:null;if(jt&&ot.has(jt))continue;const be=it.timestamp?new Date(it.timestamp).getTime():0;nt===ht&&Math.abs(be-lt)<=wA||(ze.push(it),jt&&ot.add(jt),nt=ht,lt=be)}return ze},[xe]),fe=b.useMemo(()=>{const ze=new Map,tt=new Set,ot=new Map;for(const ht of ee){const jt=ht.timestamp?new Date(ht.timestamp).getTime():0;if(ht.type==="user"){const Ge=Kg(ht.content),et=ze.get(Ge)??0;jt>et&&ze.set(Ge,jt);continue}if(ht.type!=="assistant")continue;ht.uuid&&tt.add(ht.uuid);const be=yf(ht.content),_e=ot.get(be)??0;jt>_e&&ot.set(be,jt)}const nt=[];let lt=null,it=0;for(const ht of de){if(!ht.isUserPrompt){if(!ht.isStreaming&&!W5(ht.text)){if(ht.uuid&&tt.has(ht.uuid))continue;const Ge=yf(ht.text),et=ht.timestamp||0,Nt=ot.get(Ge);if(Nt&&Math.abs(et-Nt)<=U5)continue}nt.push(ht);continue}const jt=Kg(ht.text),be=ht.timestamp||0,_e=ze.get(jt);_e&&be>=_e&&be-_e<=H5||lt===jt&&Math.abs(be-it)<=wA||(nt.push(ht),lt=jt,it=be)}return nt},[de,ee]),je=b.useMemo(()=>[...ee,...fe],[ee,fe]),ge=s5({selectedAgentId:e,isOpen:a,allItems:je,viewMode:s,hasMoreHistory:K.hasMore,loadAllHistory:K.loadAllHistory,loadingMore:K.loadingMore}),Ee=ee.length+fe.length,Be=o5({totalMessages:Ee,isOpen:a,hasModalOpen:S||ge.searchMode,scrollContainerRef:V,selectedAgentId:e,inputRef:Y,textareaRef:z,useTextarea:q.useTextarea}),[Ve,J]=b.useState(!1),[ne,Te]=b.useState(null),qe=b.useRef(null),at=b.useRef(null);b.useEffect(()=>{const ze=n==null?void 0:n.status;if(qe.current==="working"&&ze==="idle"){at.current&&clearTimeout(at.current);const ot=_.get(e);Te(ot!=null&&ot.timestamp?Date.now()-ot.timestamp:null),J(!0),at.current=setTimeout(()=>{J(!1),Te(null),at.current=null},4e3)}else ze==="working"&&(at.current&&(clearTimeout(at.current),at.current=null),J(!1),Te(null));return qe.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(tt=>{H.clearAgentTaskProgress(e,tt)})},300);return()=>window.clearTimeout(ze)},[e,O,r,R]);const[Se,Fe]=b.useState(!0),ie=b.useRef(!1),he=b.useRef(!1),We=b.useRef(!1),st=b.useCallback(()=>{We.current||(ie.current=!0,Fe(!1))},[]),[ut,ue]=b.useState(!1),X=b.useCallback(()=>ue(!1),[]),ae=b.useCallback(()=>{ie.current=!1,Fe(!0)},[]);b.useEffect(()=>{Fe(!0),ie.current=!1,he.current=!0,We.current=!0;const ze=setTimeout(()=>{We.current=!1},3e3);return()=>clearTimeout(ze)},[e]);const we=b.useRef(K.handleScroll);we.current=K.handleScroll;const Z=b.useCallback(()=>{if(!V.current||m.keyboardScrollLockRef.current)return;const{scrollTop:ze,scrollHeight:tt,clientHeight:ot}=V.current,nt=tt-ze-ot<150;We.current||(ie.current=!nt,nt&&Fe(!0)),we.current(m.keyboardScrollLockRef)},[V,m.keyboardScrollLockRef]),ve=D.length>0&&((Ke=(Re=D[D.length-1])==null?void 0:Re.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,ve,m.keyboardScrollLockRef,V]);const[He,Pe]=b.useState(!1),[oe,Le]=b.useState(!1),le=b.useRef(null);b.useLayoutEffect(()=>{const ze=le.current;ze!==null&&ze!==e?(Pe(!1),K.hasCachedHistory(e)||Le(!0)):e||Pe(!1),le.current=e},[e]),b.useEffect(()=>{if(!oe||K.fetchingHistory)return;const ze=requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight),Le(!1)});return()=>cancelAnimationFrame(ze)},[oe,K.fetchingHistory,K.historyLoadVersion]),b.useEffect(()=>{if(!he.current||!e||oe||K.fetchingHistory)return;let ze=0,tt=0;return ze=requestAnimationFrame(()=>{tt=requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight),he.current=!1})}),()=>{cancelAnimationFrame(ze),cancelAnimationFrame(tt)}},[e,oe,K.fetchingHistory,K.historyLoadVersion]);const me=b.useRef(!1);b.useEffect(()=>{me.current=!0,ue(!0)},[e,N]),b.useEffect(()=>{K.fetchingHistory&&(me.current=!0,ue(!0))},[K.fetchingHistory]),b.useEffect(()=>{if(!ut||!a||K.fetchingHistory)return;const ze=V.current;if(!ze)return;let tt=null;const ot=performance.now();let nt=0,lt=-1;const it=()=>{const{scrollTop:jt,scrollHeight:be,clientHeight:_e}=ze;return be-jt-_e<=2},ht=()=>{const jt=performance.now(),be=ze.scrollHeight,_e=Math.abs(be-lt)<=1,Ge=it();if(_e&&Ge?nt+=1:nt=0,lt=be,nt>=3){ue(!1),tt=null;return}if(jt-ot>8e3){ue(!1),tt=null;return}tt=requestAnimationFrame(ht)};return tt=requestAnimationFrame(ht),()=>{tt!==null&&cancelAnimationFrame(tt)}},[ut,a,K.fetchingHistory,K.historyLoadVersion]);const se=b.useRef(!1);return b.useEffect(()=>{se.current&&!ut&&me.current&&(me.current=!1,Pe(!0)),se.current=ut},[ut]),b.useEffect(()=>{if(!a||!me.current||ut||K.fetchingHistory)return;const ze=requestAnimationFrame(()=>{me.current&&(me.current=!1,Pe(!0))});return()=>cancelAnimationFrame(ze)},[K.historyLoadVersion,a,ut,K.fetchingHistory]),b.useEffect(()=>{if(!ge.searchMode)return;const ze=tt=>{tt.key==="Escape"&&(tt.stopImmediatePropagation(),ge.closeSearch())};return document.addEventListener("keydown",ze,!0),()=>document.removeEventListener("keydown",ze,!0)},[ge.searchMode,ge.closeSearch]),b.useEffect(()=>()=>m.cleanup(),[e,m]),b.useImperativeHandle(C,()=>({outputScrollRef:V,inputRef:Y,textareaRef:z,historyLoader:{loadingHistory:K.loadingHistory,fetchingHistory:K.fetchingHistory,historyLoadVersion:K.historyLoadVersion,loadingMore:K.loadingMore,hasMore:K.hasMore,totalCount:K.totalCount,loadMoreHistory:K.loadMoreHistory,clearHistory:K.clearHistory,hasCachedHistory:K.hasCachedHistory,history:K.history},search:ge,terminalInput:{uploadFile:q.uploadFile,setAttachedFiles:q.setAttachedFiles,useTextarea:q.useTextarea},getDedupedHistory:()=>ee,getDedupedOutputs:()=>fe,outputsLength:ee.length+fe.length}),[K,ge,q,ee,fe]),o.jsxs(o.Fragment,{children:[ge.searchMode&&o.jsx(p6,{searchInputRef:ge.searchInputRef,searchQuery:ge.searchQuery,setSearchQuery:ge.setSearchQuery,closeSearch:ge.closeSearch,matchCount:ge.matchIndices.length,currentMatch:ge.currentMatch,navigateNext:ge.navigateNext,navigatePrev:ge.navigatePrev,loadingFullHistory:ge.loadingFullHistory}),o.jsx("div",{className:"guake-output",ref:V,onScroll:Z,children:o.jsxs("div",{className:`guake-history-content ${He?"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&&K.loadingHistory&&K.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&&!K.loadingHistory&&K.history.length===0&&Q.length===0&&n.status!=="working"&&o.jsx("div",{className:"guake-empty",children:k("terminal:empty.noOutput")}),!oe&&K.hasMore&&!ge.searchMode&&o.jsx("div",{className:"guake-load-more",children:K.loadingMore?o.jsx("span",{children:k("terminal:empty.loadingOlder")}):o.jsx("button",{onClick:K.loadMoreHistory,children:k("terminal:empty.loadMore",{count:K.totalCount-K.history.length})})}),!oe&&o.jsx(F5,{historyMessages:ee,liveOutputs:fe,agentId:e,execTasks:U,subagents:L,viewMode:s,searchHighlight:ge.highlightQuery,searchActiveIndex:ge.scrollToIndex,selectedMessageIndex:Be.selectedIndex,isMessageSelected:Be.isSelected,onImageClick:c,onFileClick:d,onBashClick:f,onViewMarkdown:h,scrollContainerRef:V,onScrollTopReached:K.loadMoreHistory,isLoadingMore:K.loadingMore,hasMore:K.hasMore,shouldAutoScroll:Se,onUserScroll:st,pinToBottom:ut,onPinCancel:X,isLoadingHistory:K.fetchingHistory},e),!oe&&E&&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 ${B?"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(),$(tt=>!tt))},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:B?"▶":"▼"})]}),!B&&M.map(ze=>o.jsx(z5,{progress:ze,defaultExpanded:ze.status==="working",onAgentClick:tt=>{H.selectAgent(tt),H.setTerminalOpen(!0)},onDismiss:tt=>{H.clearAgentTaskProgress(e,tt)},onFileClick:d,onBashClick:f},ze.agentId))]})]})}),o.jsx(C5,{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:Ve,completionElapsed:ne,onImageClick:c,inputRef:Y,textareaRef:z,isSnapshotView:r,onClearHistory:K.clearHistory,onSendCommand:ae,canSwipeClose:x,onSwipeCloseOffsetChange:y,onSwipeClose:v})]})})),q5=b.memo(function({agentId:e,onClose:n}){const s=lx(e),{t:a}=pt("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:"✕"})]})}),V5=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:C,onSwipeClose:k,hasModalOpen:N}=e,j=kL(),_=SL(),D=Dl(),[E,I]=b.useState(!1),{t:O}=pt("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",I(!0))},[]),R=b.useCallback(V=>{V.currentTarget.contains(V.relatedTarget)||I(!1)},[]),B=b.useCallback(V=>{V.preventDefault(),I(!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=_==="horizontal",F=L?"horizontal":"vertical",W=b.useCallback(()=>{H.toggleSplitOrientation()},[]);return U?o.jsxs("div",{className:`split-terminal-layout multi ${L?"orientation-horizontal":"orientation-vertical"} ${E?"drop-zone-active":""}`,onDragOver:M,onDragLeave:R,onDrop:B,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 z=D.get(V);if(!z)return null;const Q=V===n;return o.jsxs(Ce.Fragment,{children:[Y>0&&o.jsx("div",{className:`guake-split-divider ${F}`}),o.jsxs("div",{className:"split-terminal-pane",children:[o.jsx(q5,{agentId:V,onClose:()=>T(V)}),o.jsx(kA,{ref:Q?a:void 0,agentId:V,agent:z,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 ${E?"drop-zone-active":""}`,onDragOver:M,onDragLeave:R,onDrop:B,children:o.jsx(kA,{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:C,onSwipeClose:k,hasModalOpen:N})})}),G5={running:"🟢",stopped:"⚫",error:"🔴",unknown:"❓",starting:"🟡",stopping:"🟠"};function Qg(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 SA(t){const e=t.replace(/\/$/,"").split("/");return e.length<=2?t:`.../${e.slice(-2).join("/")}`}function Xg(t){const e=window.location.protocol,n=window.location.hostname;return`${e}//${n}:${t}`}function Y5({agentId:t,onClose:e}){const{t:n}=pt(["terminal","common"]),s=dx(),a=rr(),[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 E;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",_=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"&&((E=k.pm2)!=null&&E.enabled)?"View PM2 Logs":"Open",icon:k.type==="database"?"🗄️":k.type==="folder"?"📁":k.type==="terminal"?"💻":"👁️",onClick:()=>f(k.id)}),j&&(_||N.push({id:"start",label:"Start",icon:"▶",onClick:()=>H.sendBuildingCommand(k.id,"start")}),_&&(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 I of k.subordinateBuildingIds)H.sendBuildingCommand(I,"start")}}),N.push({id:"stop-all",label:"Stop All Subordinates",icon:"⏸️",onClick:()=>{for(const I of k.subordinateBuildingIds)H.sendBuildingCommand(I,"stop")}}),N.push({id:"restart-all",label:"Restart All Subordinates",icon:"♻️",onClick:()=>{for(const I of k.subordinateBuildingIds)H.sendBuildingCommand(I,"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 I=y();H.createBuilding({name:`${k.name} (Copy)`,type:k.type,style:k.style,color:k.color,scale:k.scale,position:I,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 I of k.urls)N.push({id:`url-${I.label}`,label:I.label,icon:"🔗",onClick:()=>window.open(I.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]),C=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((_,D)=>o.jsxs("a",{className:"guake-building-port-link",href:Xg(_),target:"_blank",rel:"noopener noreferrer",onClick:E=>E.stopPropagation(),title:`Open :${_} in browser`,children:[":",_,D<j.ports.length-1?" ":""]},_))})]},"pm2-ports"))}if(k.dockerStatus){const j=k.dockerStatus,_=[];if(j.status&&_.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":"";_.push(o.jsx("span",{className:`detail-value ${D}`,children:j.health},"h"))}if(j.memory!==void 0){const D=j.memoryLimit?`${Qg(j.memory)}/${Qg(j.memoryLimit)}`:Qg(j.memory);_.push(o.jsx("span",{className:"detail-value",children:D},"mem"))}j.cpu!==void 0&&_.push(o.jsxs("span",{className:"detail-value",children:[j.cpu.toFixed(1),"%"]},"cpu")),_.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Docker"}),_]},"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,E)=>o.jsxs("a",{className:"guake-building-port-link",href:Xg(D.host),target:"_blank",rel:"noopener noreferrer",onClick:I=>I.stopPropagation(),title:`Open :${D.host} in browser`,children:[D.host,":",D.container,E<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,_=j.activeConnectionId?j.connections.find(D=>D.id===j.activeConnectionId):j.connections[0];_&&(N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:_.engine.toUpperCase()}),o.jsxs("span",{className:"detail-value detail-mono",children:[_.host,":",_.port]})]},"db-conn")),(j.activeDatabase||_.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||_.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 _=0,D=0;for(const I of j){const O=s.get(I);(O==null?void 0:O.status)==="running"&&_++,(O==null?void 0:O.status)==="error"&&D++}const E=[];E.push(`${_}/${j.length} up`),D>0&&E.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":_===j.length?"detail-ok":""}`,children:E.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:Xg(j.port),target:"_blank",rel:"noopener noreferrer",onClick:_=>_.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:SA(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:SA(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 E,I;const N=TL[k.type],j=G5[k.status]||"❓",_=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})]}),C(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))}),_&&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"&&((E=k.terminalStatus)==null?void 0:E.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"&&((I=k.pm2)==null?void 0:I.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(go,{isOpen:r!==null,position:(r==null?void 0:r.position)||{x:0,y:0},worldPosition:{x:0,z:0},actions:S,onClose:x})]})}const Jg={action:"#cba6f7",wait:"#f9e2af",decision:"#89b4fa",end:"#a6e3a1"},hp={running:"#a6e3a1",paused:"#f9e2af",completed:"#89b4fa",failed:"#f38ba8",cancelled:"#6c7086"};function K5(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Q5(t){return new Date(t).toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function X5({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([Bt(Dt("/api/workflows/definitions")),Bt(Dt("/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,C=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:bt.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:bt.emptyState,children:o.jsx("span",{style:bt.loadingText,children:"Loading workflows..."})}),!i&&v.length===0&&o.jsxs("div",{style:bt.emptyState,children:[o.jsx("span",{style:bt.emptyIcon,children:"⊘"}),o.jsx("span",{children:"No workflow instances for this agent"})]}),v.length>0&&o.jsx("div",{style:bt.instanceList,children:v.map(k=>{const N=k.id===d,j=n.find(D=>D.id===k.workflowDefId),_=j==null?void 0:j.states.find(D=>D.id===k.currentStateId);return o.jsxs("button",{onClick:()=>f(k.id),style:{...bt.instanceRow,...N?bt.instanceRowSelected:{}},children:[o.jsxs("div",{style:bt.instanceRowTop,children:[o.jsx("span",{style:{...bt.statusDot,backgroundColor:hp[k.status]||"#6c7086"}}),o.jsx("span",{style:bt.instanceName,children:k.workflowName}),o.jsx("span",{style:{...bt.instanceStatus,color:hp[k.status]||"#6c7086"},children:k.status})]}),o.jsxs("div",{style:bt.instanceRowBottom,children:[o.jsx("span",{style:bt.instanceState,children:(_==null?void 0:_.name)||k.currentStateId}),o.jsx("span",{style:bt.instanceTime,children:Q5(k.updatedAt)})]})]},k.id)})}),S&&C&&o.jsx(J5,{definition:C,instance:S,onRefresh:m})]})]})}function J5({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:bt.instanceView,children:[o.jsxs("div",{style:bt.statusBar,children:[o.jsx("span",{style:{...bt.statusBadge,color:hp[e.status]||"#6c7086",borderColor:hp[e.status]||"#6c7086"},children:e.status}),o.jsxs("span",{style:bt.currentLabel,children:["Current: ",o.jsx("strong",{children:(s==null?void 0:s.name)||e.currentStateId})]})]}),o.jsx(Z5,{definition:t,instance:e,onRefresh:n}),o.jsx("div",{style:bt.tabs,children:["states","timeline","variables"].map(i=>o.jsx("button",{onClick:()=>r(i),style:{...bt.tab,...a===i?bt.tabActive:{}},children:i==="states"?"States":i==="timeline"?"Timeline":"Variables"},i))}),o.jsxs("div",{style:bt.tabContent,children:[a==="states"&&o.jsx(eW,{definition:t,currentStateId:e.currentStateId}),a==="timeline"&&o.jsx(tW,{definition:t,instance:e}),a==="variables"&&o.jsx(nW,{variables:e.variables})]})]})}function Z5({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 Bt(Dt(`/api/workflows/instances/${e.id}/available-transitions`));if(y.ok){const S=((await y.json()).transitions||[]).map(C=>{const k=t.states.find(N=>N.id===C.targetStateId);return{...C,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 Bt(Dt(`/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:bt.transitionSection,children:o.jsx("span",{style:bt.loadingText,children:"Loading transitions..."})}):s.length===0?null:o.jsxs("div",{style:bt.transitionSection,children:[o.jsx("div",{style:bt.transitionLabel,children:"Available Transitions"}),o.jsx("div",{style:bt.transitionButtons,children:s.map(y=>o.jsxs("button",{onClick:()=>x(y.targetStateId),disabled:c!==null,style:{...bt.transitionBtn,opacity:c===y.targetStateId?.6:1},title:`${y.name} → ${y.targetStateName||y.targetStateId}`,children:[c===y.targetStateId?"...":y.name,o.jsxs("span",{style:bt.transitionArrow,children:["→"," ",y.targetStateName||y.targetStateId]})]},y.id))}),f&&o.jsx("div",{style:bt.transitionError,children:f})]})}function eW({definition:t,currentStateId:e}){return o.jsx("div",{style:bt.stateList,children:t.states.map(n=>{const s=n.id===e;return o.jsxs("div",{style:{...bt.stateItem,...s?bt.stateItemCurrent:{}},children:[o.jsxs("div",{style:bt.stateHeader,children:[o.jsx("span",{style:{...bt.stateTypeBadge,backgroundColor:`${Jg[n.type]}22`,color:Jg[n.type],borderColor:`${Jg[n.type]}44`},children:n.type}),o.jsx("span",{style:bt.stateName,children:n.name}),s&&o.jsx("span",{style:bt.currentBadge,children:"CURRENT"})]}),n.description&&o.jsx("div",{style:bt.stateDescription,children:n.description}),n.transitions.length>0&&o.jsx("div",{style:bt.stateTransitions,children:n.transitions.map(a=>{var r;return o.jsxs("span",{style:bt.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 tW({definition:t,instance:e}){return!e.history||e.history.length===0?o.jsx("div",{style:bt.emptyState,children:"No timeline events yet"}):o.jsx("div",{style:bt.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:bt.timelineEntry,children:[o.jsx("div",{style:bt.timelineDot}),o.jsxs("div",{style:bt.timelineContent,children:[o.jsxs("div",{style:bt.timelineHeader,children:[o.jsx("span",{style:bt.timelineTime,children:K5(n.timestamp)}),n.transitionName&&o.jsxs("span",{style:bt.timelineTransition,children:["via ",n.transitionName]})]}),o.jsxs("div",{style:bt.timelineStates,children:[r&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:bt.timelineStateName,children:r.name}),o.jsx("span",{style:bt.timelineArrow,children:"→"})]}),o.jsx("span",{style:{...bt.timelineStateName,fontWeight:600},children:(a==null?void 0:a.name)||n.toStateId})]}),n.details&&o.jsx("div",{style:bt.timelineDetails,children:n.details})]})]},s)})})}function nW({variables:t}){const e=Object.entries(t);if(e.length===0)return o.jsx("div",{style:bt.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:bt.variablesSection,children:[n.length>0&&o.jsxs("div",{style:bt.varGroup,children:[o.jsx("div",{style:bt.varGroupLabel,children:"Variables"}),n.map(([a,r])=>o.jsxs("div",{style:bt.varRow,children:[o.jsx("span",{style:bt.varKey,children:a}),o.jsx("span",{style:bt.varValue,children:typeof r=="object"?JSON.stringify(r):String(r??"")})]},a))]}),s.length>0&&o.jsxs("div",{style:bt.varGroup,children:[o.jsx("div",{style:bt.varGroupLabel,children:"Internal"}),s.map(([a,r])=>o.jsxs("div",{style:bt.varRow,children:[o.jsx("span",{style:{...bt.varKey,opacity:.6},children:a}),o.jsx("span",{style:{...bt.varValue,opacity:.6},children:typeof r=="object"?JSON.stringify(r):String(r??"")})]},a))]})]})}const bt={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"}},sW=b.memo(function(){const{t:e}=pt(["terminal"]),[n,s]=b.useState(!1),[a,r]=b.useState(()=>Yx()),[i,c]=b.useState(-1),d=b.useRef(null),f=b.useRef(null),h=Js.findIndex(S=>S.id===a);b.useEffect(()=>{if(!n)return;const S=C=>{d.current&&!d.current.contains(C.target)&&s(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n]),b.useEffect(()=>{n&&c(h)},[n,h]);const m=S=>{const C=S==="next"?(h+1)%Js.length:(h-1+Js.length)%Js.length,k=Js[C],N=du(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=C=>{var k,N;C.key==="Escape"?(s(!1),(k=f.current)==null||k.focus()):C.key==="ArrowDown"?(C.preventDefault(),c(j=>(j+1)%Js.length)):C.key==="ArrowUp"?(C.preventDefault(),c(j=>(j-1+Js.length)%Js.length)):C.key==="Enter"&&i>=0&&(C.preventDefault(),y(Js[i].id),(N=f.current)==null||N.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[n,i]);const y=S=>{const C=du(S);lp(C),r(S),s(!1)},v=du(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:Js.map((S,C)=>o.jsxs("button",{className:`theme-selector-option ${S.id===a?"active":""} ${C===i?"highlighted":""}`,onClick:k=>{k.stopPropagation(),y(S.id)},onMouseDown:k=>k.stopPropagation(),onMouseEnter:()=>c(C),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))})]})]})}),CA=48,aW=49,rW=50,AA=48,iW={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 oW(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 jA(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),NA(t)}):(Gt("navigator.clipboard not available, using fallback"),NA(t))}function NA(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 Gb=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]=AA,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,C=null,k=null;return(async()=>{Gt("Lazy-loading xterm.js modules...");const[N,j,_,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 E=N.Terminal,I=j.FitAddon,O=_.ClipboardAddon,T=D.WebLinksAddon;x=new E({theme:iW,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 I,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)),jA(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(";"),z=Y.length>1?Y.slice(1).join(";"):Y[0];if(z)try{const Q=Uint8Array.from(atob(z),q=>q.charCodeAt(0)),K=new TextDecoder().decode(Q);Gt("OSC 52 decoded:",K.slice(0,50)),jA(K)}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 z=new Uint8Array(V.length+1);z[0]=AA;for(let Q=0;Q<V.length;Q++)z[Q+1]=V.charCodeAt(Q);Y.send(z)}),S=oW(()=>{y&&x&&(y.fit(),h(x.cols,x.rows))},100),C=new ResizeObserver(()=>S()),C.observe(s.current);const R=e.endsWith("/")?e.slice(0,-1):e,B=mb(`${R}/token`);Gt("Fetching ttyd token from:",B);let $="";try{const V=await fetch(B);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=mb(`${R}/ws`),F=`${U}//${window.location.host}${L}`;Gt("Connecting WebSocket to:",F),v=new WebSocket(F,["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,z=V.data instanceof ArrayBuffer?V.data.byteLength:V.data.length;if(Gt(`WS message #${W}: type=${Y} size=${z}`),V.data instanceof ArrayBuffer){const Q=new Uint8Array(V.data).slice(0,20);Gt(` First bytes: [${Array.from(Q).join(", ")}]`)}}if(V.data instanceof ArrayBuffer){const Y=new Uint8Array(V.data);if(Y.length<1)return;const z=Y[0];z===CA?x.write(Y.subarray(1)):z===aW?Gt("Received SET_TITLE"):z===rW?Gt("Received SET_PREFS:",new TextDecoder().decode(Y.subarray(1))):Gt("Unknown binary cmd:",z,"char:",String.fromCharCode(z))}else typeof V.data=="string"&&(W<=5&&Gt("String message, first char code:",V.data.charCodeAt(0)),V.data.charCodeAt(0)===CA&&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(),C==null||C.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"}})}),lW=[{key:"working",title:"Working",emptyLabel:"No agents",toneClass:"working"},{key:"waiting-subordinates",title:"Waiting Subordinates",emptyLabel:"No agents",toneClass:"waiting-subordinates"},{key:"need-review",title:"Need Review",emptyLabel:"No agents",toneClass:"need-review"},{key:"blocked",title:"Blocked",emptyLabel:"No agents",toneClass:"blocked"},{key:"can-clear-context",title:"Can Clear Context",emptyLabel:"No agents",toneClass:"can-clear-context"}];function cW({activeAgentId:t,onSelectAgent:e}){const{t:n}=pt(["terminal","common"]),[s]=ix(),a=YO(),[r,i]=b.useState(new Set),c=b.useMemo(()=>lW.map(y=>{const v=a[y.key].filter(S=>{if(!s)return!0;const C=H.getAreaForAgent(S.id);return xp((C==null?void 0:C.id)??null)}).sort((S,C)=>(C.trackingStatusTimestamp||0)-(S.trackingStatusTimestamp||0));return{...y,agents:v}}),[s,a]),d=b.useCallback(async y=>{try{const v=await Bt(Dt(`/api/agents/${y}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({trackingStatus:null})});if(!v.ok)throw new Error(`Failed to clear tracking status: ${v.statusText}`);const S=H.getState().agents.get(y);S&&H.updateAgent({...S,trackingStatus:null,trackingStatusDetail:void 0,trackingStatusTimestamp:void 0})}catch(v){console.error("Failed to clear tracking status",v)}},[]),f=b.useCallback(async y=>{i(v=>new Set(v).add(y.id));try{await d(y.id)}finally{i(v=>{const S=new Set(v);return S.delete(y.id),S})}},[d]),[h,m]=b.useState(null),x=b.useCallback(async(y,v)=>{if(v.length!==0){m(y),i(S=>{const C=new Set(S);return v.forEach(k=>C.add(k.id)),C});try{for(const S of v)y==="can-clear-context"&&H.clearContext(S.id),await d(S.id)}finally{m(null),i(S=>{const C=new Set(S);return v.forEach(k=>C.delete(k.id)),C})}}},[d]);return o.jsx("div",{className:"tracking-board",children:c.map(y=>o.jsxs("section",{className:`tracking-board-column tracking-board-column--${y.toneClass}`,children:[o.jsxs("header",{className:"tracking-board-column-header",children:[o.jsx("span",{className:"tracking-board-column-indicator"}),o.jsx("span",{className:"tracking-board-column-title",children:y.title}),y.agents.length>0&&o.jsx("button",{type:"button",className:`tracking-board-column-action${y.key==="can-clear-context"?" tracking-board-column-action--context":""}`,onClick:()=>void x(y.key,y.agents),disabled:h===y.key,title:y.key==="can-clear-context"?"Clear context and status for all agents":"Clear status for all agents in this column",children:h===y.key?"Clearing...":y.key==="can-clear-context"?`Clear All (${y.agents.length})`:"Clear all"}),o.jsx("span",{className:"tracking-board-column-count",children:y.agents.length})]}),o.jsx("div",{className:"tracking-board-column-body",children:y.agents.length===0?o.jsx("div",{className:"tracking-board-empty",children:y.emptyLabel}):y.agents.map(v=>o.jsx(uW,{agent:v,isActive:v.id===t,isClearing:r.has(v.id),onSelectAgent:e,onClearStatus:f,timeLabel:v.trackingStatusTimestamp?gp(v.trackingStatusTimestamp):n("common:time.justNow",{defaultValue:"just now"})},v.id))})]},y.key))})}function uW({agent:t,isActive:e,isClearing:n,onSelectAgent:s,onClearStatus:a,timeLabel:r}){const i=Pa(),c=Ia(t.class,i);return o.jsxs("article",{className:`tracking-board-card${e?" active":""}`,onClick:()=>s(t.id),title:t.trackingStatusDetail||t.taskLabel||t.name,children:[o.jsxs("div",{className:"tracking-board-card-header",children:[o.jsxs("div",{className:"tracking-board-card-identity",children:[o.jsx("span",{className:"tracking-board-card-class-icon",style:{color:c.color},"aria-hidden":"true",children:c.icon}),o.jsx("span",{className:"tracking-board-card-name",children:t.name})]}),o.jsx("button",{type:"button",className:"tracking-board-card-clear",onClick:d=>{d.stopPropagation(),a(t)},disabled:n,title:"Clear tracking status","aria-label":"Clear tracking status",children:"×"})]}),t.taskLabel&&o.jsx("div",{className:"tracking-board-card-task",title:t.taskLabel,children:t.taskLabel}),o.jsx("div",{className:"tracking-board-card-detail",children:t.trackingStatusDetail||t.currentTask||"No detail provided"}),o.jsxs("div",{className:"tracking-board-card-footer",children:[o.jsx("span",{className:"tracking-board-card-class",children:t.class}),o.jsx("span",{className:"tracking-board-card-time",children:r})]})]})}const dW=128,fW=95;function pW(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 hW=1;function vf(){return`bp-${hW++}`}const mW=b.memo(function({buildingId:e,filterText:n,maxRetention:s}){const{streamingBuildingLogs:a}=Ns(),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 _=j.scrollTop+j.clientHeight>=j.scrollHeight-h;c.current=!_},[]),x=b.useMemo(()=>Nj(r,s),[r,s]);b.useLayoutEffect(()=>{const j=i.current;if(!j)return;const _=d.current,D=j.scrollHeight;if(c.current){const E=_-D;E>0&&(j.scrollTop=Math.max(0,j.scrollTop-E))}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=>Sl(j||" ")),[v]),C=b.useMemo(()=>x?f&&!y?"No log lines match the current filter.":null:"Waiting for logs...",[x,f,y]),k=d1({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:C?o.jsx("div",{className:"guake-bottom-pm2-logs-empty",children:C}):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 gW=b.memo(function({onSaveSnapshot:e}={}){var ur,$l,So,Hl,Gr,oa,Co,Yr,Na,Ao,Mi,Ul,Di;const{t:n}=pt(["terminal","common"]),s=Dl(),a=cx(),r=Rj(),i=Oj(),c=fx(),d=px(),f=hL(),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,C=(lx(v)||null)??(h?m:null),k=v??(h?(f==null?void 0:f.agentId)??null:null),N=wL(),j=rr(),_=dx(),D=b.useMemo(()=>{if(!k)return null;const te=new Set,Ne=[];for(const $e of j.values())$e.archived||$e.directories.length===0||$e.assignedAgentIds.includes(k)&&(te.add($e.id),Ne.push($e));const pe=s.get(k);if(pe)for(const $e of j.values())$e.archived||$e.directories.length===0||te.has($e.id)||pW({x:pe.position.x,z:pe.position.z},$e)&&(te.add($e.id),Ne.push($e));return Ne.length===0?null:Ne.flatMap($e=>$e.directories.filter(gt=>gt&&gt.trim().length>0).map(gt=>({areaId:$e.id,areaName:$e.name,dir:gt})))},[k,j,s]),E=b.useMemo(()=>{var pe;if(!k)return[];const te=H.getAreaForAgent(k);if(!te)return[];const Ne=[];for(const $e of _.values())$e.type==="terminal"&&H.isPositionInArea($e.position,te)&&Ne.push({id:$e.id,name:$e.name,hasUrl:!!((pe=$e.terminalStatus)!=null&&pe.url)});return Ne},[k,_,j]),I=b.useMemo(()=>{var pe;if(!k)return[];const te=H.getAreaForAgent(k);if(!te)return[];const Ne=[];for(const $e of _.values())$e.type==="server"&&((pe=$e.pm2)!=null&&pe.enabled)&&H.isPositionInArea($e.position,te)&&Ne.push({id:$e.id,name:$e.name});return Ne},[k,_,j]),O=b.useMemo(()=>{if(!k)return[];const te=H.getAreaForAgent(k);if(!te)return[];const Ne=[];for(const pe of _.values())pe.type==="database"&&pe.database&&H.isPositionInArea(pe.position,te)&&Ne.push({id:pe.id,name:pe.name});return Ne},[k,_,j]),{branches:T,fetchRemote:M,fetchingDirs:R}=VU(D),{terminalHeight:B,terminalRef:$,handleResizeStart:U}=zU(),{mobileOverviewHeight:L,handleResizeMouseDown:F,handleResizeTouchStart:W}=UU(),V=FU(),[Y,z]=b.useState(()=>{const te=Jb(ft.SIDE_PANEL_WIDTH,420);return Math.max(280,Math.min(700,te))}),Q=b.useRef(null),K=b.useCallback((te,Ne)=>{te.preventDefault(),Q.current={startX:te.clientX,startW:Y},document.body.style.cursor="ew-resize",document.body.style.userSelect="none",H.setTerminalResizing(!0);let pe=Y;const $e=Tt=>{if(!Q.current)return;const Sn=Tt.clientX-Q.current.startX,tn=Ne==="left"?-Sn:Sn;pe=Math.max(280,Math.min(700,Q.current.startW+tn)),z(pe)},gt=()=>{Q.current=null,document.body.style.cursor="",document.body.style.userSelect="",H.setTerminalResizing(!1),document.removeEventListener("mousemove",$e),document.removeEventListener("mouseup",gt),Zb(ft.SIDE_PANEL_WIDTH,pe)};document.addEventListener("mousemove",$e),document.addEventListener("mouseup",gt)},[Y]),q=b.useRef(null),xe=b.useRef(null),[de,ee]=b.useState(()=>{const te=va(ft.VIEW_MODE);return te==="simple"||te==="chat"||te==="advanced"?te:va(ft.ADVANCED_VIEW)==="true"?"advanced":"simple"}),[fe,je]=b.useState(()=>_r(ft.TERMINAL_FULLSCREEN,!1)),[ge,Ee]=b.useState(null),[Be,Ve]=b.useState(null),[J,ne]=b.useState(null),[Te,qe]=b.useState(null),[at,Se]=b.useState(!1);Qt("guake-image-modal",ge!==null,()=>Ee(null)),Qt("guake-bash-modal",Be!==null,()=>Ve(null)),Qt("guake-response-modal",Te!==null,()=>qe(null)),Qt("guake-context-confirm",J!==null,()=>ne(null)),Qt("guake-agent-info",at,()=>Se(!1));const[Fe,ie]=b.useState(!1),[he,We]=b.useState(()=>hs.isEnabled()),[st,ut]=b.useState(()=>_r(ft.GIT_PANEL_OPEN,!1)),ue=b.useCallback(te=>{ut(te),Qa(ft.GIT_PANEL_OPEN,te)},[]),[X,ae]=b.useState(()=>_r(ft.BUILDINGS_PANEL_OPEN,!1)),we=b.useCallback(te=>{ae(te),Qa(ft.BUILDINGS_PANEL_OPEN,te)},[]),[Z,ve]=b.useState(()=>_r(ft.WORKFLOW_PANEL_OPEN,!1)),He=b.useCallback(te=>{ve(te),Qa(ft.WORKFLOW_PANEL_OPEN,te)},[]),[Pe,oe]=b.useState(!1);b.useEffect(()=>{if(!k){oe(!1);return}let te=!1;return(async()=>{try{const Ne=await Bt(Dt("/api/workflows/definitions"));if(te||!Ne.ok)return;const $e=(await Ne.json()).some(gt=>gt.states.some(Tt=>{var Sn,tn;return((Sn=Tt.action)==null?void 0:Sn.type)==="agent_task"&&((tn=Tt.action)==null?void 0:tn.agentId)===k}));te||oe($e)}catch{te||oe(!1)}})(),()=>{te=!0}},[k]);const Le=vL(),le=b.useCallback(te=>H.setOverviewPanelOpen(te),[]),[me,se]=b.useState([]),[Re,Ke]=b.useState({}),[ze,tt]=b.useState(()=>jj()),[ot,nt]=b.useState(()=>{try{return localStorage.getItem("tide:bottom-split-direction")==="vertical"?"vertical":"horizontal"}catch{return"horizontal"}}),[lt,it]=b.useState(()=>{try{const te=localStorage.getItem("tide:bottom-terminal-height");return te?Math.max(120,Math.min(600,Number(te))):250}catch{return 250}}),ht=b.useRef(null),[jt,be]=b.useState([1]),_e=b.useRef(null),Ge=b.useRef(null),[et,Nt]=b.useState(null),[zt,Lt]=b.useState(null),Pt=b.useMemo(()=>me.filter(te=>te.areaId===zt),[me,zt]),Vt=b.useMemo(()=>new Set(Pt.map(te=>te.buildingId)),[Pt]),mt=b.useRef(new Map);b.useEffect(()=>{try{const te=localStorage.getItem("tide:bottom-panels-v2");if(te){const Ne=JSON.parse(te);mt.current=new Map(Ne.map(([pe,$e])=>[pe,$e.map(gt=>({id:gt.id??vf(),type:gt.type,buildingId:gt.buildingId}))]))}else{const Ne=localStorage.getItem("tide:bottom-terminals");if(Ne){const pe=JSON.parse(Ne);for(const[$e,gt]of pe)mt.current.set($e,[{id:vf(),type:"terminal",buildingId:gt}])}}}catch{}},[]);const ct=b.useCallback(te=>{if(!k)return;const Ne=H.getAreaForAgent(k);if(Ne)try{te.length>0?mt.current.set(Ne.id,te.map($e=>({id:$e.id,type:$e.type,buildingId:$e.buildingId}))):mt.current.delete(Ne.id);const pe=Array.from(mt.current.entries());localStorage.setItem("tide:bottom-panels-v2",JSON.stringify(pe))}catch{}},[k]),xt=b.useCallback(()=>{if(!k)return null;const te=H.getAreaForAgent(k);return(te==null?void 0:te.id)??null},[k]),Mt=b.useCallback((te,Ne)=>{const pe=xt();Ke({}),se($e=>{for(const tn of $e)tn.areaId===pe&&tn.type==="pm2-logs"&&H.stopLogStreaming(tn.buildingId);const gt=$e.filter(tn=>tn.areaId!==pe),Tt={id:vf(),type:Ne,buildingId:te,areaId:pe??void 0},Sn=[...gt,Tt];return ct([Tt]),Sn})},[ct,xt]),kn=b.useCallback((te,Ne,pe)=>{const $e=xt();nt(pe);try{localStorage.setItem("tide:bottom-split-direction",pe)}catch{}se(gt=>{const Tt=gt.filter($n=>$n.areaId===$e);if(Tt.length>=4||Tt.some($n=>$n.buildingId===te))return gt;const Sn={id:vf(),type:Ne,buildingId:te,areaId:$e??void 0},tn=[...gt,Sn];return ct(Tt.concat(Sn)),tn})},[ct,xt]),cn=b.useCallback(te=>{Ke(Ne=>{if(!(te in Ne))return Ne;const pe={...Ne};return delete pe[te],pe}),se(Ne=>{const pe=Ne.find(Tt=>Tt.id===te);(pe==null?void 0:pe.type)==="pm2-logs"&&H.stopLogStreaming(pe.buildingId);const $e=Ne.filter(Tt=>Tt.id!==te),gt=pe==null?void 0:pe.areaId;return gt&&ct($e.filter(Tt=>Tt.areaId===gt)),$e})},[ct]);b.useCallback(()=>{Ke({}),se(te=>{for(const Ne of te)Ne.type==="pm2-logs"&&H.stopLogStreaming(Ne.buildingId);return ct([]),[]})},[ct]),b.useEffect(()=>{if(!k){Lt(null);return}const te=H.getAreaForAgent(k);if(!te){Lt(null);return}Lt(te.id),se(Ne=>{if(Ne.filter(Tt=>Tt.areaId===te.id).length>0)return Ne;const $e=mt.current.get(te.id);if(!$e||$e.length===0)return Ne;const gt=$e.map(Tt=>({id:Tt.id,type:Tt.type,buildingId:Tt.buildingId,areaId:te.id}));return[...Ne,...gt]})},[k]),b.useEffect(()=>{const te=Ne=>{const pe=Ne.detail;pe!=null&&pe.buildingId&&Mt(pe.buildingId,"terminal")};return window.addEventListener("tide:open-bottom-terminal",te),()=>window.removeEventListener("tide:open-bottom-terminal",te)},[Mt]),b.useEffect(()=>{const te=Ne=>{const pe=Ne.detail;pe!=null&&pe.buildingId&&Mt(pe.buildingId,"pm2-logs")};return window.addEventListener("tide:open-bottom-pm2-logs",te),()=>window.removeEventListener("tide:open-bottom-pm2-logs",te)},[Mt]),b.useEffect(()=>{const te=Ne=>{const pe=Ne.detail;pe!=null&&pe.buildingId&&Mt(pe.buildingId,"database")};return window.addEventListener("tide:open-bottom-database",te),()=>window.removeEventListener("tide:open-bottom-database",te)},[Mt]),b.useEffect(()=>{const te=Ne=>{const pe=Ne.detail;pe!=null&&pe.buildingId&&(pe!=null&&pe.type)&&(pe!=null&&pe.direction)&&(Pt.length===0?Mt(pe.buildingId,pe.type):kn(pe.buildingId,pe.type,pe.direction))};return window.addEventListener("tide:split-bottom-panel",te),()=>window.removeEventListener("tide:split-bottom-panel",te)},[Pt.length,Mt,kn]),b.useEffect(()=>{be(te=>te.length===Pt.length?te:Pt.length<=1?[1]:(Pt.length>te.length,Array(Pt.length).fill(1)))},[Pt.length]);const ls=b.useCallback((te,Ne)=>{var $n;te.preventDefault();const pe=ot==="horizontal";_e.current={index:Ne,startPos:pe?te.clientX:te.clientY,startRatios:[...jt]},document.body.style.cursor=pe?"col-resize":"row-resize",document.body.style.userSelect="none";const $e=($n=Ge.current)==null?void 0:$n.querySelectorAll("iframe");$e==null||$e.forEach(es=>es.style.pointerEvents="none");const gt=Ge.current,Tt=gt?pe?gt.offsetWidth:gt.offsetHeight:1,Sn=es=>{const Ms=_e.current;if(!Ms||!gt)return;const $p=(pe?es.clientX:es.clientY)-Ms.startPos,zu=Ms.startRatios.reduce((Hp,Up)=>Hp+Up,0),$u=$p/Tt*zu,Ri=[...Ms.startRatios],Hu=.1*zu;Ri[Ne]=Math.max(Hu,Ms.startRatios[Ne]+$u),Ri[Ne+1]=Math.max(Hu,Ms.startRatios[Ne+1]-$u),be(Ri)},tn=()=>{_e.current=null,document.body.style.cursor="",document.body.style.userSelect="",$e==null||$e.forEach(es=>es.style.pointerEvents=""),document.removeEventListener("mousemove",Sn),document.removeEventListener("mouseup",tn)};document.addEventListener("mousemove",Sn),document.addEventListener("mouseup",tn)},[ot,jt]),Ba=b.useRef(new Set);b.useEffect(()=>{const te=new Set(me.filter(Ne=>Ne.type==="pm2-logs").map(Ne=>Ne.buildingId));for(const Ne of te)Ba.current.has(Ne)||H.startLogStreaming(Ne,200);Ba.current=te},[me]);const Ts=b.useRef(new Set);b.useEffect(()=>{var pe;const te=me.filter($e=>$e.type==="terminal");for(const $e of te){const gt=_.get($e.buildingId);!!((pe=gt==null?void 0:gt.terminalStatus)!=null&&pe.url)?Ts.current.add($e.buildingId):Ts.current.has($e.buildingId)&&(Ts.current.delete($e.buildingId),cn($e.id))}const Ne=new Set(te.map($e=>$e.buildingId));for(const $e of Ts.current)Ne.has($e)||Ts.current.delete($e)},[me,_,cn]);const Hs=b.useCallback(te=>{te.preventDefault(),ht.current={startY:te.clientY,startH:lt};let Ne=lt;const pe=gt=>{if(!ht.current)return;const Tt=ht.current.startY-gt.clientY;Ne=Math.max(120,Math.min(600,ht.current.startH+Tt)),it(Ne)},$e=()=>{ht.current=null,document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",$e);try{localStorage.setItem("tide:bottom-terminal-height",String(Ne))}catch{}};document.addEventListener("mousemove",pe),document.addEventListener("mouseup",$e)},[lt]),[Fa,ws]=b.useState(!1),Zn=b.useRef(0),Et=r&&C!==null,rs=b.useRef([]),fn=b.useRef(-1),cr=b.useRef(!1),Hr=b.useRef(!1),_s=b.useRef(!1),Es=b.useRef(null),[_i,wo]=b.useState(!1),[Ur,Il]=b.useState(!1),gs=b.useCallback(()=>{const te=rs.current,Ne=fn.current;wo(Ne>0),Il(Ne>=0&&Ne<te.length-1)},[]),Ca=b.useCallback(te=>{const Ne=rs.current;if(Ne.length===0)return;let pe=fn.current+te;for(;pe>=0&&pe<Ne.length;){const $e=Ne[pe];if(s.has($e)){cr.current=!0,fn.current=pe,gs(),H.selectAgent($e);return}pe+=te}},[s,gs]),cs=b.useCallback(()=>{Ca(-1)},[Ca]),Vn=b.useCallback(()=>{Ca(1)},[Ca]),Wr=b.useCallback((te,Ne)=>{if(typeof window>"u")return;const pe=window.history.state,gt={...typeof pe=="object"&&pe!==null?pe:{},__guakeAgentNav:{agentId:te}};Ne==="replace"?window.history.replaceState(gt,"",window.location.href):window.history.pushState(gt,"",window.location.href)},[]),Ae=b.useCallback(()=>{je(te=>{const Ne=!te;return Qa(ft.TERMINAL_FULLSCREEN,Ne),Ne})},[]),Xe=WU({agents:s,selectedAgentId:k,isOpen:Et,overviewPanelOpen:Le,loadingHistory:((ur=q.current)==null?void 0:ur.historyLoader.fetchingHistory)??!1,hasModalOpen:!!(ge||Be||Te||c||d),outputRef:(($l=q.current)==null?void 0:$l.outputScrollRef)??{current:null}});b.useEffect(()=>{const te=$.current;if(!te||!Et)return;const Ne=$e=>{$e.button===3?($e.preventDefault(),$e.stopPropagation(),cs()):$e.button===4&&($e.preventDefault(),$e.stopPropagation(),Vn())},pe=$e=>{($e.button===3||$e.button===4)&&$e.preventDefault()};return te.addEventListener("mouseup",Ne),te.addEventListener("mousedown",pe),()=>{te.removeEventListener("mouseup",Ne),te.removeEventListener("mousedown",pe)}},[Et,cs,Vn]);const Ct=b.useCallback(te=>{H.setLastSelectionViaDirectClick(!0),H.selectAgent(te)},[]),en=typeof window<"u"&&window.innerWidth<=768&&Le&&Et,Ln=sR({gestureRef:((So=q.current)==null?void 0:So.outputScrollRef)??{current:null},agentListRef:xe,enabled:en,onSelect:Ct});b.useEffect(()=>{Fe&&!he&&(We(!0),hs.setEnabled(!0))},[Fe,he]),b.useEffect(()=>{Et||Se(!1)},[Et]),b.useEffect(()=>{var Ne;if(!(Be!=null&&Be.isLive)||!Be.command)return;const te=((Ne=q.current)==null?void 0:Ne.getDedupedHistory())??[];for(const pe of te)if(pe._bashCommand===Be.command&&pe._bashOutput){Ve({command:Be.command,output:pe._bashOutput,isLive:!1});return}},[Be]);const $t=b.useCallback((te,Ne)=>{Ee({url:te,name:Ne})},[]),At=b.useCallback((te,Ne)=>{const pe=Tp(te,C==null?void 0:C.cwd),$e=pe.line?{...Ne||{},targetLine:pe.line}:Ne;H.setFileViewerPath(pe.path,$e,C==null?void 0:C.cwd)},[C==null?void 0:C.cwd]),Nn=b.useCallback((te,Ne)=>{Ve({command:te,output:Ne,isLive:Ne==="Running..."})},[]),ks=b.useCallback(te=>{qe(te)},[]),Pn=b.useCallback(()=>{Se(te=>!te)},[]),[Us,Aa]=b.useState(0),[ia,Bl]=b.useState(!1),Iu=b.useCallback(()=>{typeof window>"u"||window.innerWidth>768||(Bl(!0),Aa(dW),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),setTimeout(()=>{H.setMobileView("3d"),Bl(!1),Aa(0)},fW))},[]),Bu=b.useCallback(te=>{ia||Aa(te)},[ia]);b.useEffect(()=>{Aa(0),Bl(!1)},[k]),b.useEffect(()=>{if(!k){rs.current=[],fn.current=-1,gs(),_s.current=!1,Es.current=null;return}const te=rs.current;if(cr.current){cr.current=!1,gs();return}const Ne=fn.current;if(Ne>=0&&te[Ne]===k){gs();return}const pe=Ne<te.length-1?te.slice(0,Ne+1):te.slice();pe.push(k),pe.length>100&&pe.shift(),rs.current=pe,fn.current=pe.length-1,gs()},[k,gs]),b.useEffect(()=>{if(!(!Et||!k)){if(!_s.current){Wr(k,"replace"),_s.current=!0,Es.current=k;return}if(Hr.current){Hr.current=!1,Es.current=k;return}Es.current!==k&&(Wr(k,"push"),Es.current=k)}},[Et,k,Wr]),b.useEffect(()=>{if(!Et)return;const te=Ne=>{var Tt,Sn;const pe=(Sn=(Tt=Ne.state)==null?void 0:Tt.__guakeAgentNav)==null?void 0:Sn.agentId;if(!pe||typeof pe!="string"||!s.has(pe)||pe===v)return;Hr.current=!0,cr.current=!0;const $e=rs.current,gt=$e.lastIndexOf(pe);gt>=0?fn.current=gt:($e.push(pe),fn.current=$e.length-1),gs(),H.selectAgent(pe)};return window.addEventListener("popstate",te),()=>window.removeEventListener("popstate",te)},[Et,s,v,gs]),b.useEffect(()=>{Et&&v&&H.clearUnseenForAgent(v)},[Et,v]);const ko=b.useRef(null);b.useLayoutEffect(()=>{const te=ko.current;te!==null&&te!==v&&H.getState().currentSnapshot&&H.setCurrentSnapshot(null),ko.current=v},[v]),b.useEffect(()=>{const te=Ne=>{if(Ne.key==="`"&&!Ne.ctrlKey&&!Ne.altKey&&C){const pe=Ne.target;pe.tagName!=="INPUT"&&pe.tagName!=="TEXTAREA"&&(Ne.preventDefault(),H.toggleTerminal())}};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[C]),b.useEffect(()=>{if(!Et)return;const te=Ne=>{Ne.altKey&&(Ne.key!=="ArrowLeft"&&Ne.key!=="ArrowRight"||(Ne.key==="ArrowLeft"&&_i?(Ne.preventDefault(),cs()):Ne.key==="ArrowRight"&&Ur&&(Ne.preventDefault(),Vn())))};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[Et,_i,Ur,cs,Vn]),b.useEffect(()=>{const te=Ne=>{var pe;Ne.key==="Escape"&&(c?(Ne.stopImmediatePropagation(),H.clearFileViewerPath()):d?(Ne.stopImmediatePropagation(),H.closeContextModal()):Te?(Ne.stopImmediatePropagation(),qe(null)):Be?(Ne.stopImmediatePropagation(),Ve(null)):ge?(Ne.stopImmediatePropagation(),Ee(null)):(pe=q.current)!=null&&pe.search.searchMode&&(Ne.stopImmediatePropagation(),q.current.search.closeSearch()))};return document.addEventListener("keydown",te,!0),()=>document.removeEventListener("keydown",te,!0)},[ge,Be,Te,c,d]);const Fu=b.useRef(Et),Ei=b.useRef(!1);b.useEffect(()=>{Fu.current=Et},[Et]),b.useEffect(()=>{if(window.innerWidth<=768)return;const Ne=gt=>{var $n;if(!(gt instanceof Element))return!1;const Tt=($n=$.current)==null?void 0:$n.contains(gt),Sn=gt.closest(".agent-bar"),tn=!!gt.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!!Tt||!!Sn||tn},pe=gt=>{if(!Fu.current){Ei.current=!1;return}if(ZD("terminal")){Ei.current=!1;return}Ei.current=!Ne(gt.target)},$e=gt=>{Ei.current&&(Ne(gt.target)||H.setTerminalOpen(!1),Ei.current=!1)};return document.addEventListener("mousedown",pe,!0),document.addEventListener("mouseup",$e,!0),()=>{document.removeEventListener("mousedown",pe,!0),document.removeEventListener("mouseup",$e,!0)}},[]),b.useEffect(()=>{const te=()=>{document.hidden&&V.cleanup()};return document.addEventListener("visibilitychange",te),()=>document.removeEventListener("visibilitychange",te)},[V]),b.useEffect(()=>()=>V.cleanup(),[k,V]);const qr=typeof window<"u"&&window.innerWidth<=768;if(!C)return qr&&i==="terminal"&&a.size===0?o.jsx("div",{ref:$,className:`guake-terminal open ${fe?"fullscreen":""}`,style:{"--terminal-height":`${B}%`},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")})]})})})}):qr&&i==="terminal"&&a.size>0?o.jsx("div",{ref:$,className:`guake-terminal open ${fe?"fullscreen":""}`,style:{"--terminal-height":`${B}%`},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 ja=te=>{te.preventDefault(),te.stopPropagation(),Zn.current++,te.dataTransfer.types.includes("Files")&&ws(!0)},Fl=te=>{te.preventDefault(),te.stopPropagation()},zl=te=>{te.preventDefault(),te.stopPropagation(),Zn.current--,Zn.current===0&&ws(!1)},Vr=async te=>{var pe,$e;te.preventDefault(),te.stopPropagation(),Zn.current=0,ws(!1);const Ne=te.dataTransfer.files;if(Ne.length)for(const gt of Ne){const Tt=await((pe=q.current)==null?void 0:pe.terminalInput.uploadFile(gt));Tt&&(($e=q.current)==null||$e.terminalInput.setAttachedFiles(Sn=>[...Sn,Tt]))}};return o.jsxs("div",{ref:$,className:`guake-terminal ${Et?"open":"collapsed"} ${fe&&Et?"fullscreen":""} ${Fe&&Et?"with-debug-panel":""} ${st&&Et?"with-git-panel":""} ${X&&Et?"with-buildings-panel":""} ${Z&&Et?"with-workflow-panel":""} ${N&&Et?"with-tracking-board":""} ${Le&&Et?"with-overview-panel":""} ${Fa?"drag-over":""} ${Us>0?"mobile-swipe-close-active":""} ${ia?"mobile-swipe-close-closing":""}`,style:{"--terminal-height":`${B}%`,"--mobile-swipe-close-offset":`${Us}px`,"--guake-side-panel-width":`${Y}px`,...L>0?{"--guake-mobile-overview-height":`${L}px`}:{}},onDragEnter:ja,onDragOver:Fl,onDragLeave:zl,onDrop:Vr,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&&Fe&&Et&&k&&o.jsx(k6,{agentId:k,onClose:()=>ie(!1)}),!h&&st&&Et&&k&&o.jsx(L6,{agentId:k,agents:s,onClose:()=>ue(!1),branchInfoMap:T,fetchRemote:M,fetchingDirs:R}),!h&&X&&Et&&k&&o.jsx(Y5,{agentId:k,onClose:()=>we(!1)}),!h&&Z&&Et&&k&&o.jsx(X5,{agentId:k,onClose:()=>He(!1)}),!h&&N&&Et&&k&&o.jsxs("div",{className:"guake-tracking-board-panel",children:[o.jsxs("div",{className:"guake-tracking-board-header",children:[o.jsxs("div",{className:"guake-tracking-board-title",children:[o.jsx("span",{className:"guake-tracking-board-icon",children:"▥"}),o.jsx("span",{children:"Tracking Board"})]}),o.jsx("button",{type:"button",className:"guake-tracking-board-close",onClick:()=>H.setTrackingBoardVisible(!1),title:"Close tracking board",children:"✕"})]}),o.jsx("div",{className:"guake-tracking-board-body",children:o.jsx(cW,{activeAgentId:k,onSelectAgent:te=>{H.setLastSelectionViaDirectClick(!0),H.selectAgent(te)}})})]}),!h&&(Fe||st||X||Z||N)&&Et&&o.jsx("div",{className:"guake-side-panel-resize right",onMouseDown:te=>K(te,"right")}),!h&&Le&&Et&&k&&o.jsx(Z6,{activeAgentId:k,onClose:()=>le(!1),onSelectAgent:te=>{H.setLastSelectionViaDirectClick(!0),H.selectAgent(te)},agentListRef:xe,twoFingerState:Ln}),!h&&Le&&Et&&k&&o.jsx("div",{className:"guake-side-panel-resize left",onMouseDown:te=>K(te,"left")}),!h&&Le&&Et&&k&&o.jsx("div",{className:"aop-resize-handle",onMouseDown:F,onTouchStart:W}),o.jsxs("div",{className:"guake-content",children:[o.jsx(f6,{selectedAgent:C,selectedAgentId:k,sortedAgents:Xe.sortedAgents,swipeOffset:Xe.swipeOffset,viewMode:de,setViewMode:ee,searchMode:((Hl=q.current)==null?void 0:Hl.search.searchMode)??!1,toggleSearch:((Gr=q.current)==null?void 0:Gr.search.toggleSearch)??(()=>{}),closeSearch:((oa=q.current)==null?void 0:oa.search.closeSearch)??(()=>{}),debugPanelOpen:Fe,setDebugPanelOpen:ie,debuggerEnabled:he,setDebuggerEnabled:We,gitPanelOpen:st,setGitPanelOpen:ue,buildingsPanelOpen:X,setBuildingsPanelOpen:we,workflowPanelOpen:Z,setWorkflowPanelOpen:He,hasWorkflow:Pe,trackingBoardVisible:N,setTrackingBoardVisible:te=>H.setTrackingBoardVisible(te),overviewPanelOpen:Le,setOverviewPanelOpen:le,agentInfoOpen:at,onToggleAgentInfo:Pn,isFullscreen:fe,onToggleFullscreen:Ae,onNavigateBack:cs,onNavigateForward:Vn,canNavigateBack:_i,canNavigateForward:Ur,outputsLength:((Co=q.current)==null?void 0:Co.outputsLength)??0,setContextConfirm:ne,headerRef:Xe.headerRef,onSaveSnapshot:h?void 0:e,isSnapshotView:h}),o.jsxs("div",{className:`guake-swipe-container ${Xe.swipeAnimationClass}`,style:Xe.swipeOffset!==0?{transform:`translateX(${Xe.swipeOffset*40}%)`}:void 0,children:[Xe.sortedAgents.length>1&&Xe.swipeOffset!==0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`swipe-indicator left ${Xe.swipeOffset>.3?"visible":""}`,children:[o.jsx("span",{className:"indicator-icon",children:"←"}),o.jsx("span",{className:"indicator-name",children:(Yr=Xe.nextAgent)==null?void 0:Yr.name})]}),o.jsxs("div",{className:`swipe-indicator right ${Xe.swipeOffset<-.3?"visible":""}`,children:[o.jsx("span",{className:"indicator-name",children:(Na=Xe.prevAgent)==null?void 0:Na.name}),o.jsx("span",{className:"indicator-icon",children:"→"})]})]}),Xe.sortedAgents.length>1&&Xe.sortedAgents.length<=8&&Xe.swipeOffset!==0&&o.jsx("div",{className:`swipe-dots ${Math.abs(Xe.swipeOffset)>.1?"visible":""}`,children:Xe.sortedAgents.map((te,Ne)=>o.jsx("div",{className:`swipe-dot ${Ne===Xe.currentAgentIndex?"active":""}`},te.id))}),o.jsx(V5,{activeAgentId:k,activeAgent:C,paneRef:q,viewMode:de,isOpen:Et,isSnapshotView:h,currentSnapshot:f,onImageClick:$t,onFileClick:At,onBashClick:Nn,onViewMarkdown:ks,keyboard:V,onSaveSnapshot:h?void 0:e,canSwipeClose:qr&&i==="terminal"&&!((Ao=q.current)!=null&&Ao.search.searchMode)&&!((Mi=q.current)!=null&&Mi.historyLoader.fetchingHistory),onSwipeCloseOffsetChange:Bu,onSwipeClose:Iu,hasModalOpen:!!(ge||Be||Te||c)})]}),o.jsxs("div",{className:"guake-agent-status-bar",children:[!h&&(C==null?void 0:C.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")]})}),(C==null?void 0:C.cwd)&&o.jsxs("span",{className:"guake-agent-cwd",title:C.cwd,children:["📁 ",C.cwd.split("/").filter(Boolean).slice(-2).join("/")||C.cwd]}),D&&D.map(({areaId:te,areaName:Ne,dir:pe})=>{const $e=T.get(pe),gt=R.has(pe);return o.jsxs("span",{className:"guake-agent-area-dir",title:`${Ne}: ${pe}${$e?` (${$e.branch}${$e.ahead?` ↑${$e.ahead}`:""}${$e.behind?` ↓${$e.behind}`:""})`:""}`,onClick:()=>H.openFileExplorerForAreaFolder(te,pe),children:["📂 ",pe.split("/").filter(Boolean).pop()||pe,$e&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"guake-agent-area-branch",children:[" ⎇ ",$e.branch]}),$e.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",title:`${$e.ahead} ahead`,children:["↑",$e.ahead]}),$e.behind>0&&o.jsxs("span",{className:"guake-branch-behind",title:`${$e.behind} behind`,children:["↓",$e.behind]}),o.jsx("span",{className:`guake-area-fetch-btn ${gt?"fetching":""}`,title:"Git fetch",onClick:Tt=>{Tt.stopPropagation(),M(pe)},children:gt?"⏳":"⇣"})]})]},`${te}:${pe}`)}),!h&&C&&(()=>{const te=C.contextStats,Ne=!!te,pe=te?te.totalTokens:C.contextUsed||0,$e=te?te.contextWindow:C.contextLimit||2e5,gt=te?te.usedPercent:Math.round(pe/$e*100),Tt=Math.max(0,Math.min(100,gt)),Sn=Math.max(0,100-Tt),tn=Tt>=80?"#ff4a4a":Tt>=60?"#ff9e4a":Tt>=40?"#ffd700":"#4aff9e",$n=(pe/1e3).toFixed(1),es=($e/1e3).toFixed(1);return o.jsxs("span",{className:"guake-agent-context",onClick:()=>H.setContextModalAgentId(k),title:n(Ne?"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,Tt)}%`,backgroundColor:tn}})}),o.jsxs("span",{className:"context-tokens",style:{color:tn},children:[$n,"k/",es,"k"]}),o.jsxs("span",{className:"context-free",children:["(",n("terminal:context.percentFree",{percent:Sn}),")"]}),!Ne&&o.jsx("span",{className:"context-warning",title:n("terminal:context.clickToFetchStats"),children:"⚠️"})]})})(),o.jsxs("span",{className:"guake-status-right",children:[E.length>0&&o.jsx("span",{className:"guake-status-terminals",children:E.map(te=>{const Ne=Vt.has(te.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Ne?"active":""} ${te.hasUrl?"":"offline"}`,title:`${Ne?"Hide":"Show"} terminal: ${te.name}${te.hasUrl?"":" (starting...)"}`,onClick:()=>{if(Ne){const pe=me.find($e=>$e.buildingId===te.id);pe&&cn(pe.id)}else te.hasUrl||H.sendBuildingCommand(te.id,"start"),Mt(te.id,"terminal")},onContextMenu:pe=>{pe.preventDefault(),pe.stopPropagation(),Vt.has(te.id)||Nt({position:{x:pe.clientX,y:pe.clientY},buildingId:te.id,type:"terminal"})},children:"💻"},te.id)})}),I.length>0&&o.jsx("span",{className:"guake-status-terminals",children:I.map(te=>{const Ne=Vt.has(te.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Ne?"active":""}`,title:`${Ne?"Hide":"Show"} logs: ${te.name}`,onClick:()=>{if(Ne){const pe=me.find($e=>$e.buildingId===te.id);pe&&cn(pe.id)}else Mt(te.id,"pm2-logs")},onContextMenu:pe=>{pe.preventDefault(),pe.stopPropagation(),Vt.has(te.id)||Nt({position:{x:pe.clientX,y:pe.clientY},buildingId:te.id,type:"pm2-logs"})},children:"📜"},te.id)})}),O.length>0&&o.jsx("span",{className:"guake-status-terminals",children:O.map(te=>{const Ne=Vt.has(te.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Ne?"active":""}`,title:`${Ne?"Hide":"Show"} database: ${te.name}`,onClick:()=>{if(Ne){const pe=me.find($e=>$e.buildingId===te.id);pe&&cn(pe.id)}else Mt(te.id,"database")},onContextMenu:pe=>{pe.preventDefault(),pe.stopPropagation(),Vt.has(te.id)||Nt({position:{x:pe.clientX,y:pe.clientY},buildingId:te.id,type:"database"})},children:"🗄️"},te.id)})}),o.jsx(sW,{})]})]}),(()=>{const te=[];return et&&(te.push({id:"open",label:"Open",icon:"⬇",onClick:()=>Mt(et.buildingId,et.type)}),Pt.length>0&&(te.push({id:"split-right",label:"Split Right",icon:"↔",onClick:()=>kn(et.buildingId,et.type,"horizontal")}),te.push({id:"split-below",label:"Split Below",icon:"↕",onClick:()=>kn(et.buildingId,et.type,"vertical")}))),o.jsx(ir,{children:o.jsx(go,{isOpen:et!==null,position:(et==null?void 0:et.position)||{x:0,y:0},worldPosition:{x:0,z:0},actions:te,onClose:()=>Nt(null)})})})(),Pt.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:Hs}),o.jsx("div",{ref:Ge,className:`guake-bottom-panels-container ${ot}`,style:{height:lt},onWheel:te=>te.stopPropagation(),children:Pt.map((te,Ne)=>{const pe=_.get(te.buildingId);if(!pe)return null;const $e=jt[Ne]??1,gt=(()=>{var Tt;if(te.type==="terminal")return(Tt=pe.terminalStatus)!=null&&Tt.url?o.jsxs("div",{className:"guake-bottom-panel",style:{flex:$e},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["💻 ",pe.name]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(te.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(Gb,{terminalUrl:pe.terminalStatus.url,visible:!0})]},te.id):o.jsxs("div",{className:"guake-bottom-panel",style:{flex:$e},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["💻 ",pe.name," (starting...)"]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(te.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..."})})]},te.id);if(te.type==="pm2-logs"){const Sn=Re[te.id]||"";return o.jsxs("div",{className:"guake-bottom-panel",style:{flex:$e},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["📜 ",pe.name]}),o.jsxs("div",{className:"guake-bottom-terminal-controls",children:[o.jsx("input",{type:"text",className:"guake-bottom-terminal-filter",value:Sn,onChange:tn=>{const $n=tn.target.value;Ke(es=>{if(!$n.trim()){if(!(te.id in es))return es;const Ms={...es};return delete Ms[te.id],Ms}return{...es,[te.id]:$n}})},placeholder:"Filter logs","aria-label":`Filter logs for ${pe.name}`,spellCheck:!1}),o.jsx("select",{className:"guake-bottom-terminal-retention",value:ze===null?"unlimited":String(ze),onChange:tn=>{const $n=tn.target.value==="unlimited"?null:Number(tn.target.value);tt($n),MO($n)},"aria-label":`Max log retention for ${pe.name}`,children:EO.map(tn=>o.jsx("option",{value:tn===null?"unlimited":String(tn),children:tn===null?"Unlimited":`${tn.toLocaleString()} lines`},tn===null?"unlimited":tn))}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>H.clearStreamingLogs(te.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(te.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(te.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(mW,{buildingId:te.buildingId,filterText:Sn,maxRetention:ze})]},te.id)}return o.jsxs("div",{className:"guake-bottom-panel",style:{flex:$e},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["🗄️ ",pe.name]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(te.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(BU,{building:pe})]},te.id)})();return Ne>0?o.jsxs(Ce.Fragment,{children:[o.jsx("div",{className:`guake-split-divider ${ot}`,onMouseDown:Tt=>ls(Tt,Ne-1)}),gt]},te.id):gt})})]}),me.filter(te=>te.areaId!==zt&&te.type==="terminal").map(te=>{var pe;const Ne=_.get(te.buildingId);return(pe=Ne==null?void 0:Ne.terminalStatus)!=null&&pe.url?o.jsx(Gb,{terminalUrl:Ne.terminalStatus.url,visible:!1},te.id):null})]}),Et&&!fe&&o.jsx("div",{className:"guake-resize-handle",onMouseDown:U,title:n("common:rightPanel.dragToResize")}),!(Et&&fe)&&o.jsxs("div",{className:"guake-handle",onClick:()=>{Et&&H.toggleTerminal()},onDoubleClick:()=>{Et||H.toggleTerminal()},style:{top:Et?`min(${B}%, calc(100vh - 72px))`:"0"},children:[o.jsx("span",{className:"guake-handle-icon",children:Et?"▲":"▼"}),o.jsx("span",{className:"guake-handle-text",children:C.name})]}),ge&&o.jsx(m6,{url:ge.url,name:ge.name,onClose:()=>Ee(null)}),Be&&o.jsx(g6,{state:Be,onClose:()=>Ve(null)}),J&&o.jsx(b6,{action:J,selectedAgentId:k,subordinateCount:((Ul=C==null?void 0:C.subordinateIds)==null?void 0:Ul.length)||0,onClose:()=>ne(null),onClearHistory:((Di=q.current)==null?void 0:Di.historyLoader.clearHistory)??(()=>{})}),o.jsx(x6,{}),o.jsx(y6,{}),o.jsx(w6,{agent:C,isOpen:at,onClose:()=>Se(!1)}),!h&&o.jsx(v6,{agent:C,content:Te,onClose:()=>qe(null)})]})});function bW(t){return t.trim().replace(/^v/i,"")}function TA(t){const n=bW(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 xW(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 yW(t,e){const n=TA(t),s=TA(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 xW(n.prerelease,s.prerelease)}function vW(t,e){const n=yW(t,e);return n===null?"unknown":n<0?"behind":n>0?"ahead":"equal"}async function wW(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 kW(t,e,n={}){const s=await wW(t,n);return s?{currentVersion:e,latestVersion:s,relation:vW(e,s)}:{currentVersion:e,latestVersion:null,relation:"unknown"}}const SW="tide-commander",Zg="1.43.0";function CW(){const[t,e]=b.useState({currentVersion:Zg,latestVersion:null,relation:"unknown",isChecking:!1}),n=b.useCallback(async()=>{e(a=>({...a,isChecking:!0}));const s=await kW(SW,Zg);e({currentVersion:Zg,latestVersion:s.latestVersion,relation:s.relation,isChecking:!1})},[]);return b.useEffect(()=>{n()},[n]),{...t,refresh:n}}const AW=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:C,onAgentClick:k,onAgentDoubleClick:N,onTouchStart:j,onTouchMove:_,onTouchEnd:D,onTouchCancel:E,onHoverEnter:I,onHoverLeave:O,onItemRef:T}){const M=b.useMemo(()=>Ia(e.class,h),[e.class,h]),R=!a||r,B=b.useCallback($=>{T(e.id,$)},[e.id,T]);return o.jsxs("div",{ref:B,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:$=>C($,s),onTouchStart:$=>j($,e.id),onTouchMove:_,onTouchEnd:D,onTouchCancel:E,onClick:$=>k(e,$),onDoubleClick:()=>N(e),onMouseEnter:()=>I(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:Xb(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:Qb(e.lastActivity)},title:gp(e.lastActivity),children:"⏱"})]}),o.jsxs("span",{className:"agent-bar-hotkey",title:`Ctrl+${n+1}`,children:["^",n+1]})]})}),jW=b.memo(function({onFocusAgent:e,onSpawnClick:n,onSpawnBossClick:s,onNewBuildingClick:a,onNewAreaClick:r}){const{t:i}=pt(["common"]),c=Dl(),d=rr(),f=cx(),h=qO(),m=ux(),x=Br(),y=Pa(),v=$j(),[S]=ix(),[C,k]=b.useState(!1);fj("AgentBar");const N=b.useRef(null),j=b.useRef(null),_=b.useRef(null),D=b.useRef(new Map);b.useEffect(()=>{{k(!1);return}},[x.experimental2DView]),b.useEffect(()=>{const se=j.current;if(!se)return;const Re=Ke=>{se.scrollWidth<=se.clientWidth||(Ke.preventDefault(),Math.abs(Ke.deltaX)>Math.abs(Ke.deltaY)?se.scrollLeft+=Ke.deltaX:se.scrollLeft+=Ke.deltaY)};return se.addEventListener("wheel",Re,{passive:!1}),()=>se.removeEventListener("wheel",Re)},[]);const[E,I]=b.useState(null),[O,T]=b.useState(new Map),[M,R]=b.useState(null),[B,$]=b.useState(null),U=b.useRef(0),[L,F]=b.useState(null),W=b.useRef(null),V=b.useRef(null),Y=b.useRef(null),z=b.useRef(null),Q=350,K=8,q=b.useMemo(()=>typeof window>"u"?!1:"ontouchstart"in window||window.matchMedia("(pointer: coarse)").matches,[]),xe=b.useMemo(()=>Array.from(c.values()).filter(se=>{if(H.isAgentInArchivedArea(se.id))return!1;if(S){const Re=H.getAreaForAgent(se.id);if(!xp((Re==null?void 0:Re.id)??null))return!1}return!0}).sort((se,Re)=>(se.createdAt||0)-(Re.createdAt||0)),[c,d,S]),{orderedAgents:de,moveAgent:ee}=mO(xe),fe=de,je=b.useMemo(()=>{const se=new Map;for(const Re of fe)se.set(Re.id,H.getAreaForAgent(Re.id));return se},[fe,d]),ge=b.useMemo(()=>{const se=new Map;for(const Ke of fe){const ze=je.get(Ke.id)||null,tt=(ze==null?void 0:ze.id)||null;se.has(tt)||se.set(tt,{area:ze,agents:[]}),se.get(tt).agents.push(Ke)}const Re=Array.from(se.values());return Re.sort((Ke,ze)=>{var tt,ot;return!Ke.area&&ze.area?1:Ke.area&&!ze.area?-1:!Ke.area&&!ze.area?0:(((tt=Ke.area)==null?void 0:tt.name)||"").localeCompare(((ot=ze.area)==null?void 0:ot.name)||"")}),Re},[fe,je]),Ee=b.useRef(e);Ee.current=e;const Be=b.useRef(M);Be.current=M;const Ve=b.useRef(fe);Ve.current=fe;const J=b.useRef(je);J.current=je;const ne=b.useRef(ee);ne.current=ee,b.useEffect(()=>{const se=new Map(O);let Re=!1;for(const Ke of fe){const ze=O.get(Ke.id);Ke.currentTool?(!ze||ze.tool!==Ke.currentTool)&&(se.set(Ke.id,{tool:Ke.currentTool,key:Date.now()}),Re=!0):ze&&setTimeout(()=>{T(tt=>{const ot=new Map(tt);return ot.delete(Ke.id),ot})},1500)}Re&&T(se)},[fe.map(se=>se.currentTool).join(",")]),b.useEffect(()=>{const se=h;if(!se)return;const Re=D.current.get(se),Ke=j.current;Re&&Ke&&requestAnimationFrame(()=>{const ze=Re.getBoundingClientRect(),tt=Ke.getBoundingClientRect(),nt=ze.left-tt.left+Ke.scrollLeft+ze.width/2,lt=Ke.clientWidth;Ke.scrollTo({left:nt-lt/2,behavior:"smooth"})})},[h]);const Te=b.useCallback((se,Re)=>{if(Y.current===se.id){Y.current=null,Re.preventDefault(),Re.stopPropagation();return}H.setLastSelectionViaDirectClick(!0),Re.shiftKey?H.addToSelection(se.id):H.selectAgent(se.id),H.setTerminalOpen(!0)},[]),qe=b.useCallback(se=>{var Re;(Re=Ee.current)==null||Re.call(Ee,se.id),H.setTerminalOpen(!0)},[]),at=b.useCallback(()=>I(null),[]),Se=b.useCallback((se,Re)=>{Re?D.current.set(se,Re):D.current.delete(se)},[]),Fe=b.useCallback((se,Re)=>{R(Re),F(Re.id),se.dataTransfer.effectAllowed="move",se.dataTransfer.setData("text/plain",Re.id),requestAnimationFrame(()=>{se.target.classList.add("dragging")})},[]),ie=b.useCallback(se=>{R(null),$(null),F(null),U.current=0,se.target.classList.remove("dragging")},[]),he=b.useCallback((se,Re)=>{se.preventDefault();const Ke=Be.current;if(Ke){const ze=J.current.get(Ke.id),tt=Ve.current[Re],ot=tt?J.current.get(tt.id):null,nt=(ze==null?void 0:ze.id)??null,lt=(ot==null?void 0:ot.id)??null;se.dataTransfer.dropEffect=nt===lt?"move":"none"}else se.dataTransfer.dropEffect="move"},[]),We=b.useCallback((se,Re)=>{se.preventDefault(),U.current++;const Ke=Be.current;if(Ke){const ze=J.current.get(Ke.id),tt=Ve.current[Re],ot=tt?J.current.get(tt.id):null,nt=(ze==null?void 0:ze.id)??null,lt=(ot==null?void 0:ot.id)??null;$(nt===lt?Re:null)}else $(Re)},[]),st=b.useCallback(se=>{U.current--,U.current===0&&$(null)},[]),ut=b.useCallback((se,Re)=>{se.preventDefault();const Ke=Be.current;if(!Ke)return;const ze=Ve.current,tt=J.current,ot=ze.findIndex(nt=>nt.id===Ke.id);if(ot!==-1&&ot!==Re){const nt=tt.get(Ke.id),lt=ze[Re],it=lt?tt.get(lt.id):null,ht=(nt==null?void 0:nt.id)??null,jt=(it==null?void 0:it.id)??null;ht===jt&&ne.current(ot,Re)}R(null),$(null),F(null),U.current=0},[]),ue=b.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null)},[]),X=b.useCallback(()=>{z.current&&(clearTimeout(z.current),z.current=null)},[]),ae=b.useCallback((se,Re)=>{if(!q||se.touches.length!==1)return;ue(),X(),F(null);const Ke=se.touches[0];V.current={agentId:Re,x:Ke.clientX,y:Ke.clientY},W.current=setTimeout(()=>{F(Re),Y.current=Re,W.current=null},Q)},[ue,X,q]),we=b.useCallback(se=>{if(!q||se.touches.length!==1)return;const Re=V.current;if(!Re||!W.current)return;const Ke=se.touches[0],ze=Ke.clientX-Re.x,tt=Ke.clientY-Re.y;Math.sqrt(ze*ze+tt*tt)>K&&(ue(),V.current=null)},[ue,q]),Z=b.useCallback(()=>{ue(),V.current=null,Be.current||F(null),X(),z.current=setTimeout(()=>{Y.current=null,z.current=null},450)},[ue,X]);b.useEffect(()=>()=>{ue(),X()},[ue,X]);const ve=se=>{const Re=`common:status.${se}`;return i(Re,{defaultValue:i("common:status.unknown")})},{currentVersion:He,latestVersion:Pe,relation:oe,isChecking:Le}=CW(),le=He;let me=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:Pe?`Tide Commander v${le} (npm: v${Pe})`:`Tide Commander v${le}`,children:[o.jsxs("span",{children:["v",le]}),oe==="behind"&&Pe?o.jsxs("span",{className:"agent-bar-version-badge agent-bar-version-badge-behind",title:`Behind npm latest v${Pe}`,children:["npm v",Pe]}):oe==="ahead"&&Pe?o.jsxs("span",{className:"agent-bar-version-badge agent-bar-version-badge-ahead",title:`Ahead of npm latest v${Pe}`,children:["npm v",Pe]}):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)"})}),C&&o.jsx(Jn,{content:"Refresh 3D Scene (HMR changes pending)",position:"bottom",children:o.jsx("button",{className:"agent-bar-hmr-refresh",onClick:Sj,children:"↻"})})]}),o.jsxs("div",{className:"agent-bar-list",ref:_,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")})]})}),ge.map(se=>{var ze,tt,ot,nt,lt;const Re=se.agents,Ke=!se.area;return o.jsxs("div",{className:`agent-bar-group ${Ke?"unassigned":""}`,style:{borderColor:((ze=se.area)==null?void 0:ze.color)||void 0,background:se.area?`${se.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:((tt=se.area)==null?void 0:tt.color)||"#888"},children:((ot=se.area)==null?void 0:ot.name)||i("common:agentBar.unassigned")})}),((nt=se.area)==null?void 0:nt.directories)&&se.area.directories.length>0&&o.jsx("div",{className:"agent-bar-folders",children:se.area.directories.map((it,ht)=>o.jsxs("div",{className:"agent-bar-folder-item",onClick:jt=>{jt.stopPropagation(),H.openFileExplorer(it)},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:it}),o.jsx("div",{className:"agent-bar-folder-tooltip-hint",children:i("common:agentBar.clickToOpen")})]})]},ht))}),Re.map(it=>{const ht=me++,jt=fe.findIndex(be=>be.id===it.id);return o.jsx(AW,{agent:it,currentIndex:ht,agentIndex:jt,isTouchInput:q,isTouchDragEnabled:L===it.id,isSelected:f.has(it.id),hasUnseenOutput:v.has(it.id),isDragging:(M==null?void 0:M.id)===it.id,isDragOver:B===jt,customClasses:y,onDragStart:Fe,onDragEnd:ie,onDragOver:he,onDragEnter:We,onDragLeave:st,onDrop:ut,onAgentClick:Te,onAgentDoubleClick:qe,onTouchStart:ae,onTouchMove:we,onTouchEnd:Z,onTouchCancel:Z,onHoverEnter:I,onHoverLeave:at,onItemRef:Se},it.id)})]},((lt=se.area)==null?void 0:lt.id)||"unassigned")})]})]}),Array.from(O.entries()).map(([se,Re])=>{const Ke=D.current.get(se);if(!Ke)return null;const ze=Ke.getBoundingClientRect(),tt=os[Re.tool]||os.default;return o.jsxs("div",{className:"agent-bar-tool-bubble",title:Re.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:tt}),o.jsx("span",{className:"agent-bar-tool-name",children:Re.tool})]},`tool-${se}-${Re.key}`)}),E&&(()=>{const se=H.getAreaForAgent(E.id),Re=m.get(E.id),Ke=Ia(E.class,y),ze=H.getAgentSupervisorHistory(E.id),tt=ze.length>0?ze[ze.length-1]:void 0,ot=Date.now()-(E.createdAt||Date.now()),nt=Math.floor(ot/6e4),lt=Math.floor(nt/60),it=lt>0?`${lt}h ${nt%60}m`:`${nt}m`,ht=et=>et>=1e6?`${(et/1e6).toFixed(1)}M`:et>=1e3?`${(et/1e3).toFixed(1)}K`:et.toString(),jt=E.contextLimit>0?Math.round(E.contextUsed/E.contextLimit*100):0,be=et=>{switch(et){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(E.id),Ge={};if(_e){const et=_e.getBoundingClientRect();Ge.position="fixed",Ge.left=et.left+et.width/2,Ge.bottom=window.innerHeight-et.top+12}return o.jsxs("div",{className:"agent-bar-tooltip",style:Ge,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:E.provider==="codex"?"/assets/codex.png":E.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:E.provider,className:"agent-bar-provider-icon",title:E.provider==="codex"?"Codex Agent":E.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),E.name]}),o.jsx("span",{className:"agent-bar-tooltip-status",style:{color:Xb(E.status)},children:ve(E.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:[E.class," — ",Ke.description]})]}),se&&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:se.color},children:se.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:E.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:it})]}),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:[ht(E.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:jt>80?"#ff4a4a":jt>60?"#ff9e4a":void 0},children:[ht(E.contextUsed)," / ",ht(E.contextLimit)," (",jt,"%)"]})]}),E.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:[os[E.currentTool]||os.default," ",E.currentTool]})]}),E.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:E.taskLabel})]}),E.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:[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:[i("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?"...":""]})]}),Re&&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:[Re.text.substring(0,300),Re.text.length>300?"...":""]})]}),tt&&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:be(tt.analysis.progress)},children:tt.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:tt.analysis.statusDescription})]}),tt.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:[tt.analysis.recentWorkSummary.substring(0,300),tt.analysis.recentWorkSummary.length>300?"...":""]})]}),tt.analysis.concerns&&tt.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:tt.analysis.concerns.join("; ")})]})]})]})]})})()]})});function NW({activeTool:t,onExit:e}){const{t:n}=pt(["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 TW={idle:"common:status.idle",working:"common:status.working",waiting:"common:status.waiting",error:"common:status.error",offline:"common:status.offline"},eb=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString(),_W=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"}},EW=b.memo(function({agent:e,screenPos:n,onClose:s}){const{t:a}=pt(["common"]),r=Pa(),i=H.getAreaForAgent(e.id),c=H.getState().lastPrompts.get(e.id),d=Ia(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,C=b.useMemo(()=>{let j=n.x-150,_=n.y-320-10;return typeof window<"u"&&(j<10?j=10:j+300>window.innerWidth-10&&(j=window.innerWidth-300-10),_<10&&(_=n.y+10)),{position:"fixed",left:j,top:_,zIndex:1e4,maxWidth:300,maxHeight:320,fontSize:"0.85em"}},[n.x,n.y]);return o.jsxs("div",{className:"agent-hover-popup",style:C,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:Xb(e.status)},children:a(TW[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:[eb(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:[eb(e.contextUsed)," / ",eb(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:[os[e.currentTool]||os.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:_W(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 _A(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 EA(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 MA={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 MW(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:MA[c]&&(a=MA[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 DW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenLogsModal:r,onOpenUrlInModal:i}){var F,W,V,Y,z,Q,K,q,xe,de,ee,fe,je,ge,Ee,Be,Ve,J,ne,Te;const{t:c}=pt(["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:C}=Ns(),k=H.getBuildingLogs(e.id),N=(F=e.pm2)==null?void 0:F.enabled,j=(W=e.docker)==null?void 0:W.enabled,_=b.useRef(null),D=b.useRef(null),E=b.useCallback(qe=>{qe.preventDefault();const at=S.current?S.current.x:0,Se=S.current?S.current.y:0;v.current={mouseX:qe.clientX,mouseY:qe.clientY,popupX:at,popupY:Se},y(!0),_.current=Fe=>{if(!v.current)return;const ie=Fe.clientX-v.current.mouseX,he=Fe.clientY-v.current.mouseY;m({x:v.current.popupX+ie,y:v.current.popupY+he})},D.current=()=>{y(!1),v.current=null,_.current&&document.removeEventListener("mousemove",_.current),D.current&&document.removeEventListener("mouseup",D.current)},document.addEventListener("mousemove",_.current),document.addEventListener("mouseup",D.current)},[]);b.useEffect(()=>()=>{_.current&&document.removeEventListener("mousemove",_.current),D.current&&document.removeEventListener("mouseup",D.current)},[]);const I=qe=>{if(qe==="logs"){if((N||j)&&r){r();return}H.sendBuildingCommand(e.id,qe),f(!0)}else H.sendBuildingCommand(e.id,qe)},O=(qe,at)=>{if(qe){const Se=`http://localhost:${qe}`;at&&i?i(Se):window.open(Se,"_blank")}},T=((V=e.pm2Status)==null?void 0:V.ports)||[],M=((z=(Y=e.dockerStatus)==null?void 0:Y.ports)==null?void 0:z.map(qe=>qe.host))||[],R=N?T:j?M:[],B=N?!!((Q=e.pm2)!=null&&Q.script):j?!!((K=e.docker)!=null&&K.image)||((q=e.docker)==null?void 0:q.mode)==="compose"||((xe=e.docker)==null?void 0:xe.mode)==="existing":!!((de=e.commands)!=null&&de.start),$=N?!!((ee=e.pm2)!=null&&ee.script):j?!0:!!((fe=e.commands)!=null&&fe.stop),U=N?!!((je=e.pm2)!=null&&je.script):j?!0:!!((ge=e.commands)!=null&&ge.restart),L=b.useMemo(()=>{const at=d?400:250;let Se=n.x+20,Fe=n.y-80;return typeof window<"u"&&!h&&(n.x+20+280>window.innerWidth&&(Se=n.x-280-20),n.y-80<0?Fe=10:n.y-80+at>window.innerHeight&&(Fe=window.innerHeight-at-10)),{position:"fixed",left:Se+((h==null?void 0:h.x)||0),top:Fe+((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:qe=>qe.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header ${x?"dragging":""}`,onMouseDown:E,children:[o.jsx("span",{className:"building-popup-name",children:e.name}),R.length>0&&o.jsx("span",{className:"building-popup-ports",children:R.map(qe=>o.jsxs("a",{href:`http://localhost:${qe}`,className:"building-popup-port-link",onClick:at=>{at.preventDefault(),at.stopPropagation(),O(qe,at.altKey)},onMouseDown:at=>at.stopPropagation(),title:`Open http://localhost:${qe} (Alt+Click for modal)`,children:[":",qe]},qe))}),o.jsx("span",{className:"building-popup-status",style:{backgroundColor:pb[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:[((Ee=e.pm2Status.cpu)==null?void 0:Ee.toFixed(1))||"0","%"]})]}),o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"MEM"}),o.jsx("span",{className:"value",children:_A(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:EA(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:_A(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:EA(e.dockerStatus.startedAt)})]})]}),j&&((Be=e.dockerStatus)==null?void 0:Be.services)&&e.dockerStatus.services.length>0&&o.jsx("div",{className:"building-popup-services",children:e.dockerStatus.services.map((qe,at)=>o.jsxs("span",{className:"service-item",title:`${qe.name}: ${qe.status}`,children:[o.jsx("span",{className:"service-indicator",style:{backgroundColor:qe.status==="running"?"#4ade80":"#f87171"}}),o.jsx("span",{className:"service-name",children:qe.name})]},at))}),(e.lastError||N&&((Ve=e.pm2Status)==null?void 0:Ve.status)==="errored"||j&&((J=e.dockerStatus)==null?void 0:J.status)==="dead")&&o.jsxs("div",{className:"building-popup-error",children:[e.lastError||c("terminal:building.processFailedToStart"),N&&((ne=e.pm2Status)==null?void 0:ne.restarts)&&e.pm2Status.restarts>5&&o.jsxs("span",{className:"error-hint",children:[" - ",c("terminal:building.checkLogsOrConfig")]}),j&&((Te=e.dockerStatus)==null?void 0:Te.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:()=>I("start"),disabled:!B||e.status==="running"||e.status==="starting",title:c(B?"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:()=>I("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:()=>I("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:()=>I("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:qe=>O(R[0],qe.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(qe=>o.jsxs("button",{className:"action-btn open-url port-btn",onClick:at=>O(qe,at.altKey),title:`Open http://localhost:${qe} (Alt+Click for modal)`,children:[":",qe]},qe))]})]}),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((qe,at)=>o.jsx("pre",{children:MW(qe)},at))})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:c("terminal:buildingAction.fullSettings")})]})});function RW(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 OW(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 LW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenLogsModal:r,onOpenUrlInModal:i}){const{t:c}=pt(["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}=Ns(),C=(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=B=>{if(!x.current)return;const $=B.clientX-x.current.mouseX,U=B.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 _=T=>{H.sendBossBuildingCommand(e.id,T)},D=C.reduce((T,M)=>(T[M.status]=(T[M.status]||0)+1,T),{}),E=C.some(T=>{var M;return(M=T.pm2)==null?void 0:M.enabled}),I=(T,M)=>{const R=`http://localhost:${T}`;M&&i?i(R):window.open(R,"_blank")},O=b.useMemo(()=>{let R=n.x+20,B=n.y-80;return typeof window<"u"&&!d&&(n.x+20+340>window.innerWidth&&(R=n.x-340-20),n.y-80<0?B=10:n.y-80+350>window.innerHeight&&(B=window.innerHeight-350-10)),{position:"fixed",left:R+((d==null?void 0:d.x)||0),top:B+((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:C.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:pb[T]||"#666"},children:[M," ",T]},T)),C.length===0&&o.jsx("span",{className:"no-subordinates",children:c("terminal:building.noSubordinates")})]}),C.length>0&&o.jsx("div",{className:"subordinate-list",children:C.map(T=>{var M,R,B;return o.jsxs("div",{className:"subordinate-item",children:[o.jsx("span",{className:"sub-status-dot",style:{backgroundColor:pb[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(),I($,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),"% | ",RW(T.pm2Status.memory||0)]}),((B=T.pm2Status)==null?void 0:B.uptime)&&o.jsx("span",{className:"sub-uptime",children:OW(T.pm2Status.uptime)})]},T.id)})}),o.jsxs("div",{className:"building-popup-actions boss-actions",children:[o.jsxs("button",{className:"action-btn start",onClick:()=>_("start_all"),disabled:C.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:()=>_("stop_all"),disabled:C.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:()=>_("restart_all"),disabled:C.length===0,title:c("terminal:building.restartAllSubs"),children:[o.jsx("span",{className:"icon",children:"↺"}),c("terminal:building.restartAll")]}),E&&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")})]})}),PW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenDatabasePanel:r}){var D;const{t:i}=pt(["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=mx(e.id),v=((D=e.database)==null?void 0:D.connections)??[],S=b.useRef(null),C=b.useRef(null),k=b.useCallback(E=>{E.preventDefault();const I=x.current?x.current.x:0,O=x.current?x.current.y:0;m.current={mouseX:E.clientX,mouseY:E.clientY,popupX:I,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})},C.current=()=>{h(!1),m.current=null,S.current&&document.removeEventListener("mousemove",S.current),C.current&&document.removeEventListener("mouseup",C.current)},document.addEventListener("mousemove",S.current),document.addEventListener("mouseup",C.current)},[]);b.useEffect(()=>()=>{S.current&&document.removeEventListener("mousemove",S.current),C.current&&document.removeEventListener("mouseup",C.current)},[]);const N=E=>{H.testDatabaseConnection(e.id,E)},j=E=>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:_,onClick:E=>E.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(E=>{var O;const I=j(E.id);return o.jsxs("div",{className:"database-connection-item",children:[o.jsx("span",{className:"conn-engine",children:((O=_L[E.engine])==null?void 0:O.icon)??"🗄️"}),o.jsx("span",{className:"conn-name",children:E.name}),o.jsx("span",{className:"conn-host",children:E.engine==="sqlite"?E.filepath||E.database||":memory:":`${E.host}:${E.port}`}),I&&o.jsx("span",{className:`conn-status ${I.connected?"connected":"disconnected"}`,children:I.connected?"●":"○"}),o.jsx("button",{className:"conn-test-btn",onClick:()=>N(E.id),title:i("terminal:building.testConnection"),children:"↻"})]},E.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(E=>N(E.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 IW({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),[C,k]=b.useState("fps"),[N,j]=b.useState(null),[_,D]=b.useState(null),[E,I]=b.useState(null),[O,T]=b.useState(typeof window<"u"?window.innerWidth:1024),[M,R]=b.useState(null);b.useEffect(()=>{const ee=()=>T(window.innerWidth);return window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]);const B=vp(),$=b.useMemo(()=>{const ee=B.filter(je=>je.memoryUsageMB!==void 0&&je.memoryUsageMB>0);return{totalMB:ee.reduce((je,ge)=>je+(ge.memoryUsageMB||0),0),agentCount:ee.length,agents:ee.map(je=>({name:je.name,memoryMB:je.memoryUsageMB||0,status:je.status})).sort((je,ge)=>ge.memoryMB-je.memoryMB)}},[B]),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 ee=async()=>{try{const je=await Bt(Dt("/api/perf"));if(je.ok){const ge=await je.json();D(ge)}}catch{}};ee();const fe=setInterval(ee,v?3e3:1e4);return()=>clearInterval(fe)},[t,v]),b.useEffect(()=>{if(!t)return;const ee=Dc.getUsage();ee&&M===null&&R(ee.usedMB);const fe=setInterval(()=>{var at,Se;Kd.update();const je=Kd.getStats();s(je.current),r(Fe=>[...Fe,je.current].slice(-60));const ge=Dc.getUsage();ge&&c(ge);const Ee=window.__tideScene;if(Ee){const Fe=(at=Ee.getMemoryDiagnostics)==null?void 0:at.call(Ee);Fe!=null&&Fe.threeJs&&m(Fe.threeJs);const ie=Ee.renderer;if((Se=ie==null?void 0:ie.info)!=null&&Se.memory){const he=ie.info.memory.textures||0,We=Math.round(he*1);I({count:he,estimatedMB:We})}}const Be=document.getElementsByTagName("*"),Ve=document.getElementsByTagName("canvas"),J=document.getElementsByTagName("img"),ne=document.getElementsByTagName("video");let Te=0;for(let Fe=0;Fe<Math.min(Be.length,500);Fe++){const ie=Be[Fe];ie.onclick&&Te++,ie.onmousedown&&Te++,ie.onkeydown&&Te++}Te+=10,j({nodeCount:Be.length,listenerCount:Te,canvasCount:Ve.length,imageCount:J.length,videoCount:ne.length}),ge&&f(Fe=>{const ie=L.current,he={timestamp:Date.now(),heapMB:ge.usedMB,geometries:(ie==null?void 0:ie.geometries)??0,textures:(ie==null?void 0:ie.textures)??0};return[...Fe,he].slice(-120)});const qe=U.current;if(qe.length>=10){const Fe=qe[0],ie=qe[qe.length-1],he=(ie.timestamp-Fe.timestamp)/1e3/60;he>.1&&y((ie.heapMB-Fe.heapMB)/he)}},1e3);return()=>{clearInterval(fe)}},[t,M]),!t)return null;const F=ee=>{const fe=Math.floor(ee/3600),je=Math.floor(ee%3600/60),ge=ee%60;return fe>0?`${fe}h ${je}m`:je>0?`${je}m ${ge}s`:`${ge}s`},W=ee=>ee>=55?"#4aff9e":ee>=30?"#ffcc00":"#ff4a4a",V=(ee,fe)=>{const je=ee/fe;return je<.5?"#4aff9e":je<.8?"#ffcc00":"#ff4a4a"},Y=ee=>ee===null?"#888":ee<1?"#4aff9e":ee<5?"#ffcc00":"#ff4a4a",z=Kd.getStats(),K=O<=768?80:10,q={"top-left":{top:10,left:10},"top-right":{top:10,right:10},"bottom-left":{bottom:K,left:10},"bottom-right":{bottom:K,right:10}},xe=M&&i?i.usedMB-M:0,de=ee=>({padding:"2px 8px",fontSize:"9px",border:"none",background:C===ee?"rgba(74, 158, 255, 0.4)":"rgba(255, 255, 255, 0.1)",color:C===ee?"#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"]}),_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#444"},children:"|"}),o.jsx("span",{style:{color:"#ff9e4a",fontWeight:"bold"},children:_.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:de("fps"),onClick:()=>k("fps"),children:"FPS"}),o.jsx("button",{style:de("memory"),onClick:()=>k("memory"),children:"Memory"}),o.jsx("button",{style:de("threejs"),onClick:()=>k("threejs"),children:"3D"}),o.jsx("button",{style:de("dom"),onClick:()=>k("dom"),children:"DOM"}),o.jsx("button",{style:de("server"),onClick:()=>k("server"),children:"Server"}),o.jsx("button",{style:de("http"),onClick:()=>k("http"),children:"HTTP"})]}),C==="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(z.current)},children:z.current}),o.jsx("span",{style:{color:"#888"},children:"Min:"}),o.jsx("span",{style:{color:W(z.min)},children:z.min}),o.jsx("span",{style:{color:"#888"},children:"Max:"}),o.jsx("span",{style:{color:W(z.max)},children:z.max}),o.jsx("span",{style:{color:"#888"},children:"Avg:"}),o.jsx("span",{style:{color:W(z.avg)},children:z.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((ee,fe)=>o.jsx("div",{style:{width:"3px",height:`${Math.min(100,ee/60*100)}%`,background:W(ee),opacity:.8}},fe))})]})]}),C==="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:xe>50?"#ff4a4a":xe>20?"#ffcc00":"#4aff9e"},children:[xe>0?"+":"",xe," 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((ee,fe)=>{const je=Math.min(...d.map(Ve=>Ve.heapMB)),Ee=Math.max(...d.map(Ve=>Ve.heapMB))-je||1,Be=(ee.heapMB-je)/Ee*100;return o.jsx("div",{style:{width:"3px",height:`${Math.max(5,Be)}%`,background:ee.heapMB>(M??0)+50?"#ff4a4a":"#4a9eff",opacity:.8},title:`${ee.heapMB}MB`},fe)})})]}),$.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((ee,fe)=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"1px"},children:[o.jsx("span",{style:{color:ee.status==="working"?"#4aff9e":"#666",maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis"},children:ee.name}),o.jsxs("span",{style:{color:"#4a9eff"},children:[ee.memoryMB,"MB"]})]},fe))})]})]}),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:["~",(E==null?void 0:E.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+((E==null?void 0:E.estimatedMB)??0)+Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)," MB"]})]})]})]})]}),C==="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((ee,fe)=>{const je=Math.max(...d.map(ge=>ge.textures))||1;return o.jsx("div",{style:{width:"3px",height:`${ee.textures/je*100}%`,background:"#ff9e4a",opacity:.8},title:`${ee.textures} textures`},fe)})})]}),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."]})}),C==="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})]}),E&&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:E.count}),o.jsx("span",{style:{color:"#888"},children:"Est. VRAM:"}),o.jsxs("span",{style:{color:E.estimatedMB>100?"#ff4a4a":"#4aff9e"},children:["~",E.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:["~",(E==null?void 0:E.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)+((E==null?void 0:E.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..."})}),C==="server"&&o.jsx("div",{children:_?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:F(_.uptime)}),o.jsx("span",{style:{color:"#888"},children:"Heap Used:"}),o.jsxs("span",{style:{color:_.process.heapUsedMB>500?"#ff4a4a":"#4aff9e"},children:[_.process.heapUsedMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Heap Total:"}),o.jsxs("span",{children:[_.process.heapTotalMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"RSS:"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[_.process.rssMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"External:"}),o.jsxs("span",{children:[_.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:_.system.loadAvg[0]>_.system.cpuCount?"#ff4a4a":"#4aff9e"},children:_.system.loadAvg.join(" ")}),o.jsx("span",{style:{color:"#888"},children:"CPUs:"}),o.jsx("span",{children:_.system.cpuCount}),o.jsx("span",{style:{color:"#888"},children:"Sys Memory:"}),o.jsxs("span",{children:[_.system.totalMemMB-_.system.freeMemMB," / ",_.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:_.websocket.clients}),o.jsx("span",{style:{color:"#888"},children:"Sent:"}),o.jsx("span",{children:_.websocket.messagesSent.toLocaleString()}),o.jsx("span",{style:{color:"#888"},children:"Received:"}),o.jsx("span",{children:_.websocket.messagesReceived.toLocaleString()})]})]}),_.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 (",_.agents.working,"w / ",_.agents.idle,"i / ",_.agents.total,"t):"]}),o.jsx("div",{style:{maxHeight:"80px",overflowY:"auto",fontSize:"10px"},children:_.agents.processes.map(ee=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"1px"},children:[o.jsx("span",{style:{color:ee.status==="working"?"#4aff9e":ee.status==="idle"?"#888":"#ff4a4a",maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ee.name}),o.jsxs("span",{style:{color:"#4a9eff"},children:[ee.memoryMB!=null?`${ee.memoryMB}MB`:"—",ee.pid?` (${ee.pid})`:""]})]},ee.id))})]})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading server metrics..."})}),C==="http"&&o.jsx("div",{children:_?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:_.http.reqPerSec}),o.jsx("span",{style:{color:"#888"},children:"Avg Latency:"}),o.jsxs("span",{style:{color:_.http.avgLatencyMs>100?"#ff4a4a":_.http.avgLatencyMs>50?"#ffcc00":"#4aff9e"},children:[_.http.avgLatencyMs," ms"]}),o.jsx("span",{style:{color:"#888"},children:"Max Latency:"}),o.jsxs("span",{style:{color:_.http.maxLatencyMs>500?"#ff4a4a":_.http.maxLatencyMs>200?"#ffcc00":"#4aff9e"},children:[_.http.maxLatencyMs," ms"]}),o.jsx("span",{style:{color:"#888"},children:"Recent Reqs:"}),o.jsx("span",{children:_.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,_.http.avgLatencyMs/500*100)}%`,background:_.http.avgLatencyMs>100?"#ff4a4a":_.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:[_.process.cpuUser," ms"]}),o.jsx("span",{style:{color:"#888"},children:"CPU (system):"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:[_.process.cpuSystem," ms"]}),o.jsx("span",{style:{color:"#888"},children:"WS Clients:"}),o.jsx("span",{style:{color:"#4aff9e"},children:_.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:ee=>{ee.stopPropagation();const fe=["=== Tide Commander Performance Stats ===",`Timestamp: ${new Date().toISOString()}`,"","--- FPS ---",`Current: ${z.current}`,`Min: ${z.min}`,`Max: ${z.max}`,`Avg: ${z.avg}`];i&&fe.push("","--- Memory ---",`Heap Used: ${i.usedMB} MB`,`Heap Total: ${i.totalMB} MB`,`Heap Limit: ${i.limitMB} MB`,`Baseline: ${M??"N/A"} MB`,`Growth: ${xe>0?"+":""}${xe} MB`,`Growth Rate: ${x!==null?`${x.toFixed(2)} MB/min`:"N/A"}`),h&&fe.push("","--- Three.js ---",`Geometries: ${h.geometries}`,`Textures: ${h.textures}`,`Programs: ${h.programs}`),$.agentCount>0&&(fe.push("","--- Agent Memory ---",`Total: ${$.totalMB} MB`,`Agents: ${$.agentCount}`),$.agents.slice(0,5).forEach(ge=>{fe.push(` ${ge.name}: ${ge.memoryMB} MB (${ge.status})`)})),N&&fe.push("","--- DOM ---",`DOM Nodes: ${N.nodeCount.toLocaleString()}`,`Canvases: ${N.canvasCount}`,`Images: ${N.imageCount}`,`Videos: ${N.videoCount}`),E&&fe.push("","--- Estimated Memory ---",`GPU Textures: ${E.count}`,`Est. VRAM: ~${E.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)+E.estimatedMB+Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)} MB`),_&&(fe.push("","--- Server ---",`Uptime: ${F(_.uptime)}`,`Heap: ${_.process.heapUsedMB}/${_.process.heapTotalMB} MB`,`RSS: ${_.process.rssMB} MB`,`Load Avg: ${_.system.loadAvg.join(" ")}`,`System Memory: ${_.system.totalMemMB-_.system.freeMemMB}/${_.system.totalMemMB} MB`,"","--- WebSocket ---",`Clients: ${_.websocket.clients}`,`Sent: ${_.websocket.messagesSent}`,`Received: ${_.websocket.messagesReceived}`,"","--- HTTP ---",`Req/sec: ${_.http.reqPerSec}`,`Avg Latency: ${_.http.avgLatencyMs} ms`,`Max Latency: ${_.http.maxLatencyMs} ms`),_.agents.processes.length>0&&(fe.push("","--- Agent Processes ---",`Total: ${_.agents.total} (${_.agents.working} working, ${_.agents.idle} idle)`),_.agents.processes.forEach(ge=>{fe.push(` ${ge.name}: ${ge.memoryMB!=null?`${ge.memoryMB}MB`:"N/A"} (${ge.status})${ge.pid?` PID:${ge.pid}`:""}`)})));const je=fe.join(`
153
+ `);navigator.clipboard.writeText(je).then(()=>{const ge=ee.currentTarget,Ee=ge.textContent;ge.textContent="Copied!",setTimeout(()=>{ge.textContent=Ee},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:ee=>{ee.stopPropagation(),Dc.report();const fe=window.__tideScene;fe!=null&&fe.logMemoryDiagnostics&&fe.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:ee=>{ee.stopPropagation(),yb.clear(),Kd.reset(),Dc.reset(),r([]),f([]);const fe=Dc.getUsage();fe&&R(fe.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 BW(){const t=zj(),e=b.useCallback(n=>{H.setViewMode(n)},[]);return[t,e]}const FW=["3d","2d","dashboard"],zW=b.memo(function({className:e=""}){const{t:n}=pt(["common"]),[s,a]=BW(),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}}),FW.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 MT({className:t}){const{t:e}=pt(["terminal"]),[n,s]=b.useState(!1),[a,r]=b.useState(null),i=ey(),c=b.useCallback(async y=>{if(y.trim()){console.log("[VoiceAssistant] Transcribed:",y),s(!0),r(null);try{const S=await(await Bt(Dt("/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 C=S.error||e("terminal:voiceAssistant.failedToProcess");console.error("[VoiceAssistant] Error:",C),r(C),i.speak(C)}}catch(v){console.error("[VoiceAssistant] Request failed:",v);const S=e("terminal:voiceAssistant.unavailable");r(S),i.speak(S)}finally{s(!1)}}},[i]),d=kT({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 $W=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}=pt(["terminal","common"]),S=Br(),C=k=>{k(),n()};return o.jsxs(o.Fragment,{children:[S.experimentalVoiceAssistant&&o.jsx(MT,{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:()=>C(s),onTouchEnd:k=>{k.preventDefault(),C(s)},title:v("terminal:mobileFab.showTerminal"),children:"💬"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(a),onTouchEnd:k=>{k.preventDefault(),C(a)},title:v("terminal:header.openSidebar"),children:"📋"}),x&&o.jsx("button",{className:"mobile-fab-option mobile-fab-option--highlight",onClick:()=>C(m),onTouchEnd:k=>{k.preventDefault(),C(m)},title:v("terminal:mobileFab.takeSnapshot"),children:"⭐"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(r),onTouchEnd:k=>{k.preventDefault(),C(r)},title:v("common:floatingButtons.settingsAndTools"),children:"⚙️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(i),onTouchEnd:k=>{k.preventDefault(),C(i)},title:v("common:floatingButtons.commanderView"),children:"📊"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(c),onTouchEnd:k=>{k.preventDefault(),C(c)},title:v("common:floatingButtons.supervisorOverview"),children:"🎖️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(d),onTouchEnd:k=>{k.preventDefault(),C(d)},title:v("common:floatingButtons.controls"),children:"⌨️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(f),onTouchEnd:k=>{k.preventDefault(),C(f)},title:v("common:floatingButtons.manageSkills"),children:"⭐"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>C(h),onTouchEnd:k=>{k.preventDefault(),C(h)},title:v("common:floatingButtons.viewSnapshots"),children:"📸"})]})]})}),HW=b.memo(function({onOpenToolbox:e,onOpenCommander:n,onOpenSupervisor:s,onOpenControls:a,onOpenSkills:r,onOpenSnapshots:i,isGeneratingReport:c,pip:d}){const{t:f}=pt(["common","terminal"]),h=Br();return o.jsxs(o.Fragment,{children:[h.experimentalVoiceAssistant&&o.jsx(MT,{}),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"})]})})})]})}),UW=Ce.lazy(()=>vt(()=>import("./SpawnModal-Ci_uvH1F.js"),__vite__mapDeps([17,3,1,4])).then(t=>({default:t.SpawnModal}))),WW=Ce.lazy(()=>vt(()=>import("./BossSpawnModal-C5JHnXoV.js"),__vite__mapDeps([18,3,1,4])).then(t=>({default:t.BossSpawnModal}))),qW=Ce.lazy(()=>vt(()=>import("./SubordinateAssignmentModal-kFDllrhg.js"),__vite__mapDeps([19,3,1,4])).then(t=>({default:t.SubordinateAssignmentModal}))),VW=Ce.lazy(()=>vt(()=>import("./index-OOJWJ_4Z.js"),__vite__mapDeps([20,3,1,4,21])).then(t=>({default:t.Toolbox}))),GW=Ce.lazy(()=>vt(()=>import("./index-CRD8TN18.js"),__vite__mapDeps([22,3,1,4])).then(t=>({default:t.BuildingConfigModal}))),YW=Ce.lazy(()=>vt(()=>import("./index-DkhEv4qN.js"),__vite__mapDeps([23,24,3,1,4])).then(t=>({default:t.CommanderView}))),KW=Ce.lazy(()=>vt(()=>import("./SupervisorPanel-CPyoCa6i.js"),__vite__mapDeps([25,3,1,4])).then(t=>({default:t.SupervisorPanel}))),QW=Ce.lazy(()=>vt(()=>import("./index-BWCjlz0C.js").then(t=>t.y),[]).then(t=>({default:t.FileExplorerPanel}))),XW=Ce.lazy(()=>vt(()=>import("./index-M90uUgxL.js"),__vite__mapDeps([26,3,1,4])).then(t=>({default:t.Spotlight}))),JW=Ce.lazy(()=>vt(()=>import("./ControlsModal-DJ6kwJQg.js"),__vite__mapDeps([27,3,1,4])).then(t=>({default:t.ControlsModal}))),ZW=Ce.lazy(()=>vt(()=>import("./SkillsPanel-BpY-jIMP.js"),__vite__mapDeps([28,3,1,4])).then(t=>({default:t.SkillsPanel}))),eq=Ce.lazy(()=>vt(()=>Promise.resolve().then(()=>M2),void 0).then(t=>({default:t.AgentEditModal}))),tq=Ce.lazy(()=>vt(()=>import("./SnapshotManager-DlJQAEC-.js"),__vite__mapDeps([29,3,1,4])).then(t=>({default:t.SnapshotManager}))),nq=Ce.lazy(()=>vt(()=>import("./RestoreArchivedAreaModal-BAe0BLNN.js"),__vite__mapDeps([30,3,1,4])).then(t=>({default:t.RestoreArchivedAreaModal}))),sq=Ce.lazy(()=>vt(()=>import("./IntegrationsPanel-CrT3G7gD.js"),__vite__mapDeps([31,3,1,4])).then(t=>({default:t.IntegrationsPanel}))),aq=Ce.lazy(()=>vt(()=>import("./MonitoringModal-BopLTYX0.js"),__vite__mapDeps([32,3,1,4])).then(t=>({default:t.MonitoringModal}))),rq=Ce.lazy(()=>vt(()=>import("./WorkflowEditorPanel-D8FwpAyj.js"),__vite__mapDeps([33,3,1,4])).then(t=>({default:t.WorkflowEditorPanel}))),iq=Ce.lazy(()=>vt(()=>import("./TriggerManagerPanel-B7qEVCh4.js"),__vite__mapDeps([34,3,1,4])).then(t=>({default:t.TriggerManagerPanel})));function oq({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:C,restoreArchivedModal:k,explorerModal:N,contextMenu:j,spawnPosition:_,spawnAreaId:D,explorerFolderPath:E,contextMenuActions:I,buildingInitialPosition:O,sceneConfig:T,onConfigChange:M,onToolChange:R,onOpenAreaExplorer:B,onDeleteSelectedAgents:$,pendingBuildingDelete:U,onCancelBuildingDelete:L,onConfirmBuildingDelete:F,showBackNavModal:W,onCloseBackNavModal:V,onLeave:Y,onOpenPM2LogsModal:z,onOpenBossLogsModal:Q,onOpenDatabasePanel:K,onSyncScene:q}){const xe=Ns(),de=Array.from(xe.snapshots.values()),ee=xe.snapshotsLoading;xe.currentSnapshot,b.useEffect(()=>{C.isOpen&&H.fetchSnapshots()},[C.isOpen]);const fe=U==="selected",je=U&&U!=="selected"?xe.buildings.get(U):null,ge=xe.selectedBuildingIds.size;return o.jsxs(b.Suspense,{fallback:null,children:[o.jsx(VW,{config:T,onConfigChange:M,onToolChange:R,isOpen:s.isOpen,onClose:s.close,onOpenBuildingModal:Ee=>v.open(Ee||null),onOpenAreaExplorer:B,onOpenIntegrationsModal:Ee=>h.open(Ee),onOpenMonitoringModal:()=>m.open(),onOpenWorkflowEditor:()=>x.open(),onOpenTriggerManager:()=>y.open()}),o.jsx(GW,{isOpen:v.isOpen,onClose:v.close,buildingId:v.data,initialPosition:O||void 0}),o.jsx(UW,{isOpen:t.isOpen,onClose:t.close,onSpawnStart:()=>{},onSpawnEnd:()=>{},spawnPosition:_,spawnAreaId:D}),o.jsx(WW,{isOpen:e.isOpen,onClose:e.close,onSpawnStart:()=>{},onSpawnEnd:()=>{},spawnPosition:_}),o.jsx(qW,{isOpen:n.isOpen,bossId:n.data||"",onClose:n.close}),S.isOpen&&S.data&&(()=>{const Ee=xe.agents.get(S.data);return Ee?o.jsx(eq,{agent:Ee,isOpen:S.isOpen,onClose:S.close}):null})(),r.isOpen&&o.jsx("div",{className:"modal-overlay visible",onClick:r.close,onKeyDown:Ee=>{Ee.key==="Escape"&&r.close(),Ee.key==="Enter"&&$()},children:o.jsxs("div",{className:"modal confirm-modal",onClick:Ee=>Ee.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 ",xe.selectedAgentIds.size," selected agent",xe.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"})]})]})}),(je||fe)&&o.jsx("div",{className:"modal-overlay visible",onClick:L,onKeyDown:Ee=>{Ee.key==="Escape"&&L(),Ee.key==="Enter"&&F()},children:o.jsxs("div",{className:"modal confirm-modal",onClick:Ee=>Ee.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:["Delete Building",fe&&ge>1?"s":""]}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[fe?o.jsxs("p",{children:["Delete ",ge," selected building",ge>1?"s":"","?"]}):o.jsxs("p",{children:["Delete ",o.jsx("strong",{children:je==null?void 0:je.name}),"?"]}),o.jsxs("p",{className:"confirm-modal-note",children:["This will permanently remove the building",fe&&ge>1?"s":""," and ",fe&&ge>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:F,autoFocus:!0,children:"Delete"})]})]})}),W&&o.jsx("div",{className:"modal-overlay navigation-confirm-overlay visible",onClick:V,onKeyDown:Ee=>{Ee.key==="Escape"&&V()},children:o.jsxs("div",{className:"modal confirm-modal navigation-confirm-modal",onClick:Ee=>Ee.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:Yc,children:o.jsx(YW,{isOpen:a.isOpen,onClose:a.close})}),o.jsx(KW,{isOpen:i.isOpen,onClose:i.close}),o.jsx(QW,{isOpen:N.isOpen||E!==null||xe.explorerAreaId!==null,areaId:N.id||xe.explorerAreaId||null,folderPath:E,onChangeArea:Ee=>N.open(Ee),onClose:()=>{N.close(),H.closeFileExplorer()}}),o.jsx(XW,{isOpen:c.isOpen,onClose:c.close,onOpenSpawnModal:()=>t.open(),onOpenCommanderView:()=>a.open(),onOpenToolbox:()=>s.open(),onOpenSupervisor:()=>i.open(),onOpenFileExplorer:Ee=>N.open(Ee),onOpenPM2LogsModal:z,onOpenBossLogsModal:Q,onOpenDatabasePanel:K,onOpenMonitoringModal:()=>m.open()}),o.jsx(JW,{isOpen:d.isOpen,onClose:d.close}),o.jsx(ZW,{isOpen:f.isOpen,onClose:f.close}),o.jsx(sq,{isOpen:h.isOpen,onClose:h.close,initialTab:h.data}),o.jsx(aq,{isOpen:m.isOpen,onClose:m.close}),o.jsx(rq,{isOpen:x.isOpen,onClose:x.close}),o.jsx(iq,{isOpen:y.isOpen,onClose:y.close}),o.jsx(nq,{isOpen:k.isOpen,restorePosition:k.data??null,onClose:k.close,onRestored:q}),C.isOpen&&o.jsx("div",{className:"modal-overlay visible",onClick:C.close,children:o.jsx("div",{className:"modal snapshot-manager-modal",onClick:Ee=>Ee.stopPropagation(),children:o.jsx(tq,{snapshots:de,isLoading:ee,onViewSnapshot:async Ee=>{await H.loadSnapshot(Ee),xe.selectedAgentIds.clear(),H.setTerminalOpen(!0),C.close()},onDeleteSnapshot:async Ee=>{await H.deleteSnapshot(Ee),await H.fetchSnapshots()},onRestoreSnapshot:async Ee=>{await H.restoreFiles(Ee)},onExportSnapshot:async Ee=>{await H.loadSnapshot(Ee),C.close()},onClose:C.close})})}),o.jsx(go,{isOpen:j.isOpen,position:j.screenPosition,worldPosition:j.worldPosition,actions:I,onClose:j.close})]})}function lq({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:Rl.createPortal(n,t.pipContainer)}function ny(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 sy(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 ay(t){const e=po[t.class];return(e==null?void 0:e.icon)||"🤖"}function tb({agent:t,onClick:e}){const n=sy(t.status),s=ny(t.status),a=ay(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 Gc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}const DA={systemPrompt:"#4a9eff",systemTools:"#9e4aff",messages:"#4aff9e",freeSpace:"rgba(255,255,255,0.1)",autocompactBuffer:"#ff9e4a"},RA={systemPrompt:"System Prompt",systemTools:"System Tools",messages:"Messages",freeSpace:"Free Space",autocompactBuffer:"Autocompact Buffer"};function cq({agent:t,onBack:e}){const n=ay(t),s=sy(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:ny(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:Gc(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:[Gc(a.totalTokens)," / ",Gc(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:DA[d]},title:`${RA[d]}: ${Gc(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:DA[d]}}),o.jsxs("div",{className:"pip-category-info",children:[o.jsx("div",{className:"pip-category-name",children:RA[d]}),o.jsxs("div",{className:"pip-category-tokens",children:[Gc(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 uq({agentId:t,onBack:e}){const n=lx(t),s=_j(t),a=Bj(),r=Fj(),i=ux(),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=Cj({selectedAgentId:t,hasSessionId:v,reconnectCount:a,historyRefreshTrigger:r,lastPrompts:i,outputScrollRef:c}),C=uT({outputs:s,viewMode:y}),k=b.useMemo(()=>{const{history:$}=S,U=new Map;for(const F of $)F.type==="tool_result"&&F.toolUseId&&U.set(F.toolUseId,F.content);return(F=>F.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(F=>F.type==="user"||F.type==="assistant"||F.type==="tool_use"))},[S.history]),[N,j]=b.useState({top:!1,bottom:!0}),_=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,_())},[s.length,k.length,_]);const D=b.useCallback(()=>{c.current&&c.current.scrollBy({top:-200,behavior:"smooth"})},[]),E=b.useCallback(()=>{c.current&&c.current.scrollBy({top:200,behavior:"smooth"})},[]),I=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(),I())},[I]);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=Tp($,n==null?void 0:n.cwd),F=L.line?{...U||{},targetLine:L.line}:U;H.setFileViewerPath(L.path,F,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=ay(n),B=sy(n.status);return m?o.jsx(cq,{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:B},children:ny(n.status)})]}),o.jsx("div",{className:"pip-context-section",children:o.jsx(Jj,{contextInfo:kp(n),onClick:()=>x(!0)})}),o.jsxs("div",{className:"pip-conversation-wrapper",children:[o.jsxs("div",{className:"pip-conversation guake-output",ref:c,onScroll:_,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(ET,{message:$,agentId:t,simpleView:!0,onFileClick:M},`h-${U}`)),C.map(($,U)=>o.jsx(ty,{output:$,agentId:t,onFileClick:M},`o-${U}`)),!S.loadingHistory&&k.length===0&&C.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:E,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:I,disabled:!f.trim(),title:"Send message",children:"➤"})]})]})}function dq({onSelectAgent:t}){const e=vp(),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(tb,{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(tb,{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(tb,{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 fq(){const[t,e]=b.useState(null),n=a=>{e(a)},s=()=>{e(null)};return t?o.jsx(uq,{agentId:t,onBack:s}):o.jsx(dq,{onSelectAgent:n})}function pq(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 hq(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 mq=4e3;function gq(){const t=Mj(),[e,n]=b.useState(!1),[s,a]=b.useState(!1),[r,i]=b.useState(!0),[c,d]=b.useState(!1),[f,h]=b.useState(()=>ex()),[m,x]=b.useState(!1),[y,v]=b.useState(null),[S,C]=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($),B(),T(U))},B=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 _=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=()=>mq-(Date.now()-O);v(null),C("Validating URL");const M=f.trim()||"http://localhost:6200",R=pq(M);if(!R.ok){C(null),v(R.error||"Invalid backend URL");return}x(!0),C("Checking host reachability");const B=T();if(B<=0){x(!1),C(null),v("Connection timeout after 4 seconds");return}const $=await hq(R.normalizedUrl,B);if(!$.ok){if(!k.current)return;x(!1),C(null),T()<=0?v("Connection timeout after 4 seconds"):v($.error||"Failed to reach host");return}GD(R.normalizedUrl),C("Connecting to server"),HR();const U=T();if(U<=0){x(!1),C(null),v("Connection timeout after 4 seconds");return}const L=await j(U);if(k.current){if(!L){x(!1),C(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),C("Connected"),v(null)}},[f,m,j]),E=b.useCallback(O=>{O.key==="Enter"&&!m&&D()},[D,m]),I=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:_,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:E})}),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:I,children:"Explore"})]})]})})}const OA="tide-onboarding-dismissed";function bq({onCreateAgent:t}){const{t:e}=pt("common"),n=Mj(),s=Tj(),[a,r]=b.useState(()=>sessionStorage.getItem(OA)==="1"),i=n&&!a&&s===0,c=b.useCallback(()=>{r(!0),sessionStorage.setItem(OA,"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 DT(){return{"Content-Type":"application/json","X-Auth-Token":Ni()}}async function xq(t){const e=await fetch(`${Sa()}/api/areas/${t}/organize`,{method:"POST",headers:DT()});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 yq(){const t=await fetch(`${Sa()}/api/areas/organize-all`,{method:"POST",headers:DT()});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 RT(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 vq(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:()=>{xq(e.id).then(f=>{RT(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 wq=Ce.lazy(()=>vt(()=>import("./index-C5IJ99Dq.js"),__vite__mapDeps([35,3,1,4,36])).then(t=>({default:t.DatabasePanel}))),kq=Ce.lazy(()=>vt(()=>import("./PM2LogsModal-akdCsnNY.js"),__vite__mapDeps([37,38,3,1,4])).then(t=>({default:t.PM2LogsModal}))),Sq=Ce.lazy(()=>vt(()=>import("./DockerLogsModal-wLLPPw3N.js"),__vite__mapDeps([39,38,3,1,4])).then(t=>({default:t.DockerLogsModal}))),Cq=Ce.lazy(()=>vt(()=>import("./BossLogsModal-CnIyv0O7.js"),__vite__mapDeps([40,38,3,1,4])).then(t=>({default:t.BossLogsModal}))),Aq=Ce.lazy(()=>vt(()=>import("./Scene2DCanvas-CTrNCLiT.js"),__vite__mapDeps([41,3,1,4,42])).then(t=>({default:t.Scene2DCanvas}))),jq=Ce.lazy(()=>vt(()=>import("./index-CjH90tsj.js"),__vite__mapDeps([43,3,1,4,44])).then(t=>({default:t.DashboardView}))),Nq=Ce.lazy(()=>vt(()=>import("./IframeModal-BEaeYao1.js"),__vite__mapDeps([45,3,1,4,46])).then(t=>({default:t.IframeModal}))),Tq=Ce.lazy(()=>vt(()=>import("./SaveSnapshotModal-CCK5ncy-.js"),__vite__mapDeps([47,3,1,4])).then(t=>({default:t.SaveSnapshotModal})));function _q(){const{t}=pt(["common","notifications"]),e=b.useRef(null),n=b.useRef(null),s=ns(),a=ns(),r=ns(),i=ns(),c=ns(),d=ns(),f=ns(),h=ns(),m=ns(),x=ns(),y=ns(),v=ns(),S=ns(),C=ns(),k=ns(),N=ns(),j=ns(),_=ns(),D=ns(),E=KD(),I=aL(),O=QD(),T=oR(),[M,R]=b.useState(null),B=XR(),[$,U]=b.useState(!1),[L,F]=b.useState(null),[W,V]=b.useState(null),[Y,z]=b.useState(null),[Q,K]=b.useState(null),[q,xe]=b.useState(null),[de,ee]=b.useState(null),[fe,je]=b.useState(null),[ge,Ee]=b.useState(null),[Be,Ve]=b.useState(null),[J,ne]=b.useState(null),Te=b.useCallback(Ae=>{ne(Ae),Ae&&localStorage.setItem("tide-commander-last-database-building",Ae)},[]),qe=b.useCallback(()=>Te(null),[Te]),{handleMouseDown:at,handleClick:Se}=wa(qe),Fe=b.useCallback(()=>Ve(null),[]),{handleMouseDown:ie,handleClick:he}=wa(Fe),We=b.useRef(de);We.current=de;const st=b.useCallback(Ae=>{ee(Ae)},[]),ut=b.useCallback(()=>We.current,[]),ue=b.useRef(null),[X,ae]=b.useState(kj),[we,Z]=b.useState(0),[ve,He]=b.useState(!1),[Pe,oe]=b.useState(()=>localStorage.getItem("tide-commander-sidebar-collapsed")==="true"),[Le,le]=b.useState(!1),[me,se]=b.useState(!1),Re=Oj(),Ke=zj(),ze=fx(),tt=px(),ot=Rj(),{showToast:nt}=Uj(),{showAgentNotification:lt}=OL(),{showBackNavModal:it,setShowBackNavModal:ht,handleLeave:jt}=hO();oO({showToast:nt,showAgentNotification:lt});const[be,_e]=b.useState(!1);b.useEffect(()=>{const Ae=Xe=>{var en;((en=Xe.detail)==null?void 0:en.mode)==="3d"&&_e(!0)};return window.addEventListener("tide:viewmode-switch-pressed",Ae),()=>{window.removeEventListener("tide:viewmode-switch-pressed",Ae)}},[]),b.useEffect(()=>{Ke==="3d"&&_e(!0)},[Ke]);const Ge=iO({canvasRef:e,selectionBoxRef:n,viewMode:Ke,sceneMountKey:we,showToast:nt,showAgentNotification:lt,toolboxModal:i,contextMenu:O,setHoveredAgentPopup:xe,setBuildingPopup:st,getBuildingPopup:ut,openBuildingModal:Ae=>k.open(Ae),openPM2LogsModal:Ae=>je(Ae),openBossLogsModal:Ae=>Ee(Ae),openDatabasePanel:Ae=>Te(Ae),onSceneLoadingChange:_e}),et=Tj(),Nt=rr(),zt=dx(),Lt=cx(),Pt=JO(),Vt=XO(),mt=QO(),ct=Br(),xt=eL(),Mt=mL(),kn=gL(),cn=b.useMemo(()=>Array.from(Lt),[Lt]),ls=b.useRef(!1);fj("AppContent"),lO(Ge),cO(Ge),uO(Ge),bO(),dO(Ge,Vt),fO(Ge,ct.powerSaving),b.useEffect(()=>{var Ae;document.title=((Ae=ct.tabTitle)==null?void 0:Ae.trim())||"Tide Commander"},[ct.tabTitle]),b.useEffect(()=>{var Pn,Us;if(ls.current||typeof window>"u")return;const Ae=new URLSearchParams(window.location.search),Xe=(Pn=Ae.get("agentId"))==null?void 0:Pn.trim(),Ct=(Us=Ae.get("agentName"))==null?void 0:Us.trim();if(!Xe&&!Ct||et===0)return;const en=H.getState().agents,Ln=Ae.get("openTerminal"),$t=Ln?["1","true","yes"].includes(Ln.toLowerCase()):!0;let At=Xe?en.get(Xe):void 0;if(!At&&Ct){const Aa=Ct.toLowerCase();At=Array.from(en.values()).find(ia=>ia.name.toLowerCase()===Aa)}if(!At){console.warn("[DeepLink] No matching agent found for query params",{rawAgentId:Xe,rawAgentName:Ct}),ls.current=!0;return}H.selectAgent(At.id),$t&&H.setTerminalOpen(!0),Ae.delete("agentId"),Ae.delete("agentName"),Ae.delete("openTerminal");const Nn=Ae.toString(),ks=`${window.location.pathname}${Nn?`?${Nn}`:""}${window.location.hash}`;window.history.replaceState({},document.title,ks),ls.current=!0},[et]),pO({sceneRef:Ge,spawnModal:s,commanderModal:c,explorerModal:E,spotlightModal:h,deleteConfirmModal:d,onRequestBuildingDelete:()=>K("selected"),onOpenDatabasePanel:Te,onCloseDatabasePanel:qe,databasePanelOpen:J!==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",C.isOpen,C.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",_.isOpen,_.close),Qt("explorer-modal",E.isOpen||I!==null,()=>{E.close(),H.closeFileExplorer()}),Qt("context-menu",O.isOpen,O.close),Qt("mobile-sidebar",ve,()=>He(!1)),Qt("mobile-fab-menu",me,()=>se(!1)),Qt("file-viewer",ze!==null,()=>H.clearFileViewerPath()),Qt("context-modal",tt!==null,()=>H.closeContextModal()),Qt("terminal",ot,()=>H.setTerminalOpen(!1)),Qt("pm2-logs-modal",fe!==null,()=>je(null)),Qt("boss-logs-modal",ge!==null,()=>Ee(null)),Qt("database-panel",J!==null,qe),Qt("terminal-modal",Be!==null,Fe);const Ba=b.useRef(ot),Ts=b.useRef(x),Hs=b.useRef(m);Ts.current=x,Hs.current=m,b.useEffect(()=>{Ba.current&&!ot&&(Ts.current.close(),Hs.current.close()),Ba.current=ot},[ot]),b.useEffect(()=>{},[]),b.useEffect(()=>{if(Re!=="3d"||Ke!=="3d")return;const Ae=setTimeout(()=>window.dispatchEvent(new Event("resize")),80);return()=>clearTimeout(Ae)},[Re,Ke]);const Fa=b.useCallback(Ae=>{var Xe,Ct,en,Ln,$t,At,Nn,ks,Pn,Us;ae(Ae),aO(Ae),(Xe=Ge.current)==null||Xe.setCharacterScale(Ae.characterScale),(Ct=Ge.current)==null||Ct.setScale3D(Ae.scale3d),(en=Ge.current)==null||en.setTimeMode(Ae.timeMode),(Ln=Ge.current)==null||Ln.setTerrainConfig(Ae.terrain),($t=Ge.current)==null||$t.setFloorStyle(Ae.terrain.floorStyle),(At=Ge.current)==null||At.setGridVisible(Ae.gridVisible),(Nn=Ge.current)==null||Nn.setAgentModelStyle(Ae.modelStyle),(ks=Ge.current)==null||ks.setIdleAnimation(Ae.animations.idleAnimation),(Pn=Ge.current)==null||Pn.setWorkingAnimation(Ae.animations.workingAnimation),(Us=Ge.current)==null||Us.setFpsLimit(Ae.fpsLimit)},[Ge]),ws=b.useCallback(Ae=>{var Xe;if((Xe=Ge.current)==null||Xe.setDrawingTool(Ae),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(Ae),Ae==="rectangle"||Ae==="circle"){const Ct=t(Ae==="rectangle"?"notifications:drawing.rectangleTool":"notifications:drawing.circleTool");nt("info",Ct,t("notifications:drawing.clickAndDrag"),3e3)}},[Ge,nt]),Zn=b.useCallback(Ae=>{var Xe;(Xe=Ge.current)==null||Xe.focusAgent(Ae)},[Ge]),Et=b.useCallback(Ae=>{H.killAgent(Ae)},[]),rs=b.useCallback(Ae=>{var Xe;(Xe=Ge.current)==null||Xe.callSubordinates(Ae)},[Ge]),fn=b.useCallback(Ae=>{E.open(Ae)},[E]),cr=b.useCallback(()=>{k.open(null)},[k]),Hr=b.useCallback(()=>{var Ae;(Ae=Ge.current)==null||Ae.setDrawingTool("rectangle"),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool("rectangle"),nt("info",t("notifications:drawing.rectangleTool"),t("notifications:drawing.clickAndDrag"),3e3)},[Ge,nt]),_s=b.useCallback(Ae=>{R(Ae)},[]),Es=b.useCallback(()=>{R(null)},[]),_i=b.useCallback(()=>{const Ae=Array.from(H.getState().selectedAgentIds);Ae.forEach(Xe=>{var Ct;H.removeAgentFromServer(Xe),(Ct=Ge.current)==null||Ct.removeAgent(Xe)}),d.close(),nt("info",t("notifications:toast.agentsRemoved"),t("notifications:toast.agentsRemovedMsg",{count:Ae.length}))},[nt,d,Ge,t]),wo=b.useCallback(()=>{var Ae,Xe;if(Q==="selected"){const Ct=Pt.size;H.deleteSelectedBuildings(),(Ae=Ge.current)==null||Ae.syncBuildings(),nt("info",t("notifications:toast.buildingsDeleted"),t("notifications:toast.buildingsDeletedMsg",{count:Ct}))}else if(Q){const Ct=zt.get(Q);H.deleteBuilding(Q),(Xe=Ge.current)==null||Xe.syncBuildings(),nt("info",t("notifications:toast.buildingDeleted"),t("notifications:toast.buildingDeletedMsg",{name:(Ct==null?void 0:Ct.name)||"Building"}))}K(null)},[Q,zt,Pt.size,nt,Ge,t]),Ur=b.useMemo(()=>vq(O.worldPosition,O.target,H.getState().agents,Nt,zt,{showToast:nt,openSpawnModal:()=>s.open(),openBossSpawnModal:()=>a.open(),openToolboxModal:()=>i.open(),openCommanderModal:()=>c.open(),openExplorerModal:Ae=>E.open(Ae),openBuildingModal:Ae=>k.open(Ae),openAgentEditModal:Ae=>N.open(Ae),requestBuildingDelete:Ae=>K(Ae),setSpawnPosition:F,openRestoreArchivedModal:Ae=>D.open(Ae),sceneRef:Ge}),[O.worldPosition,O.target,Nt,zt,s,a,k,i,c,E,N,D,nt,Ge]);b.useEffect(()=>{!s.isOpen&&!a.isOpen&&(F(null),z(null))},[s.isOpen,a.isOpen]),b.useEffect(()=>{const Ae=$t=>{const At=$t.detail;z((At==null?void 0:At.areaId)||null),F((At==null?void 0:At.position)||null),s.open()},Xe=$t=>{var ks,Pn;const At=$t.detail;if(!(At!=null&&At.buildingId))return;const Nn=H.getState().buildings.get(At.buildingId);Nn&&(Nn.type==="server"&&((ks=Nn.pm2)!=null&&ks.enabled)?je(At.buildingId):Nn.type==="boss"?Ee(At.buildingId):Nn.type==="database"?Te(At.buildingId):Nn.type==="folder"&&Nn.folderPath?H.openFileExplorer(Nn.folderPath):Nn.type==="terminal"&&((Pn=Nn.terminalStatus)!=null&&Pn.url)?Ve(At.buildingId):k.open(At.buildingId))},Ct=$t=>{const At=$t.detail;At!=null&&At.buildingId&&k.open(At.buildingId)},en=$t=>{const At=$t.detail;V((At==null?void 0:At.position)||null),k.open(null)},Ln=$t=>{const At=$t.detail;At!=null&&At.buildingId?Ve(At.buildingId):At!=null&&At.url&&R(At.url)};return window.addEventListener("tide:open-spawn-modal",Ae),window.addEventListener("tide:building-action",Xe),window.addEventListener("tide:building-edit",Ct),window.addEventListener("tide:building-create",en),window.addEventListener("tide:open-iframe-modal",Ln),()=>{window.removeEventListener("tide:open-spawn-modal",Ae),window.removeEventListener("tide:building-action",Xe),window.removeEventListener("tide:building-edit",Ct),window.removeEventListener("tide:building-create",en),window.removeEventListener("tide:open-iframe-modal",Ln)}},[s,k]);const Il=mt==="rectangle"||mt==="circle",gs=b.useCallback(()=>{var Ae;(Ae=Ge.current)==null||Ae.setDrawingTool(null),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(null)},[Ge]),Ca=b.useCallback(()=>se(Ae=>!Ae),[]),cs=b.useCallback(()=>H.setMobileView("terminal"),[]),Vn=b.useCallback(()=>He(!0),[]),Wr=cn.length===1&&H.getOutputs(cn[0]).length>0;return o.jsxs("div",{className:`app ${ot?"terminal-open":""} ${Il?"drawing-mode":""} ${Pe?"sidebar-collapsed":""} mobile-view-${Re} view-mode-${Ke}`,children:[o.jsx(gq,{}),o.jsx(bq,{onCreateAgent:s.open}),o.jsx(IW,{visible:ct.showFPS,position:"bottom-right"}),o.jsxs("div",{className:"app-top-bar",children:[o.jsx(zW,{className:"app-view-mode-toggle"}),o.jsx(yj,{}),o.jsxs("button",{className:"app-organize-all-btn",disabled:$,title:"Auto-organize all agents in their areas",onClick:()=>{U(!0),yq().then(Ae=>{RT(Ae,Ge),nt("success","Organized",`Arranged ${Ae.organized.length} agent${Ae.organized.length!==1?"s":""}`)}).catch(Ae=>{console.error("organize all error:",Ae),nt("error","Organize Failed",Ae.message||"Failed to organize")}).finally(()=>U(!1))},children:[$?"⏳":"✨"," Organize"]})]}),o.jsxs("main",{className:"main-content",children:[o.jsxs("div",{className:"battlefield-container",children:[B&&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(Ce.Suspense,{fallback:null,children:Ke==="dashboard"?o.jsx(jq,{onSelectAgent:Ae=>H.selectAgent(Ae),onFocusAgent:Ae=>{H.setViewMode("3d"),Zn(Ae)},onKillAgent:Et,onSelectBuilding:Ae=>H.selectBuilding(Ae),onOpenTerminal:Ae=>{H.selectAgent(Ae),H.setTerminalOpen(!0)},onFocusZone:Ae=>{H.setViewMode("3d");const Xe=H.getState().areas.get(Ae);Xe&&Xe.assignedAgentIds.length>0&&Zn(Xe.assignedAgentIds[0])}}):Ke==="2d"?o.jsx(Aq,{onAgentClick:(Ae,Xe)=>{Xe?H.addToSelection(Ae):H.selectAgent(Ae)},onAgentDoubleClick:Ae=>{if(window.innerWidth<=768){H.openTerminalOnMobile(Ae);return}H.selectAgent(Ae),H.setTerminalOpen(!0)},onBuildingClick:(Ae,Xe)=>{H.selectBuilding(Ae);const Ct=H.getState().buildings.get(Ae);(Ct==null?void 0:Ct.type)==="folder"&&Ct.folderPath?H.openFileExplorer(Ct.folderPath):((Ct==null?void 0:Ct.type)==="server"||(Ct==null?void 0:Ct.type)==="boss"||(Ct==null?void 0:Ct.type)==="database")&&(ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{st({buildingId:Ae,screenPos:Xe,fromClick:!0}),ue.current=null},150))},onBuildingDoubleClick:Ae=>{var Ct;ue.current&&(clearTimeout(ue.current),ue.current=null),st(null);const Xe=H.getState().buildings.get(Ae);(Xe==null?void 0:Xe.type)==="server"&&((Ct=Xe.pm2)!=null&&Ct.enabled)?je(Ae):(Xe==null?void 0:Xe.type)==="boss"?Ee(Ae):(Xe==null?void 0:Xe.type)==="database"?Te(Ae):(Xe==null?void 0:Xe.type)==="folder"&&Xe.folderPath?H.openFileExplorer(Xe.folderPath):k.open(Ae)},onGroundClick:()=>{H.selectAgent(null),H.selectBuilding(null)},onAreaDoubleClick:Ae=>{H.selectArea(Ae),i.open()},onContextMenu:(Ae,Xe,Ct)=>{const en=Ct?{type:Ct.type,id:Ct.id}:{type:"ground"};O.open(Ae,Xe,en)},onMoveCommand:(Ae,Xe)=>{const en=Ae.length,Ln=[];if(en===1)Ln.push({x:Xe.x,y:0,z:Xe.z});else if(en<=6){const $t=1.2*Math.max(1,en/3);for(let At=0;At<en;At++){const Nn=At/en*Math.PI*2-Math.PI/2;Ln.push({x:Xe.x+Math.cos(Nn)*$t,y:0,z:Xe.z+Math.sin(Nn)*$t})}}else{const $t=Math.ceil(Math.sqrt(en)),At=Math.ceil(en/$t),Nn=($t-1)*1.2/2,ks=(At-1)*1.2/2;for(let Pn=0;Pn<en;Pn++){const Us=Pn%$t,Aa=Math.floor(Pn/$t);Ln.push({x:Xe.x+Us*1.2-Nn,y:0,z:Xe.z+Aa*1.2-ks})}}Ae.forEach(($t,At)=>{H.moveAgent($t,Ln[At])})},onBuildingDragMove:(Ae,Xe)=>{var en;const Ct=H.getState().buildings.get(Ae);Ct&&(H.getState().buildings.set(Ae,{...Ct,position:{x:Xe.x,z:Xe.z}}),(en=window.__tideScene2D)==null||en.syncBuildings())},onBuildingDragEnd:(Ae,Xe)=>{H.updateBuildingPosition(Ae,Xe)},scale2d:X.scale2d,showTaskLabels:X.show2DTaskLabels,showGrid:X.gridVisible,fpsLimit:X.fpsLimit}):o.jsxs(Ce.Fragment,{children:[o.jsx("canvas",{ref:e,id:"battlefield",tabIndex:0}),o.jsx("div",{ref:n,id:"selection-box"})]},we)}),be&&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($W,{isOpen:me,onToggle:Ca,onShowTerminal:cs,onOpenSidebar:Vn,onOpenToolbox:i.open,onOpenCommander:c.open,onOpenSupervisor:f.open,onOpenControls:m.open,onOpenSkills:x.open,onOpenSnapshots:j.open,onTakeSnapshot:_.open,canTakeSnapshot:Wr,mobileView:Re}),ve&&o.jsx("div",{className:"sidebar-overlay",onClick:()=>He(!1)}),!1,o.jsx("button",{className:`sidebar-collapse-edge-btn ${Pe?"is-collapsed":""} ${Le?"can-pin":""}`,onClick:()=>{if(window.innerWidth<=768)He(!ve);else{const Xe=!Pe;oe(Xe),localStorage.setItem("tide-commander-sidebar-collapsed",String(Xe))}},title:Pe?"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:Pe?"15 18 9 12 15 6":"9 18 15 12 9 6"})})}),o.jsxs("aside",{className:`sidebar ${ve?"sidebar-open":""} ${Pe?"sidebar-collapsed":""}`,children:[o.jsx("button",{className:"sidebar-close-btn show-on-mobile",onClick:()=>He(!1),title:"Close sidebar",children:"✕"}),cn.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sidebar-section unit-section",children:o.jsx(b.Profiler,{id:"UnitPanel",onRender:Yc,children:o.jsx(cS,{onFocusAgent:Zn,onKillAgent:Et,onCallSubordinates:rs,onOpenAreaExplorer:fn})})}),o.jsx("div",{className:"sidebar-section tool-history-section",children:o.jsx(b.Profiler,{id:"ToolHistory",onRender:Yc,children:o.jsx(I4,{agentIds:cn})})})]}):o.jsx("div",{className:"sidebar-section unit-section",children:o.jsx(b.Profiler,{id:"UnitPanel",onRender:Yc,children:o.jsx(cS,{onFocusAgent:Zn,onKillAgent:Et,onCallSubordinates:rs,onOpenAreaExplorer:fn})})})]}),o.jsx(b.Profiler,{id:"GuakeOutputPanel",onRender:Yc,children:o.jsx(gW,{onSaveSnapshot:_.open})})]}),o.jsx(HW,{onOpenToolbox:i.open,onOpenCommander:c.open,onOpenSupervisor:f.open,onOpenControls:m.open,onOpenSkills:x.open,onOpenSnapshots:j.open,isGeneratingReport:xt,pip:T}),o.jsx(NW,{activeTool:mt,onExit:gs}),q&&(()=>{const Ae=H.getState().agents.get(q.agentId);return Ae?o.jsx(EW,{agent:Ae,screenPos:q.screenPos,onClose:()=>xe(null)}):null})(),de&&(()=>{const Ae=zt.get(de.buildingId);if(!Ae)return null;const Xe=()=>st(null);return Ae.type==="boss"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:Xe}),o.jsx(LW,{building:Ae,screenPos:de.screenPos,onClose:Xe,onOpenSettings:()=>{Xe(),k.open(de.buildingId)},onOpenLogsModal:()=>{Xe(),Ee(de.buildingId)},onOpenUrlInModal:_s})]}):Ae.type==="database"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:Xe}),o.jsx(PW,{building:Ae,screenPos:de.screenPos,onClose:Xe,onOpenSettings:()=>{Xe(),k.open(de.buildingId)},onOpenDatabasePanel:()=>{Xe(),Te(de.buildingId)}})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:Xe}),o.jsx(DW,{building:Ae,screenPos:de.screenPos,onClose:Xe,onOpenSettings:()=>{Xe(),k.open(de.buildingId)},onOpenLogsModal:()=>{je(de.buildingId)},onOpenUrlInModal:_s})]})})(),fe&&(()=>{var Xe;const Ae=zt.get(fe);return Ae?(Xe=Ae.docker)!=null&&Xe.enabled?o.jsx(Sq,{building:Ae,isOpen:!0,onClose:()=>je(null)}):o.jsx(kq,{building:Ae,isOpen:!0,onClose:()=>je(null)}):null})(),ge&&(()=>{const Ae=zt.get(ge);return Ae?o.jsx(Cq,{building:Ae,isOpen:!0,onClose:()=>Ee(null)}):null})(),J&&(()=>{const Ae=zt.get(J);return Ae?o.jsx("div",{className:"modal-overlay visible",onMouseDown:at,onClick:Se,children:o.jsx("div",{className:"database-panel-modal",children:o.jsx(wq,{building:Ae,onClose:qe})})}):null})(),Be&&(()=>{var Xe;const Ae=zt.get(Be);return!Ae||!((Xe=Ae.terminalStatus)!=null&&Xe.url)?null:o.jsx("div",{className:"modal-overlay visible",onMouseDown:ie,onClick:he,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 - ",Ae.name]}),o.jsx("button",{className:"terminal-modal-close",onClick:Fe,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(Gb,{terminalUrl:Ae.terminalStatus.url,visible:!0})]})})})(),o.jsx(lq,{pip:T,title:"Tide Commander - Agents",children:o.jsx(fq,{})}),o.jsx(Nq,{url:M||"",title:M?`Preview - ${M}`:"",isOpen:!!M,onClose:Es}),_.isOpen&&cn.length===1&&(()=>{const Ae=cn[0],Xe=H.getState().agents.get(Ae);if(!Xe)return null;const Ct=H.getOutputs(Ae);return o.jsx(Tq,{isOpen:_.isOpen,onClose:_.close,agent:Xe,outputCount:Ct.length,onSave:async en=>{try{const Ln=Ct.map($t=>({type:"message",content:$t.text,timestamp:new Date($t.timestamp).toISOString()}));await H.createSnapshot(en.agentId,Xe.name,en.title,en.description,Ln,[]),_.close(),nt("success",t("notifications:toast.snapshotSaved"),t("notifications:toast.snapshotSavedMsg"))}catch(Ln){const $t=Ln instanceof Error?Ln.message:t("notifications:toast.snapshotFailedMsg");nt("error",t("notifications:toast.snapshotFailed"),$t)}},isSaving:Mt,error:kn||void 0})})(),o.jsx(jW,{onFocusAgent:Zn,onSpawnClick:s.open,onSpawnBossClick:a.open,onNewBuildingClick:cr,onNewAreaClick:Hr}),o.jsx(oq,{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:C,buildingModal:k,buildingInitialPosition:W,agentEditModal:N,snapshotsModal:j,restoreArchivedModal:D,explorerModal:E,contextMenu:O,spawnPosition:L,spawnAreaId:Y,explorerFolderPath:I,contextMenuActions:Ur,sceneConfig:X,onConfigChange:Fa,onToolChange:ws,onOpenAreaExplorer:fn,onDeleteSelectedAgents:_i,pendingBuildingDelete:Q,onCancelBuildingDelete:()=>K(null),onConfirmBuildingDelete:wo,showBackNavModal:it,onCloseBackNavModal:()=>ht(!1),onLeave:jt,onOpenPM2LogsModal:Ae=>je(Ae),onOpenBossLogsModal:Ae=>Ee(Ae),onOpenDatabasePanel:Ae=>Te(Ae),onSyncScene:()=>{var Ae,Xe;(Ae=Ge.current)==null||Ae.syncAreas(),(Xe=Ge.current)==null||Xe.syncAgents(Array.from(H.getState().agents.values()))}})]})}function Eq(){return o.jsx(NL,{children:o.jsx(RL,{children:o.jsx(_q,{})})})}class Mq extends b.Component{constructor(n){super(n);Ze(this,"handleReload",()=>{window.location.reload()});Ze(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:"💥"}),_n.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:_n.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:_n.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:_n.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:_n.t("common:buttons.tryToContinue")})]}),o.jsx("div",{style:{marginTop:"24px",color:"#666",fontSize:"12px"},children:_n.t("errors:crash.checkConsole")})]})})}return this.props.children}}d6();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 OT=document.getElementById("app");if(!OT)throw new Error("Could not find #app container");const Dq=AM.createRoot(OT);Dq.render(o.jsx(Ce.StrictMode,{children:o.jsx(b.Suspense,{fallback:o.jsx("div",{style:{background:"#0a0a0a",height:"100vh"}}),children:o.jsx(Mq,{children:o.jsx(Eq,{})})})}));console.log("[Tide] Tide Commander initialized");export{ef as $,LL as A,$j as B,VD as C,_L as D,gp as E,bV as F,Qb as G,Dl as H,dx as I,rr as J,cx as K,rL as L,Pa as M,Kq as N,PL as O,va as P,vV as Q,PU as R,ft as S,os as T,dV as U,Bt as V,Kj as W,yV as X,E2 as Y,iu as Z,tf as _,mx as a,Bp as a$,ug as a0,er as a1,wp as a2,uV as a3,lx as a4,Hf as a5,Bq as a6,TL as a7,pb as a8,iV as a9,qD as aA,F5 as aB,m6 as aC,g6 as aD,v6 as aE,Zq as aF,_j as aG,tV as aH,nV as aI,Jb as aJ,Zb as aK,Af as aL,wV as aM,vt as aN,r1 as aO,xV as aP,i1 as aQ,o1 as aR,uu as aS,Dr as aT,Rr as aU,S6 as aV,C6 as aW,Uj as aX,Vg as aY,A6 as aZ,go as a_,Ni as aa,Iq as ab,sV as ac,Yx as ad,Js as ae,du as af,lp as ag,Sa as ah,ir as ai,ex as aj,YD as ak,_n as al,HR as am,GD as an,oV as ao,lV as ap,cV as aq,rV as ar,Bj as as,Fk as at,Yq as au,Ej as av,Qt as aw,i5 as ax,cT as ay,Tp as az,fL as b,a1 as b0,aa as b1,d1 as b2,T6 as b3,Kx as b4,Ib as b5,T4 as b6,Lj as b7,Hq as b8,Qq as b9,Uq as ba,Xq as bb,Jq as bc,Gq as bd,qq as be,eV as bf,vp as bg,qL as bh,j2 as bi,T2 as bj,fV as bk,po as bl,Nu as bm,IL as bn,pV as bo,gV as bp,hV as bq,Vq as br,Wq as bs,mV as bt,UR as bu,WR as bv,Dc as bw,tx as bx,aV as c,pL as d,Gx as e,Ns as f,IU as g,wa as h,Sl as i,o as j,Zk as k,ta as l,An as m,zq as n,Fq as o,Kd as p,xp as q,b as r,H as s,$q as t,pt as u,mb as v,Dt as w,KR as x,QR as y,Ce as z};