@dotobokuri/fleet-console 1.30.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +35 -11
- package/dist/client/assets/{_baseUniq-Dvbxpxj-.js → _baseUniq-6rANA-_q.js} +1 -1
- package/dist/client/assets/{arc-Cqerxs8I.js → arc-tzTBQuJE.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-gNhmCKnU.js → architectureDiagram-Q4EWVU46-B4MzTga_.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-CM5HRpKC.js → blockDiagram-DXYQGD6D-BSkil4Kq.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-DxLhQuvg.js → c4Diagram-AHTNJAMY-Dwq5nIR_.js} +1 -1
- package/dist/client/assets/channel-DGrgEBwr.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-HX6C_GAC.js → chunk-4BX2VUAB-BGefUfmP.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-CoBQUhS4.js → chunk-4TB4RGXK-DBUtBigu.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DWsWxGBm.js → chunk-55IACEB6-BLF4uUa8.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-BXNRu1M4.js → chunk-EDXVE4YY-Cc41I6y_.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DzKgP1_A.js → chunk-FMBD7UC4-C8PUZ57p.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-aqXdvKUD.js → chunk-OYMX7WX6-CYos7ODp.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-BbMqaUb0.js → chunk-QZHKN3VN-I4gCcbsX.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-D8Mo0nv8.js → chunk-YZCP3GAM-CO0vuwK9.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-CKhx9oUH.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-CKhx9oUH.js +1 -0
- package/dist/client/assets/clone-BODjA13N.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-BOuVjjXz.js → cose-bilkent-S5V4N54A-BjXxkeBn.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-BdUFzAj_.js → dagre-KV5264BT-DKVbTDmI.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-C0iFrsGo.js → diagram-5BDNPKRD-C1as30xl.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-CGxGeQZt.js → diagram-G4DWMVQ6-B_G7-yDL.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-Dex5uqlA.js → diagram-MMDJMWI5-B2srczqP.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-O48PEpaS.js → diagram-TYMM5635-pYQydnR9.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-B7PGw3YA.js → erDiagram-SMLLAGMA-AcmG-sIC.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-CCXWJIMw.js → flowDiagram-DWJPFMVM-BRvh-u54.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-B26RghpR.js → ganttDiagram-T4ZO3ILL-CuyxaGr-.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-BJsjMn6A.js → gitGraphDiagram-UUTBAWPF-BWFXSUkW.js} +1 -1
- package/dist/client/assets/{graph-DuEL0RWH.js → graph-BFw4pMat.js} +1 -1
- package/dist/client/assets/index-DD3oRP6t.css +1 -0
- package/dist/client/assets/index-qutkoA_F.js +451 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-D32dz1SM.js → infoDiagram-42DDH7IO-CgrEFkpl.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-4YPQjln0.js → ishikawaDiagram-UXIWVN3A-C1PYBJVn.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-BSvi22HM.js → journeyDiagram-VCZTEJTY-BHC_QZyQ.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-SozOXS7m.js → kanban-definition-6JOO6SKY-BTQZjl-H.js} +1 -1
- package/dist/client/assets/{layout-CNXntIRV.js → layout-LyiAOink.js} +1 -1
- package/dist/client/assets/{linear-9RZPFtO4.js → linear-BWduiQJJ.js} +1 -1
- package/dist/client/assets/{mermaid.core-kwH-UxKY.js → mermaid.core-B2Lf_dRe.js} +4 -4
- package/dist/client/assets/{min-BdN2p8Q_.js → min-BS4WshjZ.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-H-3dJmH9.js → mindmap-definition-QFDTVHPH-uBQw-Rcf.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-CspzYvcs.js → pieDiagram-DEJITSTG-Daco6XeA.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D1C7e3-s.js → quadrantDiagram-34T5L4WZ-phmU55Tk.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-BJwKRtMi.js → requirementDiagram-MS252O5E-D7WmHJB1.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-7oc42Z3P.js → sankeyDiagram-XADWPNL6-QmItdHVw.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-TP5H_DnF.js → sequenceDiagram-FGHM5R23-B-Wgp5TP.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-BWnrNgJY.js → stateDiagram-FHFEXIEX-J7H1J8u1.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-D0qZOg43.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-xXFvCsrr.js → timeline-definition-GMOUNBTQ-BI_kLbxz.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-D5unm_iH.js → vennDiagram-DHZGUBPP-Do5nm7Eq.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-B-eT02rs.js → wardley-RL74JXVD-DvA1fdMU.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BTQ1Yqmb.js → wardleyDiagram-NUSXRM2D-BrigyBQU.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-Bialvg0l.js → xychartDiagram-5P7HB3ND-B0Inv_Uf.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/repository/routes.mjs +216 -11
- package/dist/fleet-plugins/skills/routes.mjs +35 -11
- package/dist/fleet-plugins/terminal/routes.mjs +83 -61
- package/package.json +1 -1
- package/dist/client/assets/channel-DKkQpLWI.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-CQurO5ix.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-CQurO5ix.js +0 -1
- package/dist/client/assets/clone-IodjsAGU.js +0 -1
- package/dist/client/assets/index-Dj775lUe.css +0 -1
- package/dist/client/assets/index-r6rDZQCs.js +0 -451
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Cmp8tobq.js +0 -1
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
function QE(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function $b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function WQ(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var Jg={exports:{}},au={};var Hx;function n6(){if(Hx)return au;Hx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var c=null;if(o!==void 0&&(c=""+o),r.key!==void 0&&(c=""+r.key),"key"in r){o={};for(var d in r)d!=="key"&&(o[d]=r[d])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:c,ref:r!==void 0?r:null,props:o}}return au.Fragment=t,au.jsx=n,au.jsxs=n,au}var Fx;function i6(){return Fx||(Fx=1,Jg.exports=n6()),Jg.exports}var u=i6();const s6=$b(u),r6=QE({__proto__:null,default:s6},[u]);var Qg={exports:{}},ut={};var Ux;function a6(){if(Ux)return ut;Ux=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,E={};function D(R,Y,Z){this.props=R,this.context=Y,this.refs=E,this.updater=Z||w}D.prototype.isReactComponent={},D.prototype.setState=function(R,Y){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Y,"setState")},D.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function j(){}j.prototype=D.prototype;function z(R,Y,Z){this.props=R,this.context=Y,this.refs=E,this.updater=Z||w}var T=z.prototype=new j;T.constructor=z,x(T,D.prototype),T.isPureReactComponent=!0;var N=Array.isArray;function L(){}var H={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function J(R,Y,Z){var me=Z.ref;return{$$typeof:e,type:R,key:Y,ref:me!==void 0?me:null,props:Z}}function pe(R,Y){return J(R.type,Y,R.props)}function G(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function P(R){var Y={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(Z){return Y[Z]})}var A=/\/+/g;function $(R,Y){return typeof R=="object"&&R!==null&&R.key!=null?P(""+R.key):Y.toString(36)}function M(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(L,L):(R.status="pending",R.then(function(Y){R.status==="pending"&&(R.status="fulfilled",R.value=Y)},function(Y){R.status==="pending"&&(R.status="rejected",R.reason=Y)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function k(R,Y,Z,me,ue){var oe=typeof R;(oe==="undefined"||oe==="boolean")&&(R=null);var ke=!1;if(R===null)ke=!0;else switch(oe){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(R.$$typeof){case e:case t:ke=!0;break;case _:return ke=R._init,k(ke(R._payload),Y,Z,me,ue)}}if(ke)return ue=ue(R),ke=me===""?"."+$(R,0):me,N(ue)?(Z="",ke!=null&&(Z=ke.replace(A,"$&/")+"/"),k(ue,Y,Z,"",function(ot){return ot})):ue!=null&&(G(ue)&&(ue=pe(ue,Z+(ue.key==null||R&&R.key===ue.key?"":(""+ue.key).replace(A,"$&/")+"/")+ke)),Y.push(ue)),1;ke=0;var Ne=me===""?".":me+":";if(N(R))for(var Re=0;Re<R.length;Re++)me=R[Re],oe=Ne+$(me,Re),ke+=k(me,Y,Z,oe,ue);else if(Re=S(R),typeof Re=="function")for(R=Re.call(R),Re=0;!(me=R.next()).done;)me=me.value,oe=Ne+$(me,Re++),ke+=k(me,Y,Z,oe,ue);else if(oe==="object"){if(typeof R.then=="function")return k(M(R),Y,Z,me,ue);throw Y=String(R),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return ke}function B(R,Y,Z){if(R==null)return R;var me=[],ue=0;return k(R,me,"","",function(oe){return Y.call(Z,oe,ue++)}),me}function O(R){if(R._status===-1){var Y=R._result;Y=Y(),Y.then(function(Z){(R._status===0||R._status===-1)&&(R._status=1,R._result=Z)},function(Z){(R._status===0||R._status===-1)&&(R._status=2,R._result=Z)}),R._status===-1&&(R._status=0,R._result=Y)}if(R._status===1)return R._result.default;throw R._result}var W=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},U={map:B,forEach:function(R,Y,Z){B(R,function(){Y.apply(this,arguments)},Z)},count:function(R){var Y=0;return B(R,function(){Y++}),Y},toArray:function(R){return B(R,function(Y){return Y})||[]},only:function(R){if(!G(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return ut.Activity=g,ut.Children=U,ut.Component=D,ut.Fragment=n,ut.Profiler=r,ut.PureComponent=z,ut.StrictMode=i,ut.Suspense=f,ut.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ut.__COMPILER_RUNTIME={__proto__:null,c:function(R){return H.H.useMemoCache(R)}},ut.cache=function(R){return function(){return R.apply(null,arguments)}},ut.cacheSignal=function(){return null},ut.cloneElement=function(R,Y,Z){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var me=x({},R.props),ue=R.key;if(Y!=null)for(oe in Y.key!==void 0&&(ue=""+Y.key),Y)!F.call(Y,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&Y.ref===void 0||(me[oe]=Y[oe]);var oe=arguments.length-2;if(oe===1)me.children=Z;else if(1<oe){for(var ke=Array(oe),Ne=0;Ne<oe;Ne++)ke[Ne]=arguments[Ne+2];me.children=ke}return J(R.type,ue,me)},ut.createContext=function(R){return R={$$typeof:c,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:o,_context:R},R},ut.createElement=function(R,Y,Z){var me,ue={},oe=null;if(Y!=null)for(me in Y.key!==void 0&&(oe=""+Y.key),Y)F.call(Y,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(ue[me]=Y[me]);var ke=arguments.length-2;if(ke===1)ue.children=Z;else if(1<ke){for(var Ne=Array(ke),Re=0;Re<ke;Re++)Ne[Re]=arguments[Re+2];ue.children=Ne}if(R&&R.defaultProps)for(me in ke=R.defaultProps,ke)ue[me]===void 0&&(ue[me]=ke[me]);return J(R,oe,ue)},ut.createRef=function(){return{current:null}},ut.forwardRef=function(R){return{$$typeof:d,render:R}},ut.isValidElement=G,ut.lazy=function(R){return{$$typeof:_,_payload:{_status:-1,_result:R},_init:O}},ut.memo=function(R,Y){return{$$typeof:p,type:R,compare:Y===void 0?null:Y}},ut.startTransition=function(R){var Y=H.T,Z={};H.T=Z;try{var me=R(),ue=H.S;ue!==null&&ue(Z,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(L,W)}catch(oe){W(oe)}finally{Y!==null&&Z.types!==null&&(Y.types=Z.types),H.T=Y}},ut.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ut.use=function(R){return H.H.use(R)},ut.useActionState=function(R,Y,Z){return H.H.useActionState(R,Y,Z)},ut.useCallback=function(R,Y){return H.H.useCallback(R,Y)},ut.useContext=function(R){return H.H.useContext(R)},ut.useDebugValue=function(){},ut.useDeferredValue=function(R,Y){return H.H.useDeferredValue(R,Y)},ut.useEffect=function(R,Y){return H.H.useEffect(R,Y)},ut.useEffectEvent=function(R){return H.H.useEffectEvent(R)},ut.useId=function(){return H.H.useId()},ut.useImperativeHandle=function(R,Y,Z){return H.H.useImperativeHandle(R,Y,Z)},ut.useInsertionEffect=function(R,Y){return H.H.useInsertionEffect(R,Y)},ut.useLayoutEffect=function(R,Y){return H.H.useLayoutEffect(R,Y)},ut.useMemo=function(R,Y){return H.H.useMemo(R,Y)},ut.useOptimistic=function(R,Y){return H.H.useOptimistic(R,Y)},ut.useReducer=function(R,Y,Z){return H.H.useReducer(R,Y,Z)},ut.useRef=function(R){return H.H.useRef(R)},ut.useState=function(R){return H.H.useState(R)},ut.useSyncExternalStore=function(R,Y,Z){return H.H.useSyncExternalStore(R,Y,Z)},ut.useTransition=function(){return H.H.useTransition()},ut.version="19.2.7",ut}var Wx;function Pb(){return Wx||(Wx=1,Qg.exports=a6()),Qg.exports}var y=Pb();const o6=$b(y),zf=QE({__proto__:null,default:o6},[y]),l6="fc-operation-body";let Ai=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function e5(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Ai(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(u6).filter(i=>i!==null):[]}function Hf(e){const t=e;if(!t||typeof t.id!="string"||typeof t.theaterId!="string"||typeof t.type!="string"||typeof t.pluginId!="string"||typeof t.title!="string"||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)||t5(t))throw new Ai(500,"Invalid operation response");return t}function t5(e){return Dv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function c6({children:e,className:t}){return u.jsx("div",{className:d6(l6,t),children:e})}function u6(e){if(!n5(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(h6).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function h6(e){return!n5(e)||typeof e.id!="string"||typeof e.type!="string"||typeof e.title!="string"?null:{id:e.id,type:e.type,title:e.title,...typeof e.disabled=="boolean"?{disabled:e.disabled}:{},...typeof e.disabledReason=="string"?{disabledReason:e.disabledReason}:{}}}function n5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Dv(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Dv(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Dv(i,t))}function d6(...e){return e.filter(t=>!!t).join(" ")}const f6=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Ai,OperationBody:c6,assertOperationNode:Hf,fetchOperationCatalog:e5,hasForbiddenBrowserPayloadKey:t5},Symbol.toStringTag,{value:"Module"}));function p6(e){return e}function m6(e){return e}function i5(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(e_(n,i),r).then(S6),subscribe:(n,i,r)=>{const o=new EventSource(e_(n,i));o.onmessage=r;const c=()=>o.close();return t.add(c),()=>{c(),t.delete(c)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,r,o)=>{const c=await fetch(e_(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!c.ok)throw new Ai(c.status,`Terminal ticket request failed: ${c.status}`);const d=await c.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new Ai(c.status,"Invalid terminal ticket response");return{ticket:d.ticket,ttlMs:d.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async n=>{const i=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Ai(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return Hf(r.operation)},rename:async(n,i)=>{const r=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!r.ok)throw new Ai(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return Hf(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Ai(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>x6(n,i),write:(n,i)=>C6(n,i)},settings:{read:async n=>{const i=await fetch(qx(n));if(!i.ok)throw new Ai(i.status,`Plugin settings read failed: ${i.status}`);const o=(await i.json()).value;return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null},write:async(n,i)=>{const r=await fetch(qx(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Ai(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function s5(e,t){return y.useSyncExternalStore(e,t,t)}function g6(){const[e,t]=y.useState([]),n=y.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new Ai(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(Hf):[])},[]);return y.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function _6(e,t){return y.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function v6(e,t){return y.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function y6(e,t,n){const[i,r]=y.useState(()=>e.read(t,n)),o=y.useCallback(c=>{r(c),e.write(t,c)},[e,t]);return[i,o]}function b6(e,t){return y.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function S6(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Ai(e.status,`Plugin request failed: ${e.status}`,t)}return e}function e_(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Ai(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Ai(400,"Invalid plugin path");return`/plugins/${e}${n}`}const w6=/^[a-z0-9][a-z0-9._-]*$/;function qx(e){if(!w6.test(e))throw new Ai(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function x6(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(`fleet-plugin.${e}`);return n===null?t:JSON.parse(n)}catch{return t}}function C6(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const k6=Object.freeze(Object.defineProperty({__proto__:null,React:zf,createClientCapabilities:i5,defineOperationKind:m6,definePlugin:p6,useOperationStatus:b6,useOperations:g6,usePluginApi:_6,usePluginSettings:v6,usePluginStorage:y6,useStoreSnapshot:s5},Symbol.toStringTag,{value:"Module"}));function E6(e){return e}function T6({title:e,description:t,children:n}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:n})]})}function A6({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[u.jsxs("div",{className:"fc-settings-row__copy",children:[u.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-row__hint",id:r,children:t}):null]}),u.jsx("div",{className:"fc-settings-row__control",children:n})]})}function R6({checked:e,onChange:t,label:n,disabled:i=!1}){const r=y.useId();return u.jsxs("label",{className:"fc-settings-toggle",htmlFor:r,children:[u.jsx("input",{id:r,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:i,"aria-label":n?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?u.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function N6({value:e,options:t,onChange:n,label:i,disabled:r=!1}){const o=y.useId(),c=u.jsx("select",{id:o,className:"fc-settings-select__control",value:e,disabled:r,"aria-label":i?void 0:"Select setting",onChange:d=>n(d.currentTarget.value),children:t.map(d=>u.jsx("option",{value:d.value,children:d.label},d.value))});return i?u.jsxs("label",{className:"fc-settings-select",htmlFor:o,children:[u.jsx("span",{className:"fc-settings-select__label",children:i}),c]}):u.jsx("div",{className:"fc-settings-select",children:c})}function L6({label:e,hint:t,children:n}){const i=y.useId(),r=y.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-field__hint",id:r,children:t}):null,u.jsx("div",{className:"fc-settings-field__control",children:n})]})}const M6=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:T6,SettingsField:L6,SettingsRow:A6,SettingsSelect:N6,SettingsToggle:R6,defineSettingsSection:E6},Symbol.toStringTag,{value:"Module"}));function O6(e){return e}const D6=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:O6},Symbol.toStringTag,{value:"Module"})),j6=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Ff extends y.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??j6:this.props.children}}const I6=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Ff,React:zf,default:zf},Symbol.toStringTag,{value:"Module"}));var t_={exports:{}},ou={},n_={exports:{}},i_={};var Gx;function B6(){return Gx||(Gx=1,(function(e){function t(k,B){var O=k.length;k.push(B);e:for(;0<O;){var W=O-1>>>1,U=k[W];if(0<r(U,B))k[W]=B,k[O]=U,O=W;else break e}}function n(k){return k.length===0?null:k[0]}function i(k){if(k.length===0)return null;var B=k[0],O=k.pop();if(O!==B){k[0]=O;e:for(var W=0,U=k.length,R=U>>>1;W<R;){var Y=2*(W+1)-1,Z=k[Y],me=Y+1,ue=k[me];if(0>r(Z,O))me<U&&0>r(ue,Z)?(k[W]=ue,k[me]=O,W=me):(k[W]=Z,k[Y]=O,W=Y);else if(me<U&&0>r(ue,O))k[W]=ue,k[me]=O,W=me;else break e}}return B}function r(k,B){var O=k.sortIndex-B.sortIndex;return O!==0?O:k.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var f=[],p=[],_=1,g=null,b=3,S=!1,w=!1,x=!1,E=!1,D=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function T(k){for(var B=n(p);B!==null;){if(B.callback===null)i(p);else if(B.startTime<=k)i(p),B.sortIndex=B.expirationTime,t(f,B);else break;B=n(p)}}function N(k){if(x=!1,T(k),!w)if(n(f)!==null)w=!0,L||(L=!0,P());else{var B=n(p);B!==null&&M(N,B.startTime-k)}}var L=!1,H=-1,F=5,J=-1;function pe(){return E?!0:!(e.unstable_now()-J<F)}function G(){if(E=!1,L){var k=e.unstable_now();J=k;var B=!0;try{e:{w=!1,x&&(x=!1,j(H),H=-1),S=!0;var O=b;try{t:{for(T(k),g=n(f);g!==null&&!(g.expirationTime>k&&pe());){var W=g.callback;if(typeof W=="function"){g.callback=null,b=g.priorityLevel;var U=W(g.expirationTime<=k);if(k=e.unstable_now(),typeof U=="function"){g.callback=U,T(k),B=!0;break t}g===n(f)&&i(f),T(k)}else i(f);g=n(f)}if(g!==null)B=!0;else{var R=n(p);R!==null&&M(N,R.startTime-k),B=!1}}break e}finally{g=null,b=O,S=!1}B=void 0}}finally{B?P():L=!1}}}var P;if(typeof z=="function")P=function(){z(G)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,$=A.port2;A.port1.onmessage=G,P=function(){$.postMessage(null)}}else P=function(){D(G,0)};function M(k,B){H=D(function(){k(e.unstable_now())},B)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(k){switch(b){case 1:case 2:case 3:var B=3;break;default:B=b}var O=b;b=B;try{return k()}finally{b=O}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(k,B){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var O=b;b=k;try{return B()}finally{b=O}},e.unstable_scheduleCallback=function(k,B,O){var W=e.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?W+O:W):O=W,k){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=O+U,k={id:_++,callback:B,priorityLevel:k,startTime:O,expirationTime:U,sortIndex:-1},O>W?(k.sortIndex=O,t(p,k),n(f)===null&&k===n(p)&&(x?(j(H),H=-1):x=!0,M(N,O-W))):(k.sortIndex=U,t(f,k),w||S||(w=!0,L||(L=!0,P()))),k},e.unstable_shouldYield=pe,e.unstable_wrapCallback=function(k){var B=b;return function(){var O=b;b=B;try{return k.apply(this,arguments)}finally{b=O}}}})(i_)),i_}var Kx;function $6(){return Kx||(Kx=1,n_.exports=B6()),n_.exports}var s_={exports:{}},Ei={};var Vx;function P6(){if(Vx)return Ei;Vx=1;var e=Pb();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)p+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(f,p,_){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:f,containerInfo:p,implementation:_}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ei.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ei.createPortal=function(f,p){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return o(f,p,null,_)},Ei.flushSync=function(f){var p=c.T,_=i.p;try{if(c.T=null,i.p=2,f)return f()}finally{c.T=p,i.p=_,i.d.f()}},Ei.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(f,p))},Ei.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},Ei.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var _=p.as,g=d(_,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;_==="style"?i.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:S}):_==="script"&&i.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ei.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var _=d(p.as,p.crossOrigin);i.d.M(f,{crossOrigin:_,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(f)},Ei.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var _=p.as,g=d(_,p.crossOrigin);i.d.L(f,_,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ei.preloadModule=function(f,p){if(typeof f=="string")if(p){var _=d(p.as,p.crossOrigin);i.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:_,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(f)},Ei.requestFormReset=function(f){i.d.r(f)},Ei.unstable_batchedUpdates=function(f,p){return f(p)},Ei.useFormState=function(f,p,_){return c.H.useFormState(f,p,_)},Ei.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ei.version="19.2.7",Ei}var Yx;function r5(){if(Yx)return s_.exports;Yx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),s_.exports=P6(),s_.exports}var Xx;function z6(){if(Xx)return ou;Xx=1;var e=$6(),t=Pb(),n=r5();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function c(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(i(188))}function p(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(i(188));return a!==s?null:s}for(var l=s,h=a;;){var m=l.return;if(m===null)break;var v=m.alternate;if(v===null){if(h=m.return,h!==null){l=h;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===l)return f(m),s;if(v===h)return f(m),a;v=v.sibling}throw Error(i(188))}if(l.return!==h.return)l=m,h=v;else{for(var C=!1,I=m.child;I;){if(I===l){C=!0,l=m,h=v;break}if(I===h){C=!0,h=m,l=v;break}I=I.sibling}if(!C){for(I=v.child;I;){if(I===l){C=!0,l=v,h=m;break}if(I===h){C=!0,h=v,l=m;break}I=I.sibling}if(!C)throw Error(i(189))}}if(l.alternate!==h)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?s:a}function _(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=_(s),a!==null)return a;s=s.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),z=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=G&&s[G]||s["@@iterator"],typeof s=="function"?s:null)}var A=Symbol.for("react.client.reference");function $(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===A?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case D:return"Profiler";case E:return"StrictMode";case N:return"Suspense";case L:return"SuspenseList";case J:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case z:return s.displayName||"Context";case j:return(s._context.displayName||"Context")+".Consumer";case T:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case H:return a=s.displayName||null,a!==null?a:$(s.type)||"Memo";case F:a=s._payload,s=s._init;try{return $(s(a))}catch{}}return null}var M=Array.isArray,k=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},W=[],U=-1;function R(s){return{current:s}}function Y(s){0>U||(s.current=W[U],W[U]=null,U--)}function Z(s,a){U++,W[U]=s.current,s.current=a}var me=R(null),ue=R(null),oe=R(null),ke=R(null);function Ne(s,a){switch(Z(oe,a),Z(ue,s),Z(me,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?ux(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=ux(a),s=hx(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Y(me),Z(me,s)}function Re(){Y(me),Y(ue),Y(oe)}function ot(s){s.memoizedState!==null&&Z(ke,s);var a=me.current,l=hx(a,s.type);a!==l&&(Z(ue,s),Z(me,l))}function Le(s){ue.current===s&&(Y(me),Y(ue)),ke.current===s&&(Y(ke),nu._currentValue=O)}var Se,xe;function Me(s){if(Se===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Se=a&&a[1]||"",xe=-1<l.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Se+s+xe}var Ke=!1;function it(s,a){if(!s||Ke)return"";Ke=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(ce){var ae=ce}Reflect.construct(s,[],_e)}else{try{_e.call()}catch(ce){ae=ce}s.call(_e.prototype)}}else{try{throw Error()}catch(ce){ae=ce}(_e=s())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(ce){if(ce&&ae&&typeof ce.stack=="string")return[ce.stack,ae.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=h.DetermineComponentFrameRoot(),C=v[0],I=v[1];if(C&&I){var V=C.split(`
|
|
4
|
-
`),ne=I.split(`
|
|
5
|
-
`);for(m=h=0;h<V.length&&!V[h].includes("DetermineComponentFrameRoot");)h++;for(;m<ne.length&&!ne[m].includes("DetermineComponentFrameRoot");)m++;if(h===V.length||m===ne.length)for(h=V.length-1,m=ne.length-1;1<=h&&0<=m&&V[h]!==ne[m];)m--;for(;1<=h&&0<=m;h--,m--)if(V[h]!==ne[m]){if(h!==1||m!==1)do if(h--,m--,0>m||V[h]!==ne[m]){var fe=`
|
|
6
|
-
`+V[h].replace(" at new "," at ");return s.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",s.displayName)),fe}while(1<=h&&0<=m);break}}}finally{Ke=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Me(l):""}function Ge(s,a){switch(s.tag){case 26:case 27:case 5:return Me(s.type);case 16:return Me("Lazy");case 13:return s.child!==a&&a!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return it(s.type,!1);case 11:return it(s.type.render,!1);case 1:return it(s.type,!0);case 31:return Me("Activity");default:return""}}function he(s){try{var a="",l=null;do a+=Ge(s,l),l=s,s=s.return;while(s);return a}catch(h){return`
|
|
7
|
-
Error generating stack: `+h.message+`
|
|
8
|
-
`+h.stack}}var Qe=Object.prototype.hasOwnProperty,Ye=e.unstable_scheduleCallback,Ht=e.unstable_cancelCallback,we=e.unstable_shouldYield,Je=e.unstable_requestPaint,st=e.unstable_now,Vn=e.unstable_getCurrentPriorityLevel,bt=e.unstable_ImmediatePriority,Ee=e.unstable_UserBlockingPriority,ft=e.unstable_NormalPriority,pn=e.unstable_LowPriority,Ci=e.unstable_IdlePriority,In=e.log,Mn=e.unstable_setDisableYieldValue,mn=null,ie=null;function le(s){if(typeof In=="function"&&Mn(s),ie&&typeof ie.setStrictMode=="function")try{ie.setStrictMode(mn,s)}catch{}}var Pe=Math.clz32?Math.clz32:Mt,De=Math.log,Ue=Math.LN2;function Mt(s){return s>>>=0,s===0?32:31-(De(s)/Ue|0)|0}var Ni=256,Ot=262144,Bn=4194304;function Gt(s){var a=s&42;if(a!==0)return a;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function K(s,a,l){var h=s.pendingLanes;if(h===0)return 0;var m=0,v=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var I=h&134217727;return I!==0?(h=I&~v,h!==0?m=Gt(h):(C&=I,C!==0?m=Gt(C):l||(l=I&~s,l!==0&&(m=Gt(l))))):(I=h&~v,I!==0?m=Gt(I):C!==0?m=Gt(C):l||(l=h&~s,l!==0&&(m=Gt(l)))),m===0?0:a!==0&&a!==m&&(a&v)===0&&(v=m&-m,l=a&-a,v>=l||v===32&&(l&4194048)!==0)?a:m}function de(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function ye(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 He(){var s=Bn;return Bn<<=1,(Bn&62914560)===0&&(Bn=4194304),s}function Ft(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function Dt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function $e(s,a,l,h,m,v){var C=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var I=s.entanglements,V=s.expirationTimes,ne=s.hiddenUpdates;for(l=C&~l;0<l;){var fe=31-Pe(l),_e=1<<fe;I[fe]=0,V[fe]=-1;var ae=ne[fe];if(ae!==null)for(ne[fe]=null,fe=0;fe<ae.length;fe++){var ce=ae[fe];ce!==null&&(ce.lane&=-536870913)}l&=~_e}h!==0&&Oe(s,h,0),v!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=v&~(C&~a))}function Oe(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-Pe(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|l&261930}function Xe(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var h=31-Pe(l),m=1<<h;m&a|s[h]&a&&(s[h]|=a),l&=~m}}function on(s,a){var l=a&-a;return l=(l&42)!==0?1:St(l),(l&(s.suspendedLanes|a))!==0?0:l}function St(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Yn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Hs(){var s=B.p;return s!==0?s:(s=window.event,s===void 0?32:Dx(s.type))}function ns(s,a){var l=B.p;try{return B.p=s,a()}finally{B.p=l}}var pi=Math.random().toString(36).slice(2),Kt="__reactFiber$"+pi,re="__reactProps$"+pi,ht="__reactContainer$"+pi,Vt="__reactEvents$"+pi,xt="__reactListeners$"+pi,rt="__reactHandles$"+pi,xn="__reactResources$"+pi,gn="__reactMarker$"+pi;function je(s){delete s[Kt],delete s[re],delete s[Vt],delete s[xt],delete s[rt]}function q(s){var a=s[Kt];if(a)return a;for(var l=s.parentNode;l;){if(a=l[ht]||l[Kt]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=vx(s);s!==null;){if(l=s[Kt])return l;s=vx(s)}return a}s=l,l=s.parentNode}return null}function se(s){if(s=s[Kt]||s[ht]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Ae(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function lt(s){var a=s[xn];return a||(a=s[xn]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ct(s){s[gn]=!0}var Pt=new Set,tn={};function Lt(s,a){be(s,a),be(s+"Capture",a)}function be(s,a){for(tn[s]=a,s=0;s<a.length;s++)Pt.add(a[s])}var Fe=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]*$"),Be={},Et={};function rn(s){return Qe.call(Et,s)?!0:Qe.call(Be,s)?!1:Fe.test(s)?Et[s]=!0:(Be[s]=!0,!1)}function Xn(s,a,l){if(rn(a))if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+l)}}function Li(s,a,l){if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+l)}}function ki(s,a,l,h){if(h===null)s.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(a,l,""+h)}}function Yt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function is(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Th(s,a,l){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var m=h.get,v=h.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return m.call(this)},set:function(C){l=""+C,v.call(this,C)}}),Object.defineProperty(s,a,{enumerable:h.enumerable}),{getValue:function(){return l},setValue:function(C){l=""+C},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function qo(s){if(!s._valueTracker){var a=is(s)?"checked":"value";s._valueTracker=Th(s,a,""+s[a])}}function mc(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),h="";return s&&(h=is(s)?s.checked?"true":"false":s.value),s=h,s!==l?(a.setValue(s),!0):!1}function Go(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Zp=/[\n"\\]/g;function Ui(s){return s.replace(Zp,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function gc(s,a,l,h,m,v,C,I){s.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.type=C:s.removeAttribute("type"),a!=null?C==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Yt(a)):s.value!==""+Yt(a)&&(s.value=""+Yt(a)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),a!=null?Ko(s,C,Yt(a)):l!=null?Ko(s,C,Yt(l)):h!=null&&s.removeAttribute("value"),m==null&&v!=null&&(s.defaultChecked=!!v),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.name=""+Yt(I):s.removeAttribute("name")}function Ja(s,a,l,h,m,v,C,I){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),a!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){qo(s);return}l=l!=null?""+Yt(l):"",a=a!=null?""+Yt(a):l,I||a===s.value||(s.value=a),s.defaultValue=a}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=I?s.checked:!!h,s.defaultChecked=!!h,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.name=C),qo(s)}function Ko(s,a,l){a==="number"&&Go(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function mi(s,a,l,h){if(s=s.options,a){a={};for(var m=0;m<l.length;m++)a["$"+l[m]]=!0;for(l=0;l<s.length;l++)m=a.hasOwnProperty("$"+s[l].value),s[l].selected!==m&&(s[l].selected=m),m&&h&&(s[l].defaultSelected=!0)}else{for(l=""+Yt(l),a=null,m=0;m<s.length;m++){if(s[m].value===l){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}a!==null||s[m].disabled||(a=s[m])}a!==null&&(a.selected=!0)}}function Ah(s,a,l){if(a!=null&&(a=""+Yt(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+Yt(l):""}function Vo(s,a,l,h){if(a==null){if(h!=null){if(l!=null)throw Error(i(92));if(M(h)){if(1<h.length)throw Error(i(93));h=h[0]}l=h}l==null&&(l=""),a=l}l=Yt(a),s.defaultValue=l,h=s.textContent,h===l&&h!==""&&h!==null&&(s.value=h),qo(s)}function nt(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Rh=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 $n(s,a,l){var h=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?h?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":h?s.setProperty(a,l):typeof l!="number"||l===0||Rh.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Ut(s,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,l!=null){for(var h in l)!l.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in a)h=a[m],a.hasOwnProperty(m)&&l[m]!==h&&$n(s,m,h)}else for(var v in a)a.hasOwnProperty(v)&&$n(s,v,a[v])}function ta(s){if(s.indexOf("-")===-1)return!1;switch(s){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 Sr=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"]]),_c=/^[\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 na(s){return _c.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Te(){}var We=null;function dt(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Tt=null,bn=null;function ys(s){var a=se(s);if(a&&(s=a.stateNode)){var l=s[re]||null;e:switch(s=a.stateNode,a.type){case"input":if(gc(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ui(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var h=l[a];if(h!==s&&h.form===s.form){var m=h[re]||null;if(!m)throw Error(i(90));gc(h,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(a=0;a<l.length;a++)h=l[a],h.form===s.form&&mc(h)}break e;case"textarea":Ah(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&mi(s,!!l.multiple,a,!1)}}}var vc=!1;function Nh(s,a,l){if(vc)return s(a,l);vc=!0;try{var h=s(a);return h}finally{if(vc=!1,(Tt!==null||bn!==null)&&(_d(),Tt&&(a=Tt,s=bn,bn=Tt=null,ys(a),s)))for(a=0;a<s.length;a++)ys(s[a])}}function yc(s,a){var l=s.stateNode;if(l===null)return null;var h=l[re]||null;if(h===null)return null;l=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jp=!1;if(wr)try{var bc={};Object.defineProperty(bc,"passive",{get:function(){Jp=!0}}),window.addEventListener("test",bc,bc),window.removeEventListener("test",bc,bc)}catch{Jp=!1}var ia=null,Qp=null,Lh=null;function h1(){if(Lh)return Lh;var s,a=Qp,l=a.length,h,m="value"in ia?ia.value:ia.textContent,v=m.length;for(s=0;s<l&&a[s]===m[s];s++);var C=l-s;for(h=1;h<=C&&a[l-h]===m[v-h];h++);return Lh=m.slice(s,1<h?1-h:void 0)}function Mh(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Oh(){return!0}function d1(){return!1}function Wi(s){function a(l,h,m,v,C){this._reactName=l,this._targetInst=m,this.type=h,this.nativeEvent=v,this.target=C,this.currentTarget=null;for(var I in s)s.hasOwnProperty(I)&&(l=s[I],this[I]=l?l(v):v[I]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Oh:d1,this.isPropagationStopped=d1,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Oh)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Oh)},persist:function(){},isPersistent:Oh}),a}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dh=Wi(Qa),Sc=g({},Qa,{view:0,detail:0}),eM=Wi(Sc),em,tm,wc,jh=g({},Sc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:im,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==wc&&(wc&&s.type==="mousemove"?(em=s.screenX-wc.screenX,tm=s.screenY-wc.screenY):tm=em=0,wc=s),em)},movementY:function(s){return"movementY"in s?s.movementY:tm}}),f1=Wi(jh),tM=g({},jh,{dataTransfer:0}),nM=Wi(tM),iM=g({},Sc,{relatedTarget:0}),nm=Wi(iM),sM=g({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),rM=Wi(sM),aM=g({},Qa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),oM=Wi(aM),lM=g({},Qa,{data:0}),p1=Wi(lM),cM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uM={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"},hM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dM(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=hM[s])?!!a[s]:!1}function im(){return dM}var fM=g({},Sc,{key:function(s){if(s.key){var a=cM[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Mh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?uM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:im,charCode:function(s){return s.type==="keypress"?Mh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Mh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),pM=Wi(fM),mM=g({},jh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m1=Wi(mM),gM=g({},Sc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:im}),_M=Wi(gM),vM=g({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),yM=Wi(vM),bM=g({},jh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),SM=Wi(bM),wM=g({},Qa,{newState:0,oldState:0}),xM=Wi(wM),CM=[9,13,27,32],sm=wr&&"CompositionEvent"in window,xc=null;wr&&"documentMode"in document&&(xc=document.documentMode);var kM=wr&&"TextEvent"in window&&!xc,g1=wr&&(!sm||xc&&8<xc&&11>=xc),_1=" ",v1=!1;function y1(s,a){switch(s){case"keyup":return CM.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Yo=!1;function EM(s,a){switch(s){case"compositionend":return b1(a);case"keypress":return a.which!==32?null:(v1=!0,_1);case"textInput":return s=a.data,s===_1&&v1?null:s;default:return null}}function TM(s,a){if(Yo)return s==="compositionend"||!sm&&y1(s,a)?(s=h1(),Lh=Qp=ia=null,Yo=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return g1&&a.locale!=="ko"?null:a.data;default:return null}}var AM={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 S1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!AM[s.type]:a==="textarea"}function w1(s,a,l,h){Tt?bn?bn.push(h):bn=[h]:Tt=h,a=Cd(a,"onChange"),0<a.length&&(l=new Dh("onChange","change",null,l,h),s.push({event:l,listeners:a}))}var Cc=null,kc=null;function RM(s){sx(s,0)}function Ih(s){var a=Ae(s);if(mc(a))return s}function x1(s,a){if(s==="change")return a}var C1=!1;if(wr){var rm;if(wr){var am="oninput"in document;if(!am){var k1=document.createElement("div");k1.setAttribute("oninput","return;"),am=typeof k1.oninput=="function"}rm=am}else rm=!1;C1=rm&&(!document.documentMode||9<document.documentMode)}function E1(){Cc&&(Cc.detachEvent("onpropertychange",T1),kc=Cc=null)}function T1(s){if(s.propertyName==="value"&&Ih(kc)){var a=[];w1(a,kc,s,dt(s)),Nh(RM,a)}}function NM(s,a,l){s==="focusin"?(E1(),Cc=a,kc=l,Cc.attachEvent("onpropertychange",T1)):s==="focusout"&&E1()}function LM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Ih(kc)}function MM(s,a){if(s==="click")return Ih(a)}function OM(s,a){if(s==="input"||s==="change")return Ih(a)}function DM(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ss=typeof Object.is=="function"?Object.is:DM;function Ec(s,a){if(ss(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),h=Object.keys(a);if(l.length!==h.length)return!1;for(h=0;h<l.length;h++){var m=l[h];if(!Qe.call(a,m)||!ss(s[m],a[m]))return!1}return!0}function A1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function R1(s,a){var l=A1(s);s=0;for(var h;l;){if(l.nodeType===3){if(h=s+l.textContent.length,s<=a&&h>=a)return{node:l,offset:a-s};s=h}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=A1(l)}}function N1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?N1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function L1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Go(s.document);a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=Go(s.document)}return a}function om(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var jM=wr&&"documentMode"in document&&11>=document.documentMode,Xo=null,lm=null,Tc=null,cm=!1;function M1(s,a,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;cm||Xo==null||Xo!==Go(h)||(h=Xo,"selectionStart"in h&&om(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Tc&&Ec(Tc,h)||(Tc=h,h=Cd(lm,"onSelect"),0<h.length&&(a=new Dh("onSelect","select",null,a,l),s.push({event:a,listeners:h}),a.target=Xo)))}function eo(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var Zo={animationend:eo("Animation","AnimationEnd"),animationiteration:eo("Animation","AnimationIteration"),animationstart:eo("Animation","AnimationStart"),transitionrun:eo("Transition","TransitionRun"),transitionstart:eo("Transition","TransitionStart"),transitioncancel:eo("Transition","TransitionCancel"),transitionend:eo("Transition","TransitionEnd")},um={},O1={};wr&&(O1=document.createElement("div").style,"AnimationEvent"in window||(delete Zo.animationend.animation,delete Zo.animationiteration.animation,delete Zo.animationstart.animation),"TransitionEvent"in window||delete Zo.transitionend.transition);function to(s){if(um[s])return um[s];if(!Zo[s])return s;var a=Zo[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in O1)return um[s]=a[l];return s}var D1=to("animationend"),j1=to("animationiteration"),I1=to("animationstart"),IM=to("transitionrun"),BM=to("transitionstart"),$M=to("transitioncancel"),B1=to("transitionend"),$1=new Map,hm="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(" ");hm.push("scrollEnd");function Fs(s,a){$1.set(s,a),Lt(a,[s])}var Bh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},bs=[],Jo=0,dm=0;function $h(){for(var s=Jo,a=dm=Jo=0;a<s;){var l=bs[a];bs[a++]=null;var h=bs[a];bs[a++]=null;var m=bs[a];bs[a++]=null;var v=bs[a];if(bs[a++]=null,h!==null&&m!==null){var C=h.pending;C===null?m.next=m:(m.next=C.next,C.next=m),h.pending=m}v!==0&&P1(l,m,v)}}function Ph(s,a,l,h){bs[Jo++]=s,bs[Jo++]=a,bs[Jo++]=l,bs[Jo++]=h,dm|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function fm(s,a,l,h){return Ph(s,a,l,h),zh(s)}function no(s,a){return Ph(s,null,null,a),zh(s)}function P1(s,a,l){s.lanes|=l;var h=s.alternate;h!==null&&(h.lanes|=l);for(var m=!1,v=s.return;v!==null;)v.childLanes|=l,h=v.alternate,h!==null&&(h.childLanes|=l),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(m=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,m&&a!==null&&(m=31-Pe(l),s=v.hiddenUpdates,h=s[m],h===null?s[m]=[a]:h.push(a),a.lane=l|536870912),v):null}function zh(s){if(50<Yc)throw Yc=0,wg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var Qo={};function PM(s,a,l,h){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rs(s,a,l,h){return new PM(s,a,l,h)}function pm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function xr(s,a){var l=s.alternate;return l===null?(l=rs(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function z1(s,a){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,a=l.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function Hh(s,a,l,h,m,v){var C=0;if(h=s,typeof s=="function")pm(s)&&(C=1);else if(typeof s=="string")C=W3(s,l,me.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case J:return s=rs(31,l,a,m),s.elementType=J,s.lanes=v,s;case x:return io(l.children,m,v,a);case E:C=8,m|=24;break;case D:return s=rs(12,l,a,m|2),s.elementType=D,s.lanes=v,s;case N:return s=rs(13,l,a,m),s.elementType=N,s.lanes=v,s;case L:return s=rs(19,l,a,m),s.elementType=L,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case z:C=10;break e;case j:C=9;break e;case T:C=11;break e;case H:C=14;break e;case F:C=16,h=null;break e}C=29,l=Error(i(130,s===null?"null":typeof s,"")),h=null}return a=rs(C,l,a,m),a.elementType=s,a.type=h,a.lanes=v,a}function io(s,a,l,h){return s=rs(7,s,h,a),s.lanes=l,s}function mm(s,a,l){return s=rs(6,s,null,a),s.lanes=l,s}function H1(s){var a=rs(18,null,null,0);return a.stateNode=s,a}function gm(s,a,l){return a=rs(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var F1=new WeakMap;function Ss(s,a){if(typeof s=="object"&&s!==null){var l=F1.get(s);return l!==void 0?l:(a={value:s,source:a,stack:he(a)},F1.set(s,a),a)}return{value:s,source:a,stack:he(a)}}var el=[],tl=0,Fh=null,Ac=0,ws=[],xs=0,sa=null,nr=1,ir="";function Cr(s,a){el[tl++]=Ac,el[tl++]=Fh,Fh=s,Ac=a}function U1(s,a,l){ws[xs++]=nr,ws[xs++]=ir,ws[xs++]=sa,sa=s;var h=nr;s=ir;var m=32-Pe(h)-1;h&=~(1<<m),l+=1;var v=32-Pe(a)+m;if(30<v){var C=m-m%5;v=(h&(1<<C)-1).toString(32),h>>=C,m-=C,nr=1<<32-Pe(a)+m|l<<m|h,ir=v+s}else nr=1<<v|l<<m|h,ir=s}function _m(s){s.return!==null&&(Cr(s,1),U1(s,1,0))}function vm(s){for(;s===Fh;)Fh=el[--tl],el[tl]=null,Ac=el[--tl],el[tl]=null;for(;s===sa;)sa=ws[--xs],ws[xs]=null,ir=ws[--xs],ws[xs]=null,nr=ws[--xs],ws[xs]=null}function W1(s,a){ws[xs++]=nr,ws[xs++]=ir,ws[xs++]=sa,nr=a.id,ir=a.overflow,sa=s}var gi=null,ln=null,Nt=!1,ra=null,Cs=!1,ym=Error(i(519));function aa(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Rc(Ss(a,s)),ym}function q1(s){var a=s.stateNode,l=s.type,h=s.memoizedProps;switch(a[Kt]=s,a[re]=h,l){case"dialog":kt("cancel",a),kt("close",a);break;case"iframe":case"object":case"embed":kt("load",a);break;case"video":case"audio":for(l=0;l<Zc.length;l++)kt(Zc[l],a);break;case"source":kt("error",a);break;case"img":case"image":case"link":kt("error",a),kt("load",a);break;case"details":kt("toggle",a);break;case"input":kt("invalid",a),Ja(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":kt("invalid",a);break;case"textarea":kt("invalid",a),Vo(a,h.value,h.defaultValue,h.children)}l=h.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||h.suppressHydrationWarning===!0||lx(a.textContent,l)?(h.popover!=null&&(kt("beforetoggle",a),kt("toggle",a)),h.onScroll!=null&&kt("scroll",a),h.onScrollEnd!=null&&kt("scrollend",a),h.onClick!=null&&(a.onclick=Te),a=!0):a=!1,a||aa(s,!0)}function G1(s){for(gi=s.return;gi;)switch(gi.tag){case 5:case 31:case 13:Cs=!1;return;case 27:case 3:Cs=!0;return;default:gi=gi.return}}function nl(s){if(s!==gi)return!1;if(!Nt)return G1(s),Nt=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||Bg(s.type,s.memoizedProps)),l=!l),l&&ln&&aa(s),G1(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));ln=_x(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));ln=_x(s)}else a===27?(a=ln,ba(s.type)?(s=Fg,Fg=null,ln=s):ln=a):ln=gi?Es(s.stateNode.nextSibling):null;return!0}function so(){ln=gi=null,Nt=!1}function bm(){var s=ra;return s!==null&&(Vi===null?Vi=s:Vi.push.apply(Vi,s),ra=null),s}function Rc(s){ra===null?ra=[s]:ra.push(s)}var Sm=R(null),ro=null,kr=null;function oa(s,a,l){Z(Sm,a._currentValue),a._currentValue=l}function Er(s){s._currentValue=Sm.current,Y(Sm)}function wm(s,a,l){for(;s!==null;){var h=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),s===l)break;s=s.return}}function xm(s,a,l,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var v=m.dependencies;if(v!==null){var C=m.child;v=v.firstContext;e:for(;v!==null;){var I=v;v=m;for(var V=0;V<a.length;V++)if(I.context===a[V]){v.lanes|=l,I=v.alternate,I!==null&&(I.lanes|=l),wm(v.return,l,s),h||(C=null);break e}v=I.next}}else if(m.tag===18){if(C=m.return,C===null)throw Error(i(341));C.lanes|=l,v=C.alternate,v!==null&&(v.lanes|=l),wm(C,l,s),C=null}else C=m.child;if(C!==null)C.return=m;else for(C=m;C!==null;){if(C===s){C=null;break}if(m=C.sibling,m!==null){m.return=C.return,C=m;break}C=C.return}m=C}}function il(s,a,l,h){s=null;for(var m=a,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var C=m.alternate;if(C===null)throw Error(i(387));if(C=C.memoizedProps,C!==null){var I=m.type;ss(m.pendingProps.value,C.value)||(s!==null?s.push(I):s=[I])}}else if(m===ke.current){if(C=m.alternate,C===null)throw Error(i(387));C.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(nu):s=[nu])}m=m.return}s!==null&&xm(a,s,l,h),a.flags|=262144}function Uh(s){for(s=s.firstContext;s!==null;){if(!ss(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function ao(s){ro=s,kr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function _i(s){return K1(ro,s)}function Wh(s,a){return ro===null&&ao(s),K1(s,a)}function K1(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},kr===null){if(s===null)throw Error(i(308));kr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else kr=kr.next=a;return l}var zM=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(l,h){s.push(h)}};this.abort=function(){a.aborted=!0,s.forEach(function(l){return l()})}},HM=e.unstable_scheduleCallback,FM=e.unstable_NormalPriority,Pn={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cm(){return{controller:new zM,data:new Map,refCount:0}}function Nc(s){s.refCount--,s.refCount===0&&HM(FM,function(){s.controller.abort()})}var Lc=null,km=0,sl=0,rl=null;function UM(s,a){if(Lc===null){var l=Lc=[];km=0,sl=Ag(),rl={status:"pending",value:void 0,then:function(h){l.push(h)}}}return km++,a.then(V1,V1),a}function V1(){if(--km===0&&Lc!==null){rl!==null&&(rl.status="fulfilled");var s=Lc;Lc=null,sl=0,rl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function WM(s,a){var l=[],h={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return s.then(function(){h.status="fulfilled",h.value=a;for(var m=0;m<l.length;m++)(0,l[m])(a)},function(m){for(h.status="rejected",h.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),h}var Y1=k.S;k.S=function(s,a){Mw=st(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&UM(s,a),Y1!==null&&Y1(s,a)};var oo=R(null);function Em(){var s=oo.current;return s!==null?s:nn.pooledCache}function qh(s,a){a===null?Z(oo,oo.current):Z(oo,a.pool)}function X1(){var s=Em();return s===null?null:{parent:Pn._currentValue,pool:s}}var al=Error(i(460)),Tm=Error(i(474)),Gh=Error(i(542)),Kh={then:function(){}};function Z1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function J1(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(Te,Te),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,eS(s),s;default:if(typeof a.status=="string")a.then(Te,Te);else{if(s=nn,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(h){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=h}},function(h){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,eS(s),s}throw co=a,al}}function lo(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(co=l,al):l}}var co=null;function Q1(){if(co===null)throw Error(i(459));var s=co;return co=null,s}function eS(s){if(s===al||s===Gh)throw Error(i(483))}var ol=null,Mc=0;function Vh(s){var a=Mc;return Mc+=1,ol===null&&(ol=[]),J1(ol,s,a)}function Oc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Yh(s,a){throw a.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function tS(s){function a(Q,X){if(s){var te=Q.deletions;te===null?(Q.deletions=[X],Q.flags|=16):te.push(X)}}function l(Q,X){if(!s)return null;for(;X!==null;)a(Q,X),X=X.sibling;return null}function h(Q){for(var X=new Map;Q!==null;)Q.key!==null?X.set(Q.key,Q):X.set(Q.index,Q),Q=Q.sibling;return X}function m(Q,X){return Q=xr(Q,X),Q.index=0,Q.sibling=null,Q}function v(Q,X,te){return Q.index=te,s?(te=Q.alternate,te!==null?(te=te.index,te<X?(Q.flags|=67108866,X):te):(Q.flags|=67108866,X)):(Q.flags|=1048576,X)}function C(Q){return s&&Q.alternate===null&&(Q.flags|=67108866),Q}function I(Q,X,te,ge){return X===null||X.tag!==6?(X=mm(te,Q.mode,ge),X.return=Q,X):(X=m(X,te),X.return=Q,X)}function V(Q,X,te,ge){var Ve=te.type;return Ve===x?fe(Q,X,te.props.children,ge,te.key):X!==null&&(X.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===F&&lo(Ve)===X.type)?(X=m(X,te.props),Oc(X,te),X.return=Q,X):(X=Hh(te.type,te.key,te.props,null,Q.mode,ge),Oc(X,te),X.return=Q,X)}function ne(Q,X,te,ge){return X===null||X.tag!==4||X.stateNode.containerInfo!==te.containerInfo||X.stateNode.implementation!==te.implementation?(X=gm(te,Q.mode,ge),X.return=Q,X):(X=m(X,te.children||[]),X.return=Q,X)}function fe(Q,X,te,ge,Ve){return X===null||X.tag!==7?(X=io(te,Q.mode,ge,Ve),X.return=Q,X):(X=m(X,te),X.return=Q,X)}function _e(Q,X,te){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=mm(""+X,Q.mode,te),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return te=Hh(X.type,X.key,X.props,null,Q.mode,te),Oc(te,X),te.return=Q,te;case w:return X=gm(X,Q.mode,te),X.return=Q,X;case F:return X=lo(X),_e(Q,X,te)}if(M(X)||P(X))return X=io(X,Q.mode,te,null),X.return=Q,X;if(typeof X.then=="function")return _e(Q,Vh(X),te);if(X.$$typeof===z)return _e(Q,Wh(Q,X),te);Yh(Q,X)}return null}function ae(Q,X,te,ge){var Ve=X!==null?X.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ve!==null?null:I(Q,X,""+te,ge);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return te.key===Ve?V(Q,X,te,ge):null;case w:return te.key===Ve?ne(Q,X,te,ge):null;case F:return te=lo(te),ae(Q,X,te,ge)}if(M(te)||P(te))return Ve!==null?null:fe(Q,X,te,ge,null);if(typeof te.then=="function")return ae(Q,X,Vh(te),ge);if(te.$$typeof===z)return ae(Q,X,Wh(Q,te),ge);Yh(Q,te)}return null}function ce(Q,X,te,ge,Ve){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return Q=Q.get(te)||null,I(X,Q,""+ge,Ve);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return Q=Q.get(ge.key===null?te:ge.key)||null,V(X,Q,ge,Ve);case w:return Q=Q.get(ge.key===null?te:ge.key)||null,ne(X,Q,ge,Ve);case F:return ge=lo(ge),ce(Q,X,te,ge,Ve)}if(M(ge)||P(ge))return Q=Q.get(te)||null,fe(X,Q,ge,Ve,null);if(typeof ge.then=="function")return ce(Q,X,te,Vh(ge),Ve);if(ge.$$typeof===z)return ce(Q,X,te,Wh(X,ge),Ve);Yh(X,ge)}return null}function ze(Q,X,te,ge){for(var Ve=null,jt=null,qe=X,mt=X=0,Rt=null;qe!==null&&mt<te.length;mt++){qe.index>mt?(Rt=qe,qe=null):Rt=qe.sibling;var It=ae(Q,qe,te[mt],ge);if(It===null){qe===null&&(qe=Rt);break}s&&qe&&It.alternate===null&&a(Q,qe),X=v(It,X,mt),jt===null?Ve=It:jt.sibling=It,jt=It,qe=Rt}if(mt===te.length)return l(Q,qe),Nt&&Cr(Q,mt),Ve;if(qe===null){for(;mt<te.length;mt++)qe=_e(Q,te[mt],ge),qe!==null&&(X=v(qe,X,mt),jt===null?Ve=qe:jt.sibling=qe,jt=qe);return Nt&&Cr(Q,mt),Ve}for(qe=h(qe);mt<te.length;mt++)Rt=ce(qe,Q,mt,te[mt],ge),Rt!==null&&(s&&Rt.alternate!==null&&qe.delete(Rt.key===null?mt:Rt.key),X=v(Rt,X,mt),jt===null?Ve=Rt:jt.sibling=Rt,jt=Rt);return s&&qe.forEach(function(ka){return a(Q,ka)}),Nt&&Cr(Q,mt),Ve}function et(Q,X,te,ge){if(te==null)throw Error(i(151));for(var Ve=null,jt=null,qe=X,mt=X=0,Rt=null,It=te.next();qe!==null&&!It.done;mt++,It=te.next()){qe.index>mt?(Rt=qe,qe=null):Rt=qe.sibling;var ka=ae(Q,qe,It.value,ge);if(ka===null){qe===null&&(qe=Rt);break}s&&qe&&ka.alternate===null&&a(Q,qe),X=v(ka,X,mt),jt===null?Ve=ka:jt.sibling=ka,jt=ka,qe=Rt}if(It.done)return l(Q,qe),Nt&&Cr(Q,mt),Ve;if(qe===null){for(;!It.done;mt++,It=te.next())It=_e(Q,It.value,ge),It!==null&&(X=v(It,X,mt),jt===null?Ve=It:jt.sibling=It,jt=It);return Nt&&Cr(Q,mt),Ve}for(qe=h(qe);!It.done;mt++,It=te.next())It=ce(qe,Q,mt,It.value,ge),It!==null&&(s&&It.alternate!==null&&qe.delete(It.key===null?mt:It.key),X=v(It,X,mt),jt===null?Ve=It:jt.sibling=It,jt=It);return s&&qe.forEach(function(t6){return a(Q,t6)}),Nt&&Cr(Q,mt),Ve}function Jt(Q,X,te,ge){if(typeof te=="object"&&te!==null&&te.type===x&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case S:e:{for(var Ve=te.key;X!==null;){if(X.key===Ve){if(Ve=te.type,Ve===x){if(X.tag===7){l(Q,X.sibling),ge=m(X,te.props.children),ge.return=Q,Q=ge;break e}}else if(X.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===F&&lo(Ve)===X.type){l(Q,X.sibling),ge=m(X,te.props),Oc(ge,te),ge.return=Q,Q=ge;break e}l(Q,X);break}else a(Q,X);X=X.sibling}te.type===x?(ge=io(te.props.children,Q.mode,ge,te.key),ge.return=Q,Q=ge):(ge=Hh(te.type,te.key,te.props,null,Q.mode,ge),Oc(ge,te),ge.return=Q,Q=ge)}return C(Q);case w:e:{for(Ve=te.key;X!==null;){if(X.key===Ve)if(X.tag===4&&X.stateNode.containerInfo===te.containerInfo&&X.stateNode.implementation===te.implementation){l(Q,X.sibling),ge=m(X,te.children||[]),ge.return=Q,Q=ge;break e}else{l(Q,X);break}else a(Q,X);X=X.sibling}ge=gm(te,Q.mode,ge),ge.return=Q,Q=ge}return C(Q);case F:return te=lo(te),Jt(Q,X,te,ge)}if(M(te))return ze(Q,X,te,ge);if(P(te)){if(Ve=P(te),typeof Ve!="function")throw Error(i(150));return te=Ve.call(te),et(Q,X,te,ge)}if(typeof te.then=="function")return Jt(Q,X,Vh(te),ge);if(te.$$typeof===z)return Jt(Q,X,Wh(Q,te),ge);Yh(Q,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,X!==null&&X.tag===6?(l(Q,X.sibling),ge=m(X,te),ge.return=Q,Q=ge):(l(Q,X),ge=mm(te,Q.mode,ge),ge.return=Q,Q=ge),C(Q)):l(Q,X)}return function(Q,X,te,ge){try{Mc=0;var Ve=Jt(Q,X,te,ge);return ol=null,Ve}catch(qe){if(qe===al||qe===Gh)throw qe;var jt=rs(29,qe,null,Q.mode);return jt.lanes=ge,jt.return=Q,jt}}}var uo=tS(!0),nS=tS(!1),la=!1;function Am(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rm(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ca(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ua(s,a,l){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(zt&2)!==0){var m=h.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),h.pending=a,a=zh(s),P1(s,null,l),a}return Ph(s,h,a,l),zh(s)}function Dc(s,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,Xe(s,l)}}function Nm(s,a){var l=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var m=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var C={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?m=v=C:v=v.next=C,l=l.next}while(l!==null);v===null?m=v=a:v=v.next=a}else m=v=a;l={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}var Lm=!1;function jc(){if(Lm){var s=rl;if(s!==null)throw s}}function Ic(s,a,l,h){Lm=!1;var m=s.updateQueue;la=!1;var v=m.firstBaseUpdate,C=m.lastBaseUpdate,I=m.shared.pending;if(I!==null){m.shared.pending=null;var V=I,ne=V.next;V.next=null,C===null?v=ne:C.next=ne,C=V;var fe=s.alternate;fe!==null&&(fe=fe.updateQueue,I=fe.lastBaseUpdate,I!==C&&(I===null?fe.firstBaseUpdate=ne:I.next=ne,fe.lastBaseUpdate=V))}if(v!==null){var _e=m.baseState;C=0,fe=ne=V=null,I=v;do{var ae=I.lane&-536870913,ce=ae!==I.lane;if(ce?(At&ae)===ae:(h&ae)===ae){ae!==0&&ae===sl&&(Lm=!0),fe!==null&&(fe=fe.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var ze=s,et=I;ae=a;var Jt=l;switch(et.tag){case 1:if(ze=et.payload,typeof ze=="function"){_e=ze.call(Jt,_e,ae);break e}_e=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=et.payload,ae=typeof ze=="function"?ze.call(Jt,_e,ae):ze,ae==null)break e;_e=g({},_e,ae);break e;case 2:la=!0}}ae=I.callback,ae!==null&&(s.flags|=64,ce&&(s.flags|=8192),ce=m.callbacks,ce===null?m.callbacks=[ae]:ce.push(ae))}else ce={lane:ae,tag:I.tag,payload:I.payload,callback:I.callback,next:null},fe===null?(ne=fe=ce,V=_e):fe=fe.next=ce,C|=ae;if(I=I.next,I===null){if(I=m.shared.pending,I===null)break;ce=I,I=ce.next,ce.next=null,m.lastBaseUpdate=ce,m.shared.pending=null}}while(!0);fe===null&&(V=_e),m.baseState=V,m.firstBaseUpdate=ne,m.lastBaseUpdate=fe,v===null&&(m.shared.lanes=0),ma|=C,s.lanes=C,s.memoizedState=_e}}function iS(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function sS(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)iS(l[s],a)}var ll=R(null),Xh=R(0);function rS(s,a){s=jr,Z(Xh,s),Z(ll,a),jr=s|a.baseLanes}function Mm(){Z(Xh,jr),Z(ll,ll.current)}function Om(){jr=Xh.current,Y(ll),Y(Xh)}var as=R(null),ks=null;function ha(s){var a=s.alternate;Z(On,On.current&1),Z(as,s),ks===null&&(a===null||ll.current!==null||a.memoizedState!==null)&&(ks=s)}function Dm(s){Z(On,On.current),Z(as,s),ks===null&&(ks=s)}function aS(s){s.tag===22?(Z(On,On.current),Z(as,s),ks===null&&(ks=s)):da()}function da(){Z(On,On.current),Z(as,as.current)}function os(s){Y(as),ks===s&&(ks=null),Y(On)}var On=R(0);function Zh(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||zg(l)||Hg(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Tr=0,pt=null,Xt=null,zn=null,Jh=!1,cl=!1,ho=!1,Qh=0,Bc=0,ul=null,qM=0;function Cn(){throw Error(i(321))}function jm(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!ss(s[l],a[l]))return!1;return!0}function Im(s,a,l,h,m,v){return Tr=v,pt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,k.H=s===null||s.memoizedState===null?US:Zm,ho=!1,v=l(h,m),ho=!1,cl&&(v=lS(a,l,h,m)),oS(s),v}function oS(s){k.H=zc;var a=Xt!==null&&Xt.next!==null;if(Tr=0,zn=Xt=pt=null,Jh=!1,Bc=0,ul=null,a)throw Error(i(300));s===null||Hn||(s=s.dependencies,s!==null&&Uh(s)&&(Hn=!0))}function lS(s,a,l,h){pt=s;var m=0;do{if(cl&&(ul=null),Bc=0,cl=!1,25<=m)throw Error(i(301));if(m+=1,zn=Xt=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}k.H=WS,v=a(l,h)}while(cl);return v}function GM(){var s=k.H,a=s.useState()[0];return a=typeof a.then=="function"?$c(a):a,s=s.useState()[0],(Xt!==null?Xt.memoizedState:null)!==s&&(pt.flags|=1024),a}function Bm(){var s=Qh!==0;return Qh=0,s}function $m(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Pm(s){if(Jh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Jh=!1}Tr=0,zn=Xt=pt=null,cl=!1,Bc=Qh=0,ul=null}function Mi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?pt.memoizedState=zn=s:zn=zn.next=s,zn}function Dn(){if(Xt===null){var s=pt.alternate;s=s!==null?s.memoizedState:null}else s=Xt.next;var a=zn===null?pt.memoizedState:zn.next;if(a!==null)zn=a,Xt=s;else{if(s===null)throw pt.alternate===null?Error(i(467)):Error(i(310));Xt=s,s={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},zn===null?pt.memoizedState=zn=s:zn=zn.next=s}return zn}function ed(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $c(s){var a=Bc;return Bc+=1,ul===null&&(ul=[]),s=J1(ul,s,a),a=pt,(zn===null?a.memoizedState:zn.next)===null&&(a=a.alternate,k.H=a===null||a.memoizedState===null?US:Zm),s}function td(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return $c(s);if(s.$$typeof===z)return _i(s)}throw Error(i(438,String(s)))}function zm(s){var a=null,l=pt.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var h=pt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=ed(),pt.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(s),h=0;h<s;h++)l[h]=pe;return a.index++,l}function Ar(s,a){return typeof a=="function"?a(s):a}function nd(s){var a=Dn();return Hm(a,Xt,s)}function Hm(s,a,l){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=l;var m=s.baseQueue,v=h.pending;if(v!==null){if(m!==null){var C=m.next;m.next=v.next,v.next=C}a.baseQueue=m=v,h.pending=null}if(v=s.baseState,m===null)s.memoizedState=v;else{a=m.next;var I=C=null,V=null,ne=a,fe=!1;do{var _e=ne.lane&-536870913;if(_e!==ne.lane?(At&_e)===_e:(Tr&_e)===_e){var ae=ne.revertLane;if(ae===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),_e===sl&&(fe=!0);else if((Tr&ae)===ae){ne=ne.next,ae===sl&&(fe=!0);continue}else _e={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},V===null?(I=V=_e,C=v):V=V.next=_e,pt.lanes|=ae,ma|=ae;_e=ne.action,ho&&l(v,_e),v=ne.hasEagerState?ne.eagerState:l(v,_e)}else ae={lane:_e,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},V===null?(I=V=ae,C=v):V=V.next=ae,pt.lanes|=_e,ma|=_e;ne=ne.next}while(ne!==null&&ne!==a);if(V===null?C=v:V.next=I,!ss(v,s.memoizedState)&&(Hn=!0,fe&&(l=rl,l!==null)))throw l;s.memoizedState=v,s.baseState=C,s.baseQueue=V,h.lastRenderedState=v}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Fm(s){var a=Dn(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=s;var h=l.dispatch,m=l.pending,v=a.memoizedState;if(m!==null){l.pending=null;var C=m=m.next;do v=s(v,C.action),C=C.next;while(C!==m);ss(v,a.memoizedState)||(Hn=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),l.lastRenderedState=v}return[v,h]}function cS(s,a,l){var h=pt,m=Dn(),v=Nt;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=a();var C=!ss((Xt||m).memoizedState,l);if(C&&(m.memoizedState=l,Hn=!0),m=m.queue,qm(dS.bind(null,h,m,s),[s]),m.getSnapshot!==a||C||zn!==null&&zn.memoizedState.tag&1){if(h.flags|=2048,hl(9,{destroy:void 0},hS.bind(null,h,m,l,a),null),nn===null)throw Error(i(349));v||(Tr&127)!==0||uS(h,a,l)}return l}function uS(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=pt.updateQueue,a===null?(a=ed(),pt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function hS(s,a,l,h){a.value=l,a.getSnapshot=h,fS(a)&&pS(s)}function dS(s,a,l){return l(function(){fS(a)&&pS(s)})}function fS(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ss(s,l)}catch{return!0}}function pS(s){var a=no(s,2);a!==null&&Yi(a,s,2)}function Um(s){var a=Mi();if(typeof s=="function"){var l=s;if(s=l(),ho){le(!0);try{l()}finally{le(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:s},a}function mS(s,a,l,h){return s.baseState=l,Hm(s,Xt,typeof h=="function"?h:Ar)}function KM(s,a,l,h,m){if(rd(s))throw Error(i(485));if(s=a.action,s!==null){var v={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){v.listeners.push(C)}};k.T!==null?l(!0):v.isTransition=!1,h(v),l=a.pending,l===null?(v.next=a.pending=v,gS(a,v)):(v.next=l.next,a.pending=l.next=v)}}function gS(s,a){var l=a.action,h=a.payload,m=s.state;if(a.isTransition){var v=k.T,C={};k.T=C;try{var I=l(m,h),V=k.S;V!==null&&V(C,I),_S(s,a,I)}catch(ne){Wm(s,a,ne)}finally{v!==null&&C.types!==null&&(v.types=C.types),k.T=v}}else try{v=l(m,h),_S(s,a,v)}catch(ne){Wm(s,a,ne)}}function _S(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(h){vS(s,a,h)},function(h){return Wm(s,a,h)}):vS(s,a,l)}function vS(s,a,l){a.status="fulfilled",a.value=l,yS(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,gS(s,l)))}function Wm(s,a,l){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=l,yS(a),a=a.next;while(a!==h)}s.action=null}function yS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function bS(s,a){return a}function SS(s,a){if(Nt){var l=nn.formState;if(l!==null){e:{var h=pt;if(Nt){if(ln){t:{for(var m=ln,v=Cs;m.nodeType!==8;){if(!v){m=null;break t}if(m=Es(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){ln=Es(m.nextSibling),h=m.data==="F!";break e}}aa(h)}h=!1}h&&(a=l[0])}}return l=Mi(),l.memoizedState=l.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bS,lastRenderedState:a},l.queue=h,l=zS.bind(null,pt,h),h.dispatch=l,h=Um(!1),v=Xm.bind(null,pt,!1,h.queue),h=Mi(),m={state:a,dispatch:null,action:s,pending:null},h.queue=m,l=KM.bind(null,pt,m,v,l),m.dispatch=l,h.memoizedState=s,[a,l,!1]}function wS(s){var a=Dn();return xS(a,Xt,s)}function xS(s,a,l){if(a=Hm(s,a,bS)[0],s=nd(Ar)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=$c(a)}catch(C){throw C===al?Gh:C}else h=a;a=Dn();var m=a.queue,v=m.dispatch;return l!==a.memoizedState&&(pt.flags|=2048,hl(9,{destroy:void 0},VM.bind(null,m,l),null)),[h,v,s]}function VM(s,a){s.action=a}function CS(s){var a=Dn(),l=Xt;if(l!==null)return xS(a,l,s);Dn(),a=a.memoizedState,l=Dn();var h=l.queue.dispatch;return l.memoizedState=s,[a,h,!1]}function hl(s,a,l,h){return s={tag:s,create:l,deps:h,inst:a,next:null},a=pt.updateQueue,a===null&&(a=ed(),pt.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=s.next=s:(h=l.next,l.next=s,s.next=h,a.lastEffect=s),s}function kS(){return Dn().memoizedState}function id(s,a,l,h){var m=Mi();pt.flags|=s,m.memoizedState=hl(1|a,{destroy:void 0},l,h===void 0?null:h)}function sd(s,a,l,h){var m=Dn();h=h===void 0?null:h;var v=m.memoizedState.inst;Xt!==null&&h!==null&&jm(h,Xt.memoizedState.deps)?m.memoizedState=hl(a,v,l,h):(pt.flags|=s,m.memoizedState=hl(1|a,v,l,h))}function ES(s,a){id(8390656,8,s,a)}function qm(s,a){sd(2048,8,s,a)}function YM(s){pt.flags|=4;var a=pt.updateQueue;if(a===null)a=ed(),pt.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function TS(s){var a=Dn().memoizedState;return YM({ref:a,nextImpl:s}),function(){if((zt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function AS(s,a){return sd(4,2,s,a)}function RS(s,a){return sd(4,4,s,a)}function NS(s,a){if(typeof a=="function"){s=s();var l=a(s);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function LS(s,a,l){l=l!=null?l.concat([s]):null,sd(4,4,NS.bind(null,a,s),l)}function Gm(){}function MS(s,a){var l=Dn();a=a===void 0?null:a;var h=l.memoizedState;return a!==null&&jm(a,h[1])?h[0]:(l.memoizedState=[s,a],s)}function OS(s,a){var l=Dn();a=a===void 0?null:a;var h=l.memoizedState;if(a!==null&&jm(a,h[1]))return h[0];if(h=s(),ho){le(!0);try{s()}finally{le(!1)}}return l.memoizedState=[h,a],h}function Km(s,a,l){return l===void 0||(Tr&1073741824)!==0&&(At&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=Dw(),pt.lanes|=s,ma|=s,l)}function DS(s,a,l,h){return ss(l,a)?l:ll.current!==null?(s=Km(s,l,h),ss(s,a)||(Hn=!0),s):(Tr&42)===0||(Tr&1073741824)!==0&&(At&261930)===0?(Hn=!0,s.memoizedState=l):(s=Dw(),pt.lanes|=s,ma|=s,a)}function jS(s,a,l,h,m){var v=B.p;B.p=v!==0&&8>v?v:8;var C=k.T,I={};k.T=I,Xm(s,!1,a,l);try{var V=m(),ne=k.S;if(ne!==null&&ne(I,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var fe=WM(V,h);Pc(s,a,fe,us(s))}else Pc(s,a,h,us(s))}catch(_e){Pc(s,a,{then:function(){},status:"rejected",reason:_e},us())}finally{B.p=v,C!==null&&I.types!==null&&(C.types=I.types),k.T=C}}function XM(){}function Vm(s,a,l,h){if(s.tag!==5)throw Error(i(476));var m=IS(s).queue;jS(s,m,a,O,l===null?XM:function(){return BS(s),l(h)})}function IS(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:O},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ar,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function BS(s){var a=IS(s);a.next===null&&(a=s.alternate.memoizedState),Pc(s,a.next.queue,{},us())}function Ym(){return _i(nu)}function $S(){return Dn().memoizedState}function PS(){return Dn().memoizedState}function ZM(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=us();s=ca(l);var h=ua(a,s,l);h!==null&&(Yi(h,a,l),Dc(h,a,l)),a={cache:Cm()},s.payload=a;return}a=a.return}}function JM(s,a,l){var h=us();l={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},rd(s)?HS(a,l):(l=fm(s,a,l,h),l!==null&&(Yi(l,s,h),FS(l,a,h)))}function zS(s,a,l){var h=us();Pc(s,a,l,h)}function Pc(s,a,l,h){var m={lane:h,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(rd(s))HS(a,m);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var C=a.lastRenderedState,I=v(C,l);if(m.hasEagerState=!0,m.eagerState=I,ss(I,C))return Ph(s,a,m,0),nn===null&&$h(),!1}catch{}if(l=fm(s,a,m,h),l!==null)return Yi(l,s,h),FS(l,a,h),!0}return!1}function Xm(s,a,l,h){if(h={lane:2,revertLane:Ag(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},rd(s)){if(a)throw Error(i(479))}else a=fm(s,l,h,2),a!==null&&Yi(a,s,2)}function rd(s){var a=s.alternate;return s===pt||a!==null&&a===pt}function HS(s,a){cl=Jh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function FS(s,a,l){if((l&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,l|=h,a.lanes=l,Xe(s,l)}}var zc={readContext:_i,use:td,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useLayoutEffect:Cn,useInsertionEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useSyncExternalStore:Cn,useId:Cn,useHostTransitionStatus:Cn,useFormState:Cn,useActionState:Cn,useOptimistic:Cn,useMemoCache:Cn,useCacheRefresh:Cn};zc.useEffectEvent=Cn;var US={readContext:_i,use:td,useCallback:function(s,a){return Mi().memoizedState=[s,a===void 0?null:a],s},useContext:_i,useEffect:ES,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,id(4194308,4,NS.bind(null,a,s),l)},useLayoutEffect:function(s,a){return id(4194308,4,s,a)},useInsertionEffect:function(s,a){id(4,2,s,a)},useMemo:function(s,a){var l=Mi();a=a===void 0?null:a;var h=s();if(ho){le(!0);try{s()}finally{le(!1)}}return l.memoizedState=[h,a],h},useReducer:function(s,a,l){var h=Mi();if(l!==void 0){var m=l(a);if(ho){le(!0);try{l(a)}finally{le(!1)}}}else m=a;return h.memoizedState=h.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},h.queue=s,s=s.dispatch=JM.bind(null,pt,s),[h.memoizedState,s]},useRef:function(s){var a=Mi();return s={current:s},a.memoizedState=s},useState:function(s){s=Um(s);var a=s.queue,l=zS.bind(null,pt,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:Gm,useDeferredValue:function(s,a){var l=Mi();return Km(l,s,a)},useTransition:function(){var s=Um(!1);return s=jS.bind(null,pt,s.queue,!0,!1),Mi().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var h=pt,m=Mi();if(Nt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),nn===null)throw Error(i(349));(At&127)!==0||uS(h,a,l)}m.memoizedState=l;var v={value:l,getSnapshot:a};return m.queue=v,ES(dS.bind(null,h,v,s),[s]),h.flags|=2048,hl(9,{destroy:void 0},hS.bind(null,h,v,l,a),null),l},useId:function(){var s=Mi(),a=nn.identifierPrefix;if(Nt){var l=ir,h=nr;l=(h&~(1<<32-Pe(h)-1)).toString(32)+l,a="_"+a+"R_"+l,l=Qh++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=qM++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Ym,useFormState:SS,useActionState:SS,useOptimistic:function(s){var a=Mi();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Xm.bind(null,pt,!0,l),l.dispatch=a,[s,a]},useMemoCache:zm,useCacheRefresh:function(){return Mi().memoizedState=ZM.bind(null,pt)},useEffectEvent:function(s){var a=Mi(),l={impl:s};return a.memoizedState=l,function(){if((zt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Zm={readContext:_i,use:td,useCallback:MS,useContext:_i,useEffect:qm,useImperativeHandle:LS,useInsertionEffect:AS,useLayoutEffect:RS,useMemo:OS,useReducer:nd,useRef:kS,useState:function(){return nd(Ar)},useDebugValue:Gm,useDeferredValue:function(s,a){var l=Dn();return DS(l,Xt.memoizedState,s,a)},useTransition:function(){var s=nd(Ar)[0],a=Dn().memoizedState;return[typeof s=="boolean"?s:$c(s),a]},useSyncExternalStore:cS,useId:$S,useHostTransitionStatus:Ym,useFormState:wS,useActionState:wS,useOptimistic:function(s,a){var l=Dn();return mS(l,Xt,s,a)},useMemoCache:zm,useCacheRefresh:PS};Zm.useEffectEvent=TS;var WS={readContext:_i,use:td,useCallback:MS,useContext:_i,useEffect:qm,useImperativeHandle:LS,useInsertionEffect:AS,useLayoutEffect:RS,useMemo:OS,useReducer:Fm,useRef:kS,useState:function(){return Fm(Ar)},useDebugValue:Gm,useDeferredValue:function(s,a){var l=Dn();return Xt===null?Km(l,s,a):DS(l,Xt.memoizedState,s,a)},useTransition:function(){var s=Fm(Ar)[0],a=Dn().memoizedState;return[typeof s=="boolean"?s:$c(s),a]},useSyncExternalStore:cS,useId:$S,useHostTransitionStatus:Ym,useFormState:CS,useActionState:CS,useOptimistic:function(s,a){var l=Dn();return Xt!==null?mS(l,Xt,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:zm,useCacheRefresh:PS};WS.useEffectEvent=TS;function Jm(s,a,l,h){a=s.memoizedState,l=l(h,a),l=l==null?a:g({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Qm={enqueueSetState:function(s,a,l){s=s._reactInternals;var h=us(),m=ca(h);m.payload=a,l!=null&&(m.callback=l),a=ua(s,m,h),a!==null&&(Yi(a,s,h),Dc(a,s,h))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var h=us(),m=ca(h);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=ua(s,m,h),a!==null&&(Yi(a,s,h),Dc(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=us(),h=ca(l);h.tag=2,a!=null&&(h.callback=a),a=ua(s,h,l),a!==null&&(Yi(a,s,l),Dc(a,s,l))}};function qS(s,a,l,h,m,v,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,v,C):a.prototype&&a.prototype.isPureReactComponent?!Ec(l,h)||!Ec(m,v):!0}function GS(s,a,l,h){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,h),a.state!==s&&Qm.enqueueReplaceState(a,a.state,null)}function fo(s,a){var l=a;if("ref"in a){l={};for(var h in a)h!=="ref"&&(l[h]=a[h])}if(s=s.defaultProps){l===a&&(l=g({},l));for(var m in s)l[m]===void 0&&(l[m]=s[m])}return l}function KS(s){Bh(s)}function VS(s){console.error(s)}function YS(s){Bh(s)}function ad(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function XS(s,a,l){try{var h=s.onCaughtError;h(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function eg(s,a,l){return l=ca(l),l.tag=3,l.payload={element:null},l.callback=function(){ad(s,a)},l}function ZS(s){return s=ca(s),s.tag=3,s}function JS(s,a,l,h){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var v=h.value;s.payload=function(){return m(v)},s.callback=function(){XS(a,l,h)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){XS(a,l,h),typeof m!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var I=h.stack;this.componentDidCatch(h.value,{componentStack:I!==null?I:""})})}function QM(s,a,l,h,m){if(l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=l.alternate,a!==null&&il(a,l,m,!0),l=as.current,l!==null){switch(l.tag){case 31:case 13:return ks===null?vd():l.alternate===null&&kn===0&&(kn=3),l.flags&=-257,l.flags|=65536,l.lanes=m,h===Kh?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([h]):a.add(h),kg(s,h,m)),!1;case 22:return l.flags|=65536,h===Kh?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([h]):l.add(h)),kg(s,h,m)),!1}throw Error(i(435,l.tag))}return kg(s,h,m),vd(),!1}if(Nt)return a=as.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,h!==ym&&(s=Error(i(422),{cause:h}),Rc(Ss(s,l)))):(h!==ym&&(a=Error(i(423),{cause:h}),Rc(Ss(a,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=Ss(h,l),m=eg(s.stateNode,h,m),Nm(s,m),kn!==4&&(kn=2)),!1;var v=Error(i(520),{cause:h});if(v=Ss(v,l),Vc===null?Vc=[v]:Vc.push(v),kn!==4&&(kn=2),a===null)return!0;h=Ss(h,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=m&-m,l.lanes|=s,s=eg(l.stateNode,h,s),Nm(l,s),!1;case 1:if(a=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(ga===null||!ga.has(v))))return l.flags|=65536,m&=-m,l.lanes|=m,m=ZS(m),JS(m,s,l,h),Nm(l,m),!1}l=l.return}while(l!==null);return!1}var tg=Error(i(461)),Hn=!1;function vi(s,a,l,h){a.child=s===null?nS(a,null,l,h):uo(a,s.child,l,h)}function QS(s,a,l,h,m){l=l.render;var v=a.ref;if("ref"in h){var C={};for(var I in h)I!=="ref"&&(C[I]=h[I])}else C=h;return ao(a),h=Im(s,a,l,C,v,m),I=Bm(),s!==null&&!Hn?($m(s,a,m),Rr(s,a,m)):(Nt&&I&&_m(a),a.flags|=1,vi(s,a,h,m),a.child)}function ew(s,a,l,h,m){if(s===null){var v=l.type;return typeof v=="function"&&!pm(v)&&v.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=v,tw(s,a,v,h,m)):(s=Hh(l.type,null,h,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(v=s.child,!cg(s,m)){var C=v.memoizedProps;if(l=l.compare,l=l!==null?l:Ec,l(C,h)&&s.ref===a.ref)return Rr(s,a,m)}return a.flags|=1,s=xr(v,h),s.ref=a.ref,s.return=a,a.child=s}function tw(s,a,l,h,m){if(s!==null){var v=s.memoizedProps;if(Ec(v,h)&&s.ref===a.ref)if(Hn=!1,a.pendingProps=h=v,cg(s,m))(s.flags&131072)!==0&&(Hn=!0);else return a.lanes=s.lanes,Rr(s,a,m)}return ng(s,a,l,h,m)}function nw(s,a,l,h){var m=h.children,v=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,s!==null){for(h=a.child=s.child,m=0;h!==null;)m=m|h.lanes|h.childLanes,h=h.sibling;h=m&~v}else h=0,a.child=null;return iw(s,a,v,l,h)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&qh(a,v!==null?v.cachePool:null),v!==null?rS(a,v):Mm(),aS(a);else return h=a.lanes=536870912,iw(s,a,v!==null?v.baseLanes|l:l,l,h)}else v!==null?(qh(a,v.cachePool),rS(a,v),da(),a.memoizedState=null):(s!==null&&qh(a,null),Mm(),da());return vi(s,a,m,l),a.child}function Hc(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function iw(s,a,l,h,m){var v=Em();return v=v===null?null:{parent:Pn._currentValue,pool:v},a.memoizedState={baseLanes:l,cachePool:v},s!==null&&qh(a,null),Mm(),aS(a),s!==null&&il(s,a,h,!0),a.childLanes=m,null}function od(s,a){return a=cd({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function sw(s,a,l){return uo(a,s.child,null,l),s=od(a,a.pendingProps),s.flags|=2,os(a),a.memoizedState=null,s}function e3(s,a,l){var h=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Nt){if(h.mode==="hidden")return s=od(a,h),a.lanes=536870912,Hc(null,s);if(Dm(a),(s=ln)?(s=gx(s,Cs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:sa!==null?{id:nr,overflow:ir}:null,retryLane:536870912,hydrationErrors:null},l=H1(s),l.return=a,a.child=l,gi=a,ln=null)):s=null,s===null)throw aa(a);return a.lanes=536870912,null}return od(a,h)}var v=s.memoizedState;if(v!==null){var C=v.dehydrated;if(Dm(a),m)if(a.flags&256)a.flags&=-257,a=sw(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(Hn||il(s,a,l,!1),m=(l&s.childLanes)!==0,Hn||m){if(h=nn,h!==null&&(C=on(h,l),C!==0&&C!==v.retryLane))throw v.retryLane=C,no(s,C),Yi(h,s,C),tg;vd(),a=sw(s,a,l)}else s=v.treeContext,ln=Es(C.nextSibling),gi=a,Nt=!0,ra=null,Cs=!1,s!==null&&W1(a,s),a=od(a,h),a.flags|=4096;return a}return s=xr(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function ld(s,a){var l=a.ref;if(l===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(s===null||s.ref!==l)&&(a.flags|=4194816)}}function ng(s,a,l,h,m){return ao(a),l=Im(s,a,l,h,void 0,m),h=Bm(),s!==null&&!Hn?($m(s,a,m),Rr(s,a,m)):(Nt&&h&&_m(a),a.flags|=1,vi(s,a,l,m),a.child)}function rw(s,a,l,h,m,v){return ao(a),a.updateQueue=null,l=lS(a,h,l,m),oS(s),h=Bm(),s!==null&&!Hn?($m(s,a,v),Rr(s,a,v)):(Nt&&h&&_m(a),a.flags|=1,vi(s,a,l,v),a.child)}function aw(s,a,l,h,m){if(ao(a),a.stateNode===null){var v=Qo,C=l.contextType;typeof C=="object"&&C!==null&&(v=_i(C)),v=new l(h,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Qm,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=h,v.state=a.memoizedState,v.refs={},Am(a),C=l.contextType,v.context=typeof C=="object"&&C!==null?_i(C):Qo,v.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(Jm(a,l,C,h),v.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(C=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),C!==v.state&&Qm.enqueueReplaceState(v,v.state,null),Ic(a,h,v,m),jc(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){v=a.stateNode;var I=a.memoizedProps,V=fo(l,I);v.props=V;var ne=v.context,fe=l.contextType;C=Qo,typeof fe=="object"&&fe!==null&&(C=_i(fe));var _e=l.getDerivedStateFromProps;fe=typeof _e=="function"||typeof v.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,fe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(I||ne!==C)&&GS(a,v,h,C),la=!1;var ae=a.memoizedState;v.state=ae,Ic(a,h,v,m),jc(),ne=a.memoizedState,I||ae!==ne||la?(typeof _e=="function"&&(Jm(a,l,_e,h),ne=a.memoizedState),(V=la||qS(a,l,V,h,ae,ne,C))?(fe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=ne),v.props=h,v.state=ne,v.context=C,h=V):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{v=a.stateNode,Rm(s,a),C=a.memoizedProps,fe=fo(l,C),v.props=fe,_e=a.pendingProps,ae=v.context,ne=l.contextType,V=Qo,typeof ne=="object"&&ne!==null&&(V=_i(ne)),I=l.getDerivedStateFromProps,(ne=typeof I=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(C!==_e||ae!==V)&&GS(a,v,h,V),la=!1,ae=a.memoizedState,v.state=ae,Ic(a,h,v,m),jc();var ce=a.memoizedState;C!==_e||ae!==ce||la||s!==null&&s.dependencies!==null&&Uh(s.dependencies)?(typeof I=="function"&&(Jm(a,l,I,h),ce=a.memoizedState),(fe=la||qS(a,l,fe,h,ae,ce,V)||s!==null&&s.dependencies!==null&&Uh(s.dependencies))?(ne||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,ce,V),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,ce,V)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ce),v.props=h,v.state=ce,v.context=V,h=fe):(typeof v.componentDidUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&ae===s.memoizedState||(a.flags|=1024),h=!1)}return v=h,ld(s,a),h=(a.flags&128)!==0,v||h?(v=a.stateNode,l=h&&typeof l.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,s!==null&&h?(a.child=uo(a,s.child,null,m),a.child=uo(a,null,l,m)):vi(s,a,l,m),a.memoizedState=v.state,s=a.child):s=Rr(s,a,m),s}function ow(s,a,l,h){return so(),a.flags|=256,vi(s,a,l,h),a.child}var ig={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sg(s){return{baseLanes:s,cachePool:X1()}}function rg(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=cs),s}function lw(s,a,l){var h=a.pendingProps,m=!1,v=(a.flags&128)!==0,C;if((C=v)||(C=s!==null&&s.memoizedState===null?!1:(On.current&2)!==0),C&&(m=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,s===null){if(Nt){if(m?ha(a):da(),(s=ln)?(s=gx(s,Cs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:sa!==null?{id:nr,overflow:ir}:null,retryLane:536870912,hydrationErrors:null},l=H1(s),l.return=a,a.child=l,gi=a,ln=null)):s=null,s===null)throw aa(a);return Hg(s)?a.lanes=32:a.lanes=536870912,null}var I=h.children;return h=h.fallback,m?(da(),m=a.mode,I=cd({mode:"hidden",children:I},m),h=io(h,m,l,null),I.return=a,h.return=a,I.sibling=h,a.child=I,h=a.child,h.memoizedState=sg(l),h.childLanes=rg(s,C,l),a.memoizedState=ig,Hc(null,h)):(ha(a),ag(a,I))}var V=s.memoizedState;if(V!==null&&(I=V.dehydrated,I!==null)){if(v)a.flags&256?(ha(a),a.flags&=-257,a=og(s,a,l)):a.memoizedState!==null?(da(),a.child=s.child,a.flags|=128,a=null):(da(),I=h.fallback,m=a.mode,h=cd({mode:"visible",children:h.children},m),I=io(I,m,l,null),I.flags|=2,h.return=a,I.return=a,h.sibling=I,a.child=h,uo(a,s.child,null,l),h=a.child,h.memoizedState=sg(l),h.childLanes=rg(s,C,l),a.memoizedState=ig,a=Hc(null,h));else if(ha(a),Hg(I)){if(C=I.nextSibling&&I.nextSibling.dataset,C)var ne=C.dgst;C=ne,h=Error(i(419)),h.stack="",h.digest=C,Rc({value:h,source:null,stack:null}),a=og(s,a,l)}else if(Hn||il(s,a,l,!1),C=(l&s.childLanes)!==0,Hn||C){if(C=nn,C!==null&&(h=on(C,l),h!==0&&h!==V.retryLane))throw V.retryLane=h,no(s,h),Yi(C,s,h),tg;zg(I)||vd(),a=og(s,a,l)}else zg(I)?(a.flags|=192,a.child=s.child,a=null):(s=V.treeContext,ln=Es(I.nextSibling),gi=a,Nt=!0,ra=null,Cs=!1,s!==null&&W1(a,s),a=ag(a,h.children),a.flags|=4096);return a}return m?(da(),I=h.fallback,m=a.mode,V=s.child,ne=V.sibling,h=xr(V,{mode:"hidden",children:h.children}),h.subtreeFlags=V.subtreeFlags&65011712,ne!==null?I=xr(ne,I):(I=io(I,m,l,null),I.flags|=2),I.return=a,h.return=a,h.sibling=I,a.child=h,Hc(null,h),h=a.child,I=s.child.memoizedState,I===null?I=sg(l):(m=I.cachePool,m!==null?(V=Pn._currentValue,m=m.parent!==V?{parent:V,pool:V}:m):m=X1(),I={baseLanes:I.baseLanes|l,cachePool:m}),h.memoizedState=I,h.childLanes=rg(s,C,l),a.memoizedState=ig,Hc(s.child,h)):(ha(a),l=s.child,s=l.sibling,l=xr(l,{mode:"visible",children:h.children}),l.return=a,l.sibling=null,s!==null&&(C=a.deletions,C===null?(a.deletions=[s],a.flags|=16):C.push(s)),a.child=l,a.memoizedState=null,l)}function ag(s,a){return a=cd({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function cd(s,a){return s=rs(22,s,null,a),s.lanes=0,s}function og(s,a,l){return uo(a,s.child,null,l),s=ag(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function cw(s,a,l){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),wm(s.return,a,l)}function lg(s,a,l,h,m,v){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:m,treeForkCount:v}:(C.isBackwards=a,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=l,C.tailMode=m,C.treeForkCount=v)}function uw(s,a,l){var h=a.pendingProps,m=h.revealOrder,v=h.tail;h=h.children;var C=On.current,I=(C&2)!==0;if(I?(C=C&1|2,a.flags|=128):C&=1,Z(On,C),vi(s,a,h,l),h=Nt?Ac:0,!I&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&cw(s,l,a);else if(s.tag===19)cw(s,l,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(l=a.child,m=null;l!==null;)s=l.alternate,s!==null&&Zh(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),lg(a,!1,m,l,v,h);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=a.child,a.child=null;m!==null;){if(s=m.alternate,s!==null&&Zh(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}lg(a,!0,l,null,v,h);break;case"together":lg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Rr(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),ma|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(il(s,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,l=xr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=xr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function cg(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Uh(s)))}function t3(s,a,l){switch(a.tag){case 3:Ne(a,a.stateNode.containerInfo),oa(a,Pn,s.memoizedState.cache),so();break;case 27:case 5:ot(a);break;case 4:Ne(a,a.stateNode.containerInfo);break;case 10:oa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Dm(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(ha(a),a.flags|=128,null):(l&a.child.childLanes)!==0?lw(s,a,l):(ha(a),s=Rr(s,a,l),s!==null?s.sibling:null);ha(a);break;case 19:var m=(s.flags&128)!==0;if(h=(l&a.childLanes)!==0,h||(il(s,a,l,!1),h=(l&a.childLanes)!==0),m){if(h)return uw(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Z(On,On.current),h)break;return null;case 22:return a.lanes=0,nw(s,a,l,a.pendingProps);case 24:oa(a,Pn,s.memoizedState.cache)}return Rr(s,a,l)}function hw(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)Hn=!0;else{if(!cg(s,l)&&(a.flags&128)===0)return Hn=!1,t3(s,a,l);Hn=(s.flags&131072)!==0}else Hn=!1,Nt&&(a.flags&1048576)!==0&&U1(a,Ac,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=lo(a.elementType),a.type=s,typeof s=="function")pm(s)?(h=fo(s,h),a.tag=1,a=aw(null,a,s,h,l)):(a.tag=0,a=ng(null,a,s,h,l));else{if(s!=null){var m=s.$$typeof;if(m===T){a.tag=11,a=QS(null,a,s,h,l);break e}else if(m===H){a.tag=14,a=ew(null,a,s,h,l);break e}}throw a=$(s)||s,Error(i(306,a,""))}}return a;case 0:return ng(s,a,a.type,a.pendingProps,l);case 1:return h=a.type,m=fo(h,a.pendingProps),aw(s,a,h,m,l);case 3:e:{if(Ne(a,a.stateNode.containerInfo),s===null)throw Error(i(387));h=a.pendingProps;var v=a.memoizedState;m=v.element,Rm(s,a),Ic(a,h,null,l);var C=a.memoizedState;if(h=C.cache,oa(a,Pn,h),h!==v.cache&&xm(a,[Pn],l,!0),jc(),h=C.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=ow(s,a,h,l);break e}else if(h!==m){m=Ss(Error(i(424)),a),Rc(m),a=ow(s,a,h,l);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,ln=Es(s.firstChild),gi=a,Nt=!0,ra=null,Cs=!0,l=nS(a,null,h,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(so(),h===m){a=Rr(s,a,l);break e}vi(s,a,h,l)}a=a.child}return a;case 26:return ld(s,a),s===null?(l=wx(a.type,null,a.pendingProps,null))?a.memoizedState=l:Nt||(l=a.type,s=a.pendingProps,h=kd(oe.current).createElement(l),h[Kt]=a,h[re]=s,yi(h,l,s),ct(h),a.stateNode=h):a.memoizedState=wx(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return ot(a),s===null&&Nt&&(h=a.stateNode=yx(a.type,a.pendingProps,oe.current),gi=a,Cs=!0,m=ln,ba(a.type)?(Fg=m,ln=Es(h.firstChild)):ln=m),vi(s,a,a.pendingProps.children,l),ld(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Nt&&((m=h=ln)&&(h=L3(h,a.type,a.pendingProps,Cs),h!==null?(a.stateNode=h,gi=a,ln=Es(h.firstChild),Cs=!1,m=!0):m=!1),m||aa(a)),ot(a),m=a.type,v=a.pendingProps,C=s!==null?s.memoizedProps:null,h=v.children,Bg(m,v)?h=null:C!==null&&Bg(m,C)&&(a.flags|=32),a.memoizedState!==null&&(m=Im(s,a,GM,null,null,l),nu._currentValue=m),ld(s,a),vi(s,a,h,l),a.child;case 6:return s===null&&Nt&&((s=l=ln)&&(l=M3(l,a.pendingProps,Cs),l!==null?(a.stateNode=l,gi=a,ln=null,s=!0):s=!1),s||aa(a)),null;case 13:return lw(s,a,l);case 4:return Ne(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=uo(a,null,h,l):vi(s,a,h,l),a.child;case 11:return QS(s,a,a.type,a.pendingProps,l);case 7:return vi(s,a,a.pendingProps,l),a.child;case 8:return vi(s,a,a.pendingProps.children,l),a.child;case 12:return vi(s,a,a.pendingProps.children,l),a.child;case 10:return h=a.pendingProps,oa(a,a.type,h.value),vi(s,a,h.children,l),a.child;case 9:return m=a.type._context,h=a.pendingProps.children,ao(a),m=_i(m),h=h(m),a.flags|=1,vi(s,a,h,l),a.child;case 14:return ew(s,a,a.type,a.pendingProps,l);case 15:return tw(s,a,a.type,a.pendingProps,l);case 19:return uw(s,a,l);case 31:return e3(s,a,l);case 22:return nw(s,a,l,a.pendingProps);case 24:return ao(a),h=_i(Pn),s===null?(m=Em(),m===null&&(m=nn,v=Cm(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=l),m=v),a.memoizedState={parent:h,cache:m},Am(a),oa(a,Pn,m)):((s.lanes&l)!==0&&(Rm(s,a),Ic(a,null,null,l),jc()),m=s.memoizedState,v=a.memoizedState,m.parent!==h?(m={parent:h,cache:h},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),oa(a,Pn,h)):(h=v.cache,oa(a,Pn,h),h!==m.cache&&xm(a,[Pn],l,!0))),vi(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Nr(s){s.flags|=4}function ug(s,a,l,h,m){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if($w())s.flags|=8192;else throw co=Kh,Tm}else s.flags&=-16777217}function dw(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Tx(a))if($w())s.flags|=8192;else throw co=Kh,Tm}function ud(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?He():536870912,s.lanes|=a,ml|=a)}function Fc(s,a){if(!Nt)switch(s.tailMode){case"hidden":a=s.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function cn(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,h=0;if(a)for(var m=s.child;m!==null;)l|=m.lanes|m.childLanes,h|=m.subtreeFlags&65011712,h|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)l|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=l,a}function n3(s,a,l){var h=a.pendingProps;switch(vm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(a),null;case 1:return cn(a),null;case 3:return l=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Er(Pn),Re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(nl(a)?Nr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,bm())),cn(a),null;case 26:var m=a.type,v=a.memoizedState;return s===null?(Nr(a),v!==null?(cn(a),dw(a,v)):(cn(a),ug(a,m,null,h,l))):v?v!==s.memoizedState?(Nr(a),cn(a),dw(a,v)):(cn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Nr(a),cn(a),ug(a,m,s,h,l)),null;case 27:if(Le(a),l=oe.current,m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Nr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return cn(a),null}s=me.current,nl(a)?q1(a):(s=yx(m,h,l),a.stateNode=s,Nr(a))}return cn(a),null;case 5:if(Le(a),m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Nr(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return cn(a),null}if(v=me.current,nl(a))q1(a);else{var C=kd(oe.current);switch(v){case 1:v=C.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=C.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=C.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?C.createElement(m,{is:h.is}):C.createElement(m)}}v[Kt]=a,v[re]=h;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)v.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=v;e:switch(yi(v,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Nr(a)}}return cn(a),ug(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Nr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(s=oe.current,nl(a)){if(s=a.stateNode,l=a.memoizedProps,h=null,m=gi,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Kt]=a,s=!!(s.nodeValue===l||h!==null&&h.suppressHydrationWarning===!0||lx(s.nodeValue,l)),s||aa(a,!0)}else s=kd(s).createTextNode(h),s[Kt]=a,a.stateNode=s}return cn(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(h=nl(a),l!==null){if(s===null){if(!h)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Kt]=a}else so(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;cn(a),s=!1}else l=bm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(os(a),a):(os(a),null);if((a.flags&128)!==0)throw Error(i(558))}return cn(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=nl(a),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Kt]=a}else so(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;cn(a),m=!1}else m=bm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(os(a),a):(os(a),null)}return os(a),(a.flags&128)!==0?(a.lanes=l,a):(l=h!==null,s=s!==null&&s.memoizedState!==null,l&&(h=a.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==m&&(h.flags|=2048)),l!==s&&l&&(a.child.flags|=8192),ud(a,a.updateQueue),cn(a),null);case 4:return Re(),s===null&&Mg(a.stateNode.containerInfo),cn(a),null;case 10:return Er(a.type),cn(a),null;case 19:if(Y(On),h=a.memoizedState,h===null)return cn(a),null;if(m=(a.flags&128)!==0,v=h.rendering,v===null)if(m)Fc(h,!1);else{if(kn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(v=Zh(s),v!==null){for(a.flags|=128,Fc(h,!1),s=v.updateQueue,a.updateQueue=s,ud(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)z1(l,s),l=l.sibling;return Z(On,On.current&1|2),Nt&&Cr(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&st()>md&&(a.flags|=128,m=!0,Fc(h,!1),a.lanes=4194304)}else{if(!m)if(s=Zh(v),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,ud(a,s),Fc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!Nt)return cn(a),null}else 2*st()-h.renderingStartTime>md&&l!==536870912&&(a.flags|=128,m=!0,Fc(h,!1),a.lanes=4194304);h.isBackwards?(v.sibling=a.child,a.child=v):(s=h.last,s!==null?s.sibling=v:a.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=st(),s.sibling=null,l=On.current,Z(On,m?l&1|2:l&1),Nt&&Cr(a,h.treeForkCount),s):(cn(a),null);case 22:case 23:return os(a),Om(),h=a.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(l&536870912)!==0&&(a.flags&128)===0&&(cn(a),a.subtreeFlags&6&&(a.flags|=8192)):cn(a),l=a.updateQueue,l!==null&&ud(a,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==l&&(a.flags|=2048),s!==null&&Y(oo),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Er(Pn),cn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function i3(s,a){switch(vm(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Er(Pn),Re(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Le(a),null;case 31:if(a.memoizedState!==null){if(os(a),a.alternate===null)throw Error(i(340));so()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(os(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));so()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return Y(On),null;case 4:return Re(),null;case 10:return Er(a.type),null;case 22:case 23:return os(a),Om(),s!==null&&Y(oo),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Er(Pn),null;case 25:return null;default:return null}}function fw(s,a){switch(vm(a),a.tag){case 3:Er(Pn),Re();break;case 26:case 27:case 5:Le(a);break;case 4:Re();break;case 31:a.memoizedState!==null&&os(a);break;case 13:os(a);break;case 19:Y(On);break;case 10:Er(a.type);break;case 22:case 23:os(a),Om(),s!==null&&Y(oo);break;case 24:Er(Pn)}}function Uc(s,a){try{var l=a.updateQueue,h=l!==null?l.lastEffect:null;if(h!==null){var m=h.next;l=m;do{if((l.tag&s)===s){h=void 0;var v=l.create,C=l.inst;h=v(),C.destroy=h}l=l.next}while(l!==m)}}catch(I){qt(a,a.return,I)}}function fa(s,a,l){try{var h=a.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var v=m.next;h=v;do{if((h.tag&s)===s){var C=h.inst,I=C.destroy;if(I!==void 0){C.destroy=void 0,m=a;var V=l,ne=I;try{ne()}catch(fe){qt(m,V,fe)}}}h=h.next}while(h!==v)}}catch(fe){qt(a,a.return,fe)}}function pw(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{sS(a,l)}catch(h){qt(s,s.return,h)}}}function mw(s,a,l){l.props=fo(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(h){qt(s,a,h)}}function Wc(s,a){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof l=="function"?s.refCleanup=l(h):l.current=h}}catch(m){qt(s,a,m)}}function sr(s,a){var l=s.ref,h=s.refCleanup;if(l!==null)if(typeof h=="function")try{h()}catch(m){qt(s,a,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){qt(s,a,m)}else l.current=null}function gw(s){var a=s.type,l=s.memoizedProps,h=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&h.focus();break e;case"img":l.src?h.src=l.src:l.srcSet&&(h.srcset=l.srcSet)}}catch(m){qt(s,s.return,m)}}function hg(s,a,l){try{var h=s.stateNode;k3(h,s.type,l,a),h[re]=a}catch(m){qt(s,s.return,m)}}function _w(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ba(s.type)||s.tag===4}function dg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||_w(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&ba(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function fg(s,a,l){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(s),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Te));else if(h!==4&&(h===27&&ba(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(fg(s,a,l),s=s.sibling;s!==null;)fg(s,a,l),s=s.sibling}function hd(s,a,l){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?l.insertBefore(s,a):l.appendChild(s);else if(h!==4&&(h===27&&ba(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(hd(s,a,l),s=s.sibling;s!==null;)hd(s,a,l),s=s.sibling}function vw(s){var a=s.stateNode,l=s.memoizedProps;try{for(var h=s.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);yi(a,h,l),a[Kt]=s,a[re]=l}catch(v){qt(s,s.return,v)}}var Lr=!1,Fn=!1,pg=!1,yw=typeof WeakSet=="function"?WeakSet:Set,ni=null;function s3(s,a){if(s=s.containerInfo,jg=Md,s=L1(s),om(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var h=l.getSelection&&l.getSelection();if(h&&h.rangeCount!==0){l=h.anchorNode;var m=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var C=0,I=-1,V=-1,ne=0,fe=0,_e=s,ae=null;t:for(;;){for(var ce;_e!==l||m!==0&&_e.nodeType!==3||(I=C+m),_e!==v||h!==0&&_e.nodeType!==3||(V=C+h),_e.nodeType===3&&(C+=_e.nodeValue.length),(ce=_e.firstChild)!==null;)ae=_e,_e=ce;for(;;){if(_e===s)break t;if(ae===l&&++ne===m&&(I=C),ae===v&&++fe===h&&(V=C),(ce=_e.nextSibling)!==null)break;_e=ae,ae=_e.parentNode}_e=ce}l=I===-1||V===-1?null:{start:I,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ig={focusedElem:s,selectionRange:l},Md=!1,ni=a;ni!==null;)if(a=ni,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,ni=s;else for(;ni!==null;){switch(a=ni,v=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)m=s[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,l=a,m=v.memoizedProps,v=v.memoizedState,h=l.stateNode;try{var ze=fo(l.type,m);s=h.getSnapshotBeforeUpdate(ze,v),h.__reactInternalSnapshotBeforeUpdate=s}catch(et){qt(l,l.return,et)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Pg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Pg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,ni=s;break}ni=a.return}}function bw(s,a,l){var h=l.flags;switch(l.tag){case 0:case 11:case 15:Or(s,l),h&4&&Uc(5,l);break;case 1:if(Or(s,l),h&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(C){qt(l,l.return,C)}else{var m=fo(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(C){qt(l,l.return,C)}}h&64&&pw(l),h&512&&Wc(l,l.return);break;case 3:if(Or(s,l),h&64&&(s=l.updateQueue,s!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{sS(s,a)}catch(C){qt(l,l.return,C)}}break;case 27:a===null&&h&4&&vw(l);case 26:case 5:Or(s,l),a===null&&h&4&&gw(l),h&512&&Wc(l,l.return);break;case 12:Or(s,l);break;case 31:Or(s,l),h&4&&xw(s,l);break;case 13:Or(s,l),h&4&&Cw(s,l),h&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=f3.bind(null,l),O3(s,l))));break;case 22:if(h=l.memoizedState!==null||Lr,!h){a=a!==null&&a.memoizedState!==null||Fn,m=Lr;var v=Fn;Lr=h,(Fn=a)&&!v?Dr(s,l,(l.subtreeFlags&8772)!==0):Or(s,l),Lr=m,Fn=v}break;case 30:break;default:Or(s,l)}}function Sw(s){var a=s.alternate;a!==null&&(s.alternate=null,Sw(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&je(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var _n=null,qi=!1;function Mr(s,a,l){for(l=l.child;l!==null;)ww(s,a,l),l=l.sibling}function ww(s,a,l){if(ie&&typeof ie.onCommitFiberUnmount=="function")try{ie.onCommitFiberUnmount(mn,l)}catch{}switch(l.tag){case 26:Fn||sr(l,a),Mr(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Fn||sr(l,a);var h=_n,m=qi;ba(l.type)&&(_n=l.stateNode,qi=!1),Mr(s,a,l),Qc(l.stateNode),_n=h,qi=m;break;case 5:Fn||sr(l,a);case 6:if(h=_n,m=qi,_n=null,Mr(s,a,l),_n=h,qi=m,_n!==null)if(qi)try{(_n.nodeType===9?_n.body:_n.nodeName==="HTML"?_n.ownerDocument.body:_n).removeChild(l.stateNode)}catch(v){qt(l,a,v)}else try{_n.removeChild(l.stateNode)}catch(v){qt(l,a,v)}break;case 18:_n!==null&&(qi?(s=_n,px(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),xl(s)):px(_n,l.stateNode));break;case 4:h=_n,m=qi,_n=l.stateNode.containerInfo,qi=!0,Mr(s,a,l),_n=h,qi=m;break;case 0:case 11:case 14:case 15:fa(2,l,a),Fn||fa(4,l,a),Mr(s,a,l);break;case 1:Fn||(sr(l,a),h=l.stateNode,typeof h.componentWillUnmount=="function"&&mw(l,a,h)),Mr(s,a,l);break;case 21:Mr(s,a,l);break;case 22:Fn=(h=Fn)||l.memoizedState!==null,Mr(s,a,l),Fn=h;break;default:Mr(s,a,l)}}function xw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{xl(s)}catch(l){qt(a,a.return,l)}}}function Cw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{xl(s)}catch(l){qt(a,a.return,l)}}function r3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new yw),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new yw),a;default:throw Error(i(435,s.tag))}}function dd(s,a){var l=r3(s);a.forEach(function(h){if(!l.has(h)){l.add(h);var m=p3.bind(null,s,h);h.then(m,m)}})}function Gi(s,a){var l=a.deletions;if(l!==null)for(var h=0;h<l.length;h++){var m=l[h],v=s,C=a,I=C;e:for(;I!==null;){switch(I.tag){case 27:if(ba(I.type)){_n=I.stateNode,qi=!1;break e}break;case 5:_n=I.stateNode,qi=!1;break e;case 3:case 4:_n=I.stateNode.containerInfo,qi=!0;break e}I=I.return}if(_n===null)throw Error(i(160));ww(v,C,m),_n=null,qi=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)kw(a,s),a=a.sibling}var Us=null;function kw(s,a){var l=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Gi(a,s),Ki(s),h&4&&(fa(3,s,s.return),Uc(3,s),fa(5,s,s.return));break;case 1:Gi(a,s),Ki(s),h&512&&(Fn||l===null||sr(l,l.return)),h&64&&Lr&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?h:l.concat(h))));break;case 26:var m=Us;if(Gi(a,s),Ki(s),h&512&&(Fn||l===null||sr(l,l.return)),h&4){var v=l!==null?l.memoizedState:null;if(h=s.memoizedState,l===null)if(h===null)if(s.stateNode===null){e:{h=s.type,l=s.memoizedProps,m=m.ownerDocument||m;t:switch(h){case"title":v=m.getElementsByTagName("title")[0],(!v||v[gn]||v[Kt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(h),m.head.insertBefore(v,m.querySelector("head > title"))),yi(v,h,l),v[Kt]=s,ct(v),h=v;break e;case"link":var C=kx("link","href",m).get(h+(l.href||""));if(C){for(var I=0;I<C.length;I++)if(v=C[I],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){C.splice(I,1);break t}}v=m.createElement(h),yi(v,h,l),m.head.appendChild(v);break;case"meta":if(C=kx("meta","content",m).get(h+(l.content||""))){for(I=0;I<C.length;I++)if(v=C[I],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){C.splice(I,1);break t}}v=m.createElement(h),yi(v,h,l),m.head.appendChild(v);break;default:throw Error(i(468,h))}v[Kt]=s,ct(v),h=v}s.stateNode=h}else Ex(m,s.type,s.stateNode);else s.stateNode=Cx(m,h,s.memoizedProps);else v!==h?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,h===null?Ex(m,s.type,s.stateNode):Cx(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&hg(s,s.memoizedProps,l.memoizedProps)}break;case 27:Gi(a,s),Ki(s),h&512&&(Fn||l===null||sr(l,l.return)),l!==null&&h&4&&hg(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Gi(a,s),Ki(s),h&512&&(Fn||l===null||sr(l,l.return)),s.flags&32){m=s.stateNode;try{nt(m,"")}catch(ze){qt(s,s.return,ze)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,hg(s,m,l!==null?l.memoizedProps:m)),h&1024&&(pg=!0);break;case 6:if(Gi(a,s),Ki(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,l=s.stateNode;try{l.nodeValue=h}catch(ze){qt(s,s.return,ze)}}break;case 3:if(Ad=null,m=Us,Us=Ed(a.containerInfo),Gi(a,s),Us=m,Ki(s),h&4&&l!==null&&l.memoizedState.isDehydrated)try{xl(a.containerInfo)}catch(ze){qt(s,s.return,ze)}pg&&(pg=!1,Ew(s));break;case 4:h=Us,Us=Ed(s.stateNode.containerInfo),Gi(a,s),Ki(s),Us=h;break;case 12:Gi(a,s),Ki(s);break;case 31:Gi(a,s),Ki(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,dd(s,h)));break;case 13:Gi(a,s),Ki(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(pd=st()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,dd(s,h)));break;case 22:m=s.memoizedState!==null;var V=l!==null&&l.memoizedState!==null,ne=Lr,fe=Fn;if(Lr=ne||m,Fn=fe||V,Gi(a,s),Fn=fe,Lr=ne,Ki(s),h&8192)e:for(a=s.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||V||Lr||Fn||po(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){V=l=a;try{if(v=V.stateNode,m)C=v.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{I=V.stateNode;var _e=V.memoizedProps.style,ae=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;I.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(ze){qt(V,V.return,ze)}}}else if(a.tag===6){if(l===null){V=a;try{V.stateNode.nodeValue=m?"":V.memoizedProps}catch(ze){qt(V,V.return,ze)}}}else if(a.tag===18){if(l===null){V=a;try{var ce=V.stateNode;m?mx(ce,!0):mx(V.stateNode,!1)}catch(ze){qt(V,V.return,ze)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=s.updateQueue,h!==null&&(l=h.retryQueue,l!==null&&(h.retryQueue=null,dd(s,l))));break;case 19:Gi(a,s),Ki(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,dd(s,h)));break;case 30:break;case 21:break;default:Gi(a,s),Ki(s)}}function Ki(s){var a=s.flags;if(a&2){try{for(var l,h=s.return;h!==null;){if(_w(h)){l=h;break}h=h.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,v=dg(s);hd(s,v,m);break;case 5:var C=l.stateNode;l.flags&32&&(nt(C,""),l.flags&=-33);var I=dg(s);hd(s,I,C);break;case 3:case 4:var V=l.stateNode.containerInfo,ne=dg(s);fg(s,ne,V);break;default:throw Error(i(161))}}catch(fe){qt(s,s.return,fe)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function Ew(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;Ew(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Or(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)bw(s,a.alternate,a),a=a.sibling}function po(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:fa(4,a,a.return),po(a);break;case 1:sr(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&mw(a,a.return,l),po(a);break;case 27:Qc(a.stateNode);case 26:case 5:sr(a,a.return),po(a);break;case 22:a.memoizedState===null&&po(a);break;case 30:po(a);break;default:po(a)}s=s.sibling}}function Dr(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,m=s,v=a,C=v.flags;switch(v.tag){case 0:case 11:case 15:Dr(m,v,l),Uc(4,v);break;case 1:if(Dr(m,v,l),h=v,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ne){qt(h,h.return,ne)}if(h=v,m=h.updateQueue,m!==null){var I=h.stateNode;try{var V=m.shared.hiddenCallbacks;if(V!==null)for(m.shared.hiddenCallbacks=null,m=0;m<V.length;m++)iS(V[m],I)}catch(ne){qt(h,h.return,ne)}}l&&C&64&&pw(v),Wc(v,v.return);break;case 27:vw(v);case 26:case 5:Dr(m,v,l),l&&h===null&&C&4&&gw(v),Wc(v,v.return);break;case 12:Dr(m,v,l);break;case 31:Dr(m,v,l),l&&C&4&&xw(m,v);break;case 13:Dr(m,v,l),l&&C&4&&Cw(m,v);break;case 22:v.memoizedState===null&&Dr(m,v,l),Wc(v,v.return);break;case 30:break;default:Dr(m,v,l)}a=a.sibling}}function mg(s,a){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&Nc(l))}function gg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nc(s))}function Ws(s,a,l,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Tw(s,a,l,h),a=a.sibling}function Tw(s,a,l,h){var m=a.flags;switch(a.tag){case 0:case 11:case 15:Ws(s,a,l,h),m&2048&&Uc(9,a);break;case 1:Ws(s,a,l,h);break;case 3:Ws(s,a,l,h),m&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nc(s)));break;case 12:if(m&2048){Ws(s,a,l,h),s=a.stateNode;try{var v=a.memoizedProps,C=v.id,I=v.onPostCommit;typeof I=="function"&&I(C,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(V){qt(a,a.return,V)}}else Ws(s,a,l,h);break;case 31:Ws(s,a,l,h);break;case 13:Ws(s,a,l,h);break;case 23:break;case 22:v=a.stateNode,C=a.alternate,a.memoizedState!==null?v._visibility&2?Ws(s,a,l,h):qc(s,a):v._visibility&2?Ws(s,a,l,h):(v._visibility|=2,dl(s,a,l,h,(a.subtreeFlags&10256)!==0||!1)),m&2048&&mg(C,a);break;case 24:Ws(s,a,l,h),m&2048&&gg(a.alternate,a);break;default:Ws(s,a,l,h)}}function dl(s,a,l,h,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=s,C=a,I=l,V=h,ne=C.flags;switch(C.tag){case 0:case 11:case 15:dl(v,C,I,V,m),Uc(8,C);break;case 23:break;case 22:var fe=C.stateNode;C.memoizedState!==null?fe._visibility&2?dl(v,C,I,V,m):qc(v,C):(fe._visibility|=2,dl(v,C,I,V,m)),m&&ne&2048&&mg(C.alternate,C);break;case 24:dl(v,C,I,V,m),m&&ne&2048&&gg(C.alternate,C);break;default:dl(v,C,I,V,m)}a=a.sibling}}function qc(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=s,h=a,m=h.flags;switch(h.tag){case 22:qc(l,h),m&2048&&mg(h.alternate,h);break;case 24:qc(l,h),m&2048&&gg(h.alternate,h);break;default:qc(l,h)}a=a.sibling}}var Gc=8192;function fl(s,a,l){if(s.subtreeFlags&Gc)for(s=s.child;s!==null;)Aw(s,a,l),s=s.sibling}function Aw(s,a,l){switch(s.tag){case 26:fl(s,a,l),s.flags&Gc&&s.memoizedState!==null&&q3(l,Us,s.memoizedState,s.memoizedProps);break;case 5:fl(s,a,l);break;case 3:case 4:var h=Us;Us=Ed(s.stateNode.containerInfo),fl(s,a,l),Us=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Gc,Gc=16777216,fl(s,a,l),Gc=h):fl(s,a,l));break;default:fl(s,a,l)}}function Rw(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Kc(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var h=a[l];ni=h,Lw(h,s)}Rw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Nw(s),s=s.sibling}function Nw(s){switch(s.tag){case 0:case 11:case 15:Kc(s),s.flags&2048&&fa(9,s,s.return);break;case 3:Kc(s);break;case 12:Kc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,fd(s)):Kc(s);break;default:Kc(s)}}function fd(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var h=a[l];ni=h,Lw(h,s)}Rw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:fa(8,a,a.return),fd(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,fd(a));break;default:fd(a)}s=s.sibling}}function Lw(s,a){for(;ni!==null;){var l=ni;switch(l.tag){case 0:case 11:case 15:fa(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var h=l.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Nc(l.memoizedState.cache)}if(h=l.child,h!==null)h.return=l,ni=h;else e:for(l=s;ni!==null;){h=ni;var m=h.sibling,v=h.return;if(Sw(h),h===l){ni=null;break e}if(m!==null){m.return=v,ni=m;break e}ni=v}}}var a3={getCacheForType:function(s){var a=_i(Pn),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return _i(Pn).controller.signal}},o3=typeof WeakMap=="function"?WeakMap:Map,zt=0,nn=null,Ct=null,At=0,Wt=0,ls=null,pa=!1,pl=!1,_g=!1,jr=0,kn=0,ma=0,mo=0,vg=0,cs=0,ml=0,Vc=null,Vi=null,yg=!1,pd=0,Mw=0,md=1/0,gd=null,ga=null,Zn=0,_a=null,gl=null,Ir=0,bg=0,Sg=null,Ow=null,Yc=0,wg=null;function us(){return(zt&2)!==0&&At!==0?At&-At:k.T!==null?Ag():Hs()}function Dw(){if(cs===0)if((At&536870912)===0||Nt){var s=Ot;Ot<<=1,(Ot&3932160)===0&&(Ot=262144),cs=s}else cs=536870912;return s=as.current,s!==null&&(s.flags|=32),cs}function Yi(s,a,l){(s===nn&&(Wt===2||Wt===9)||s.cancelPendingCommit!==null)&&(_l(s,0),va(s,At,cs,!1)),Dt(s,l),((zt&2)===0||s!==nn)&&(s===nn&&((zt&2)===0&&(mo|=l),kn===4&&va(s,At,cs,!1)),rr(s))}function jw(s,a,l){if((zt&6)!==0)throw Error(i(327));var h=!l&&(a&127)===0&&(a&s.expiredLanes)===0||de(s,a),m=h?u3(s,a):Cg(s,a,!0),v=h;do{if(m===0){pl&&!h&&va(s,a,0,!1);break}else{if(l=s.current.alternate,v&&!l3(l)){m=Cg(s,a,!1),v=!1;continue}if(m===2){if(v=a,s.errorRecoveryDisabledLanes&v)var C=0;else C=s.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){a=C;e:{var I=s;m=Vc;var V=I.current.memoizedState.isDehydrated;if(V&&(_l(I,C).flags|=256),C=Cg(I,C,!1),C!==2){if(_g&&!V){I.errorRecoveryDisabledLanes|=v,mo|=v,m=4;break e}v=Vi,Vi=m,v!==null&&(Vi===null?Vi=v:Vi.push.apply(Vi,v))}m=C}if(v=!1,m!==2)continue}}if(m===1){_l(s,0),va(s,a,0,!0);break}e:{switch(h=s,v=m,v){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:va(h,a,cs,!pa);break e;case 2:Vi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(m=pd+300-st(),10<m)){if(va(h,a,cs,!pa),K(h,0,!0)!==0)break e;Ir=a,h.timeoutHandle=dx(Iw.bind(null,h,l,Vi,gd,yg,a,cs,mo,ml,pa,v,"Throttled",-0,0),m);break e}Iw(h,l,Vi,gd,yg,a,cs,mo,ml,pa,v,null,-0,0)}}break}while(!0);rr(s)}function Iw(s,a,l,h,m,v,C,I,V,ne,fe,_e,ae,ce){if(s.timeoutHandle=-1,_e=a.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Te},Aw(a,v,_e);var ze=(v&62914560)===v?pd-st():(v&4194048)===v?Mw-st():0;if(ze=G3(_e,ze),ze!==null){Ir=v,s.cancelPendingCommit=ze(Ww.bind(null,s,a,v,l,h,m,C,I,V,fe,_e,null,ae,ce)),va(s,v,C,!ne);return}}Ww(s,a,v,l,h,m,C,I,V)}function l3(s){for(var a=s;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var h=0;h<l.length;h++){var m=l[h],v=m.getSnapshot;m=m.value;try{if(!ss(v(),m))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function va(s,a,l,h){a&=~vg,a&=~mo,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var m=a;0<m;){var v=31-Pe(m),C=1<<v;h[v]=-1,m&=~C}l!==0&&Oe(s,l,a)}function _d(){return(zt&6)===0?(Xc(0),!1):!0}function xg(){if(Ct!==null){if(Wt===0)var s=Ct.return;else s=Ct,kr=ro=null,Pm(s),ol=null,Mc=0,s=Ct;for(;s!==null;)fw(s.alternate,s),s=s.return;Ct=null}}function _l(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,A3(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Ir=0,xg(),nn=s,Ct=l=xr(s.current,null),At=a,Wt=0,ls=null,pa=!1,pl=de(s,a),_g=!1,ml=cs=vg=mo=ma=kn=0,Vi=Vc=null,yg=!1,(a&8)!==0&&(a|=a&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=a;0<h;){var m=31-Pe(h),v=1<<m;a|=s[m],h&=~v}return jr=a,$h(),l}function Bw(s,a){pt=null,k.H=zc,a===al||a===Gh?(a=Q1(),Wt=3):a===Tm?(a=Q1(),Wt=4):Wt=a===tg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ls=a,Ct===null&&(kn=1,ad(s,Ss(a,s.current)))}function $w(){var s=as.current;return s===null?!0:(At&4194048)===At?ks===null:(At&62914560)===At||(At&536870912)!==0?s===ks:!1}function Pw(){var s=k.H;return k.H=zc,s===null?zc:s}function zw(){var s=k.A;return k.A=a3,s}function vd(){kn=4,pa||(At&4194048)!==At&&as.current!==null||(pl=!0),(ma&134217727)===0&&(mo&134217727)===0||nn===null||va(nn,At,cs,!1)}function Cg(s,a,l){var h=zt;zt|=2;var m=Pw(),v=zw();(nn!==s||At!==a)&&(gd=null,_l(s,a)),a=!1;var C=kn;e:do try{if(Wt!==0&&Ct!==null){var I=Ct,V=ls;switch(Wt){case 8:xg(),C=6;break e;case 3:case 2:case 9:case 6:as.current===null&&(a=!0);var ne=Wt;if(Wt=0,ls=null,vl(s,I,V,ne),l&&pl){C=0;break e}break;default:ne=Wt,Wt=0,ls=null,vl(s,I,V,ne)}}c3(),C=kn;break}catch(fe){Bw(s,fe)}while(!0);return a&&s.shellSuspendCounter++,kr=ro=null,zt=h,k.H=m,k.A=v,Ct===null&&(nn=null,At=0,$h()),C}function c3(){for(;Ct!==null;)Hw(Ct)}function u3(s,a){var l=zt;zt|=2;var h=Pw(),m=zw();nn!==s||At!==a?(gd=null,md=st()+500,_l(s,a)):pl=de(s,a);e:do try{if(Wt!==0&&Ct!==null){a=Ct;var v=ls;t:switch(Wt){case 1:Wt=0,ls=null,vl(s,a,v,1);break;case 2:case 9:if(Z1(v)){Wt=0,ls=null,Fw(a);break}a=function(){Wt!==2&&Wt!==9||nn!==s||(Wt=7),rr(s)},v.then(a,a);break e;case 3:Wt=7;break e;case 4:Wt=5;break e;case 7:Z1(v)?(Wt=0,ls=null,Fw(a)):(Wt=0,ls=null,vl(s,a,v,7));break;case 5:var C=null;switch(Ct.tag){case 26:C=Ct.memoizedState;case 5:case 27:var I=Ct;if(C?Tx(C):I.stateNode.complete){Wt=0,ls=null;var V=I.sibling;if(V!==null)Ct=V;else{var ne=I.return;ne!==null?(Ct=ne,yd(ne)):Ct=null}break t}}Wt=0,ls=null,vl(s,a,v,5);break;case 6:Wt=0,ls=null,vl(s,a,v,6);break;case 8:xg(),kn=6;break e;default:throw Error(i(462))}}h3();break}catch(fe){Bw(s,fe)}while(!0);return kr=ro=null,k.H=h,k.A=m,zt=l,Ct!==null?0:(nn=null,At=0,$h(),kn)}function h3(){for(;Ct!==null&&!we();)Hw(Ct)}function Hw(s){var a=hw(s.alternate,s,jr);s.memoizedProps=s.pendingProps,a===null?yd(s):Ct=a}function Fw(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=rw(l,a,a.pendingProps,a.type,void 0,At);break;case 11:a=rw(l,a,a.pendingProps,a.type.render,a.ref,At);break;case 5:Pm(a);default:fw(l,a),a=Ct=z1(a,jr),a=hw(l,a,jr)}s.memoizedProps=s.pendingProps,a===null?yd(s):Ct=a}function vl(s,a,l,h){kr=ro=null,Pm(a),ol=null,Mc=0;var m=a.return;try{if(QM(s,m,a,l,At)){kn=1,ad(s,Ss(l,s.current)),Ct=null;return}}catch(v){if(m!==null)throw Ct=m,v;kn=1,ad(s,Ss(l,s.current)),Ct=null;return}a.flags&32768?(Nt||h===1?s=!0:pl||(At&536870912)!==0?s=!1:(pa=s=!0,(h===2||h===9||h===3||h===6)&&(h=as.current,h!==null&&h.tag===13&&(h.flags|=16384))),Uw(a,s)):yd(a)}function yd(s){var a=s;do{if((a.flags&32768)!==0){Uw(a,pa);return}s=a.return;var l=n3(a.alternate,a,jr);if(l!==null){Ct=l;return}if(a=a.sibling,a!==null){Ct=a;return}Ct=a=s}while(a!==null);kn===0&&(kn=5)}function Uw(s,a){do{var l=i3(s.alternate,s);if(l!==null){l.flags&=32767,Ct=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){Ct=s;return}Ct=s=l}while(s!==null);kn=6,Ct=null}function Ww(s,a,l,h,m,v,C,I,V){s.cancelPendingCommit=null;do bd();while(Zn!==0);if((zt&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(v=a.lanes|a.childLanes,v|=dm,$e(s,l,v,C,I,V),s===nn&&(Ct=nn=null,At=0),gl=a,_a=s,Ir=l,bg=v,Sg=m,Ow=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,m3(ft,function(){return Yw(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=k.T,k.T=null,m=B.p,B.p=2,C=zt,zt|=4;try{s3(s,a,l)}finally{zt=C,B.p=m,k.T=h}}Zn=1,qw(),Gw(),Kw()}}function qw(){if(Zn===1){Zn=0;var s=_a,a=gl,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=k.T,k.T=null;var h=B.p;B.p=2;var m=zt;zt|=4;try{kw(a,s);var v=Ig,C=L1(s.containerInfo),I=v.focusedElem,V=v.selectionRange;if(C!==I&&I&&I.ownerDocument&&N1(I.ownerDocument.documentElement,I)){if(V!==null&&om(I)){var ne=V.start,fe=V.end;if(fe===void 0&&(fe=ne),"selectionStart"in I)I.selectionStart=ne,I.selectionEnd=Math.min(fe,I.value.length);else{var _e=I.ownerDocument||document,ae=_e&&_e.defaultView||window;if(ae.getSelection){var ce=ae.getSelection(),ze=I.textContent.length,et=Math.min(V.start,ze),Jt=V.end===void 0?et:Math.min(V.end,ze);!ce.extend&&et>Jt&&(C=Jt,Jt=et,et=C);var Q=R1(I,et),X=R1(I,Jt);if(Q&&X&&(ce.rangeCount!==1||ce.anchorNode!==Q.node||ce.anchorOffset!==Q.offset||ce.focusNode!==X.node||ce.focusOffset!==X.offset)){var te=_e.createRange();te.setStart(Q.node,Q.offset),ce.removeAllRanges(),et>Jt?(ce.addRange(te),ce.extend(X.node,X.offset)):(te.setEnd(X.node,X.offset),ce.addRange(te))}}}}for(_e=[],ce=I;ce=ce.parentNode;)ce.nodeType===1&&_e.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<_e.length;I++){var ge=_e[I];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}Md=!!jg,Ig=jg=null}finally{zt=m,B.p=h,k.T=l}}s.current=a,Zn=2}}function Gw(){if(Zn===2){Zn=0;var s=_a,a=gl,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=k.T,k.T=null;var h=B.p;B.p=2;var m=zt;zt|=4;try{bw(s,a.alternate,a)}finally{zt=m,B.p=h,k.T=l}}Zn=3}}function Kw(){if(Zn===4||Zn===3){Zn=0,Je();var s=_a,a=gl,l=Ir,h=Ow;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Zn=5:(Zn=0,gl=_a=null,Vw(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(ga=null),Yn(l),a=a.stateNode,ie&&typeof ie.onCommitFiberRoot=="function")try{ie.onCommitFiberRoot(mn,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=k.T,m=B.p,B.p=2,k.T=null;try{for(var v=s.onRecoverableError,C=0;C<h.length;C++){var I=h[C];v(I.value,{componentStack:I.stack})}}finally{k.T=a,B.p=m}}(Ir&3)!==0&&bd(),rr(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===wg?Yc++:(Yc=0,wg=s):Yc=0,Xc(0)}}function Vw(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Nc(a)))}function bd(){return qw(),Gw(),Kw(),Yw()}function Yw(){if(Zn!==5)return!1;var s=_a,a=bg;bg=0;var l=Yn(Ir),h=k.T,m=B.p;try{B.p=32>l?32:l,k.T=null,l=Sg,Sg=null;var v=_a,C=Ir;if(Zn=0,gl=_a=null,Ir=0,(zt&6)!==0)throw Error(i(331));var I=zt;if(zt|=4,Nw(v.current),Tw(v,v.current,C,l),zt=I,Xc(0,!1),ie&&typeof ie.onPostCommitFiberRoot=="function")try{ie.onPostCommitFiberRoot(mn,v)}catch{}return!0}finally{B.p=m,k.T=h,Vw(s,a)}}function Xw(s,a,l){a=Ss(l,a),a=eg(s.stateNode,a,2),s=ua(s,a,2),s!==null&&(Dt(s,2),rr(s))}function qt(s,a,l){if(s.tag===3)Xw(s,s,l);else for(;a!==null;){if(a.tag===3){Xw(a,s,l);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ga===null||!ga.has(h))){s=Ss(l,s),l=ZS(2),h=ua(a,l,2),h!==null&&(JS(l,h,a,s),Dt(h,2),rr(h));break}}a=a.return}}function kg(s,a,l){var h=s.pingCache;if(h===null){h=s.pingCache=new o3;var m=new Set;h.set(a,m)}else m=h.get(a),m===void 0&&(m=new Set,h.set(a,m));m.has(l)||(_g=!0,m.add(l),s=d3.bind(null,s,a,l),a.then(s,s))}function d3(s,a,l){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,nn===s&&(At&l)===l&&(kn===4||kn===3&&(At&62914560)===At&&300>st()-pd?(zt&2)===0&&_l(s,0):vg|=l,ml===At&&(ml=0)),rr(s)}function Zw(s,a){a===0&&(a=He()),s=no(s,a),s!==null&&(Dt(s,a),rr(s))}function f3(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),Zw(s,l)}function p3(s,a){var l=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(l=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(a),Zw(s,l)}function m3(s,a){return Ye(s,a)}var Sd=null,yl=null,Eg=!1,wd=!1,Tg=!1,ya=0;function rr(s){s!==yl&&s.next===null&&(yl===null?Sd=yl=s:yl=yl.next=s),wd=!0,Eg||(Eg=!0,_3())}function Xc(s,a){if(!Tg&&wd){Tg=!0;do for(var l=!1,h=Sd;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var v=0;else{var C=h.suspendedLanes,I=h.pingedLanes;v=(1<<31-Pe(42|s)+1)-1,v&=m&~(C&~I),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,tx(h,v))}else v=At,v=K(h,h===nn?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||de(h,v)||(l=!0,tx(h,v));h=h.next}while(l);Tg=!1}}function g3(){Jw()}function Jw(){wd=Eg=!1;var s=0;ya!==0&&T3()&&(s=ya);for(var a=st(),l=null,h=Sd;h!==null;){var m=h.next,v=Qw(h,a);v===0?(h.next=null,l===null?Sd=m:l.next=m,m===null&&(yl=l)):(l=h,(s!==0||(v&3)!==0)&&(wd=!0)),h=m}Zn!==0&&Zn!==5||Xc(s),ya!==0&&(ya=0)}function Qw(s,a){for(var l=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var C=31-Pe(v),I=1<<C,V=m[C];V===-1?((I&l)===0||(I&h)!==0)&&(m[C]=ye(I,a)):V<=a&&(s.expiredLanes|=I),v&=~I}if(a=nn,l=At,l=K(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,l===0||s===a&&(Wt===2||Wt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Ht(h),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||de(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(h!==null&&Ht(h),Yn(l)){case 2:case 8:l=Ee;break;case 32:l=ft;break;case 268435456:l=Ci;break;default:l=ft}return h=ex.bind(null,s),l=Ye(l,h),s.callbackPriority=a,s.callbackNode=l,a}return h!==null&&h!==null&&Ht(h),s.callbackPriority=2,s.callbackNode=null,2}function ex(s,a){if(Zn!==0&&Zn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(bd()&&s.callbackNode!==l)return null;var h=At;return h=K(s,s===nn?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(jw(s,h,a),Qw(s,st()),s.callbackNode!=null&&s.callbackNode===l?ex.bind(null,s):null)}function tx(s,a){if(bd())return null;jw(s,a,!0)}function _3(){R3(function(){(zt&6)!==0?Ye(bt,g3):Jw()})}function Ag(){if(ya===0){var s=sl;s===0&&(s=Ni,Ni<<=1,(Ni&261888)===0&&(Ni=256)),ya=s}return ya}function nx(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:na(""+s)}function ix(s,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,s.id&&l.setAttribute("form",s.id),a.parentNode.insertBefore(l,a),s=new FormData(s),l.parentNode.removeChild(l),s}function v3(s,a,l,h,m){if(a==="submit"&&l&&l.stateNode===m){var v=nx((m[re]||null).action),C=h.submitter;C&&(a=(a=C[re]||null)?nx(a.formAction):C.getAttribute("formAction"),a!==null&&(v=a,C=null));var I=new Dh("action","action",null,h,m);s.push({event:I,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(ya!==0){var V=C?ix(m,C):new FormData(m);Vm(l,{pending:!0,data:V,method:m.method,action:v},null,V)}}else typeof v=="function"&&(I.preventDefault(),V=C?ix(m,C):new FormData(m),Vm(l,{pending:!0,data:V,method:m.method,action:v},v,V))},currentTarget:m}]})}}for(var Rg=0;Rg<hm.length;Rg++){var Ng=hm[Rg],y3=Ng.toLowerCase(),b3=Ng[0].toUpperCase()+Ng.slice(1);Fs(y3,"on"+b3)}Fs(D1,"onAnimationEnd"),Fs(j1,"onAnimationIteration"),Fs(I1,"onAnimationStart"),Fs("dblclick","onDoubleClick"),Fs("focusin","onFocus"),Fs("focusout","onBlur"),Fs(IM,"onTransitionRun"),Fs(BM,"onTransitionStart"),Fs($M,"onTransitionCancel"),Fs(B1,"onTransitionEnd"),be("onMouseEnter",["mouseout","mouseover"]),be("onMouseLeave",["mouseout","mouseover"]),be("onPointerEnter",["pointerout","pointerover"]),be("onPointerLeave",["pointerout","pointerover"]),Lt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Lt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Lt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Lt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Lt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Lt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zc="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(" "),S3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zc));function sx(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var h=s[l],m=h.event;h=h.listeners;e:{var v=void 0;if(a)for(var C=h.length-1;0<=C;C--){var I=h[C],V=I.instance,ne=I.currentTarget;if(I=I.listener,V!==v&&m.isPropagationStopped())break e;v=I,m.currentTarget=ne;try{v(m)}catch(fe){Bh(fe)}m.currentTarget=null,v=V}else for(C=0;C<h.length;C++){if(I=h[C],V=I.instance,ne=I.currentTarget,I=I.listener,V!==v&&m.isPropagationStopped())break e;v=I,m.currentTarget=ne;try{v(m)}catch(fe){Bh(fe)}m.currentTarget=null,v=V}}}}function kt(s,a){var l=a[Vt];l===void 0&&(l=a[Vt]=new Set);var h=s+"__bubble";l.has(h)||(rx(a,s,2,!1),l.add(h))}function Lg(s,a,l){var h=0;a&&(h|=4),rx(l,s,h,a)}var xd="_reactListening"+Math.random().toString(36).slice(2);function Mg(s){if(!s[xd]){s[xd]=!0,Pt.forEach(function(l){l!=="selectionchange"&&(S3.has(l)||Lg(l,!1,s),Lg(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[xd]||(a[xd]=!0,Lg("selectionchange",!1,a))}}function rx(s,a,l,h){switch(Dx(a)){case 2:var m=Y3;break;case 8:m=X3;break;default:m=Kg}l=m.bind(null,a,l,s),m=void 0,!Jp||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(a,l,{capture:!0,passive:m}):s.addEventListener(a,l,!0):m!==void 0?s.addEventListener(a,l,{passive:m}):s.addEventListener(a,l,!1)}function Og(s,a,l,h,m){var v=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var C=h.tag;if(C===3||C===4){var I=h.stateNode.containerInfo;if(I===m)break;if(C===4)for(C=h.return;C!==null;){var V=C.tag;if((V===3||V===4)&&C.stateNode.containerInfo===m)return;C=C.return}for(;I!==null;){if(C=q(I),C===null)return;if(V=C.tag,V===5||V===6||V===26||V===27){h=v=C;continue e}I=I.parentNode}}h=h.return}Nh(function(){var ne=v,fe=dt(l),_e=[];e:{var ae=$1.get(s);if(ae!==void 0){var ce=Dh,ze=s;switch(s){case"keypress":if(Mh(l)===0)break e;case"keydown":case"keyup":ce=pM;break;case"focusin":ze="focus",ce=nm;break;case"focusout":ze="blur",ce=nm;break;case"beforeblur":case"afterblur":ce=nm;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=f1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=nM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=_M;break;case D1:case j1:case I1:ce=rM;break;case B1:ce=yM;break;case"scroll":case"scrollend":ce=eM;break;case"wheel":ce=SM;break;case"copy":case"cut":case"paste":ce=oM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=m1;break;case"toggle":case"beforetoggle":ce=xM}var et=(a&4)!==0,Jt=!et&&(s==="scroll"||s==="scrollend"),Q=et?ae!==null?ae+"Capture":null:ae;et=[];for(var X=ne,te;X!==null;){var ge=X;if(te=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||te===null||Q===null||(ge=yc(X,Q),ge!=null&&et.push(Jc(X,ge,te))),Jt)break;X=X.return}0<et.length&&(ae=new ce(ae,ze,null,l,fe),_e.push({event:ae,listeners:et}))}}if((a&7)===0){e:{if(ae=s==="mouseover"||s==="pointerover",ce=s==="mouseout"||s==="pointerout",ae&&l!==We&&(ze=l.relatedTarget||l.fromElement)&&(q(ze)||ze[ht]))break e;if((ce||ae)&&(ae=fe.window===fe?fe:(ae=fe.ownerDocument)?ae.defaultView||ae.parentWindow:window,ce?(ze=l.relatedTarget||l.toElement,ce=ne,ze=ze?q(ze):null,ze!==null&&(Jt=o(ze),et=ze.tag,ze!==Jt||et!==5&&et!==27&&et!==6)&&(ze=null)):(ce=null,ze=ne),ce!==ze)){if(et=f1,ge="onMouseLeave",Q="onMouseEnter",X="mouse",(s==="pointerout"||s==="pointerover")&&(et=m1,ge="onPointerLeave",Q="onPointerEnter",X="pointer"),Jt=ce==null?ae:Ae(ce),te=ze==null?ae:Ae(ze),ae=new et(ge,X+"leave",ce,l,fe),ae.target=Jt,ae.relatedTarget=te,ge=null,q(fe)===ne&&(et=new et(Q,X+"enter",ze,l,fe),et.target=te,et.relatedTarget=Jt,ge=et),Jt=ge,ce&&ze)t:{for(et=w3,Q=ce,X=ze,te=0,ge=Q;ge;ge=et(ge))te++;ge=0;for(var Ve=X;Ve;Ve=et(Ve))ge++;for(;0<te-ge;)Q=et(Q),te--;for(;0<ge-te;)X=et(X),ge--;for(;te--;){if(Q===X||X!==null&&Q===X.alternate){et=Q;break t}Q=et(Q),X=et(X)}et=null}else et=null;ce!==null&&ax(_e,ae,ce,et,!1),ze!==null&&Jt!==null&&ax(_e,Jt,ze,et,!0)}}e:{if(ae=ne?Ae(ne):window,ce=ae.nodeName&&ae.nodeName.toLowerCase(),ce==="select"||ce==="input"&&ae.type==="file")var jt=x1;else if(S1(ae))if(C1)jt=OM;else{jt=LM;var qe=NM}else ce=ae.nodeName,!ce||ce.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?ne&&ta(ne.elementType)&&(jt=x1):jt=MM;if(jt&&(jt=jt(s,ne))){w1(_e,jt,l,fe);break e}qe&&qe(s,ae,ne),s==="focusout"&&ne&&ae.type==="number"&&ne.memoizedProps.value!=null&&Ko(ae,"number",ae.value)}switch(qe=ne?Ae(ne):window,s){case"focusin":(S1(qe)||qe.contentEditable==="true")&&(Xo=qe,lm=ne,Tc=null);break;case"focusout":Tc=lm=Xo=null;break;case"mousedown":cm=!0;break;case"contextmenu":case"mouseup":case"dragend":cm=!1,M1(_e,l,fe);break;case"selectionchange":if(jM)break;case"keydown":case"keyup":M1(_e,l,fe)}var mt;if(sm)e:{switch(s){case"compositionstart":var Rt="onCompositionStart";break e;case"compositionend":Rt="onCompositionEnd";break e;case"compositionupdate":Rt="onCompositionUpdate";break e}Rt=void 0}else Yo?y1(s,l)&&(Rt="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Rt="onCompositionStart");Rt&&(g1&&l.locale!=="ko"&&(Yo||Rt!=="onCompositionStart"?Rt==="onCompositionEnd"&&Yo&&(mt=h1()):(ia=fe,Qp="value"in ia?ia.value:ia.textContent,Yo=!0)),qe=Cd(ne,Rt),0<qe.length&&(Rt=new p1(Rt,s,null,l,fe),_e.push({event:Rt,listeners:qe}),mt?Rt.data=mt:(mt=b1(l),mt!==null&&(Rt.data=mt)))),(mt=kM?EM(s,l):TM(s,l))&&(Rt=Cd(ne,"onBeforeInput"),0<Rt.length&&(qe=new p1("onBeforeInput","beforeinput",null,l,fe),_e.push({event:qe,listeners:Rt}),qe.data=mt)),v3(_e,s,ne,l,fe)}sx(_e,a)})}function Jc(s,a,l){return{instance:s,listener:a,currentTarget:l}}function Cd(s,a){for(var l=a+"Capture",h=[];s!==null;){var m=s,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=yc(s,l),m!=null&&h.unshift(Jc(s,m,v)),m=yc(s,a),m!=null&&h.push(Jc(s,m,v))),s.tag===3)return h;s=s.return}return[]}function w3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function ax(s,a,l,h,m){for(var v=a._reactName,C=[];l!==null&&l!==h;){var I=l,V=I.alternate,ne=I.stateNode;if(I=I.tag,V!==null&&V===h)break;I!==5&&I!==26&&I!==27||ne===null||(V=ne,m?(ne=yc(l,v),ne!=null&&C.unshift(Jc(l,ne,V))):m||(ne=yc(l,v),ne!=null&&C.push(Jc(l,ne,V)))),l=l.return}C.length!==0&&s.push({event:a,listeners:C})}var x3=/\r\n?/g,C3=/\u0000|\uFFFD/g;function ox(s){return(typeof s=="string"?s:""+s).replace(x3,`
|
|
9
|
-
`).replace(C3,"")}function lx(s,a){return a=ox(a),ox(s)===a}function Zt(s,a,l,h,m,v){switch(l){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||nt(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&nt(s,""+h);break;case"className":Li(s,"class",h);break;case"tabIndex":Li(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Li(s,l,h);break;case"style":Ut(s,h,v);break;case"data":if(a!=="object"){Li(s,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||l!=="href")){s.removeAttribute(l);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=na(""+h),s.setAttribute(l,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(l,"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 v=="function"&&(l==="formAction"?(a!=="input"&&Zt(s,a,"name",m.name,m,null),Zt(s,a,"formEncType",m.formEncType,m,null),Zt(s,a,"formMethod",m.formMethod,m,null),Zt(s,a,"formTarget",m.formTarget,m,null)):(Zt(s,a,"encType",m.encType,m,null),Zt(s,a,"method",m.method,m,null),Zt(s,a,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(l);break}h=na(""+h),s.setAttribute(l,h);break;case"onClick":h!=null&&(s.onclick=Te);break;case"onScroll":h!=null&&kt("scroll",s);break;case"onScrollEnd":h!=null&&kt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}l=na(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(l,""+h):s.removeAttribute(l);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":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":h===!0?s.setAttribute(l,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(l,h):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(l,h):s.removeAttribute(l);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(l):s.setAttribute(l,h);break;case"popover":kt("beforetoggle",s),kt("toggle",s),Xn(s,"popover",h);break;case"xlinkActuate":ki(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":ki(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":ki(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":ki(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":ki(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":ki(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":ki(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":ki(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":ki(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Xn(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Sr.get(l)||l,Xn(s,l,h))}}function Dg(s,a,l,h,m,v){switch(l){case"style":Ut(s,h,v);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(l=h.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"children":typeof h=="string"?nt(s,h):(typeof h=="number"||typeof h=="bigint")&&nt(s,""+h);break;case"onScroll":h!=null&&kt("scroll",s);break;case"onScrollEnd":h!=null&&kt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=Te);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tn.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),a=l.slice(2,m?l.length-7:void 0),v=s[re]||null,v=v!=null?v[l]:null,typeof v=="function"&&s.removeEventListener(a,v,m),typeof h=="function")){typeof v!="function"&&v!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(a,h,m);break e}l in s?s[l]=h:h===!0?s.setAttribute(l,""):Xn(s,l,h)}}}function yi(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",s),kt("load",s);var h=!1,m=!1,v;for(v in l)if(l.hasOwnProperty(v)){var C=l[v];if(C!=null)switch(v){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Zt(s,a,v,C,l,null)}}m&&Zt(s,a,"srcSet",l.srcSet,l,null),h&&Zt(s,a,"src",l.src,l,null);return;case"input":kt("invalid",s);var I=v=C=m=null,V=null,ne=null;for(h in l)if(l.hasOwnProperty(h)){var fe=l[h];if(fe!=null)switch(h){case"name":m=fe;break;case"type":C=fe;break;case"checked":V=fe;break;case"defaultChecked":ne=fe;break;case"value":v=fe;break;case"defaultValue":I=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(i(137,a));break;default:Zt(s,a,h,fe,l,null)}}Ja(s,v,I,V,ne,C,m,!1);return;case"select":kt("invalid",s),h=C=v=null;for(m in l)if(l.hasOwnProperty(m)&&(I=l[m],I!=null))switch(m){case"value":v=I;break;case"defaultValue":C=I;break;case"multiple":h=I;default:Zt(s,a,m,I,l,null)}a=v,l=C,s.multiple=!!h,a!=null?mi(s,!!h,a,!1):l!=null&&mi(s,!!h,l,!0);return;case"textarea":kt("invalid",s),v=m=h=null;for(C in l)if(l.hasOwnProperty(C)&&(I=l[C],I!=null))switch(C){case"value":h=I;break;case"defaultValue":m=I;break;case"children":v=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(i(91));break;default:Zt(s,a,C,I,l,null)}Vo(s,h,m,v);return;case"option":for(V in l)l.hasOwnProperty(V)&&(h=l[V],h!=null)&&(V==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":Zt(s,a,V,h,l,null));return;case"dialog":kt("beforetoggle",s),kt("toggle",s),kt("cancel",s),kt("close",s);break;case"iframe":case"object":kt("load",s);break;case"video":case"audio":for(h=0;h<Zc.length;h++)kt(Zc[h],s);break;case"image":kt("error",s),kt("load",s);break;case"details":kt("toggle",s);break;case"embed":case"source":case"link":kt("error",s),kt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in l)if(l.hasOwnProperty(ne)&&(h=l[ne],h!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Zt(s,a,ne,h,l,null)}return;default:if(ta(a)){for(fe in l)l.hasOwnProperty(fe)&&(h=l[fe],h!==void 0&&Dg(s,a,fe,h,l,void 0));return}}for(I in l)l.hasOwnProperty(I)&&(h=l[I],h!=null&&Zt(s,a,I,h,l,null))}function k3(s,a,l,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,v=null,C=null,I=null,V=null,ne=null,fe=null;for(ce in l){var _e=l[ce];if(l.hasOwnProperty(ce)&&_e!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":V=_e;default:h.hasOwnProperty(ce)||Zt(s,a,ce,null,h,_e)}}for(var ae in h){var ce=h[ae];if(_e=l[ae],h.hasOwnProperty(ae)&&(ce!=null||_e!=null))switch(ae){case"type":v=ce;break;case"name":m=ce;break;case"checked":ne=ce;break;case"defaultChecked":fe=ce;break;case"value":C=ce;break;case"defaultValue":I=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,a));break;default:ce!==_e&&Zt(s,a,ae,ce,h,_e)}}gc(s,C,I,V,ne,fe,v,m);return;case"select":ce=C=I=ae=null;for(v in l)if(V=l[v],l.hasOwnProperty(v)&&V!=null)switch(v){case"value":break;case"multiple":ce=V;default:h.hasOwnProperty(v)||Zt(s,a,v,null,h,V)}for(m in h)if(v=h[m],V=l[m],h.hasOwnProperty(m)&&(v!=null||V!=null))switch(m){case"value":ae=v;break;case"defaultValue":I=v;break;case"multiple":C=v;default:v!==V&&Zt(s,a,m,v,h,V)}a=I,l=C,h=ce,ae!=null?mi(s,!!l,ae,!1):!!h!=!!l&&(a!=null?mi(s,!!l,a,!0):mi(s,!!l,l?[]:"",!1));return;case"textarea":ce=ae=null;for(I in l)if(m=l[I],l.hasOwnProperty(I)&&m!=null&&!h.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Zt(s,a,I,null,h,m)}for(C in h)if(m=h[C],v=l[C],h.hasOwnProperty(C)&&(m!=null||v!=null))switch(C){case"value":ae=m;break;case"defaultValue":ce=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&Zt(s,a,C,m,h,v)}Ah(s,ae,ce);return;case"option":for(var ze in l)ae=l[ze],l.hasOwnProperty(ze)&&ae!=null&&!h.hasOwnProperty(ze)&&(ze==="selected"?s.selected=!1:Zt(s,a,ze,null,h,ae));for(V in h)ae=h[V],ce=l[V],h.hasOwnProperty(V)&&ae!==ce&&(ae!=null||ce!=null)&&(V==="selected"?s.selected=ae&&typeof ae!="function"&&typeof ae!="symbol":Zt(s,a,V,ae,h,ce));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 et in l)ae=l[et],l.hasOwnProperty(et)&&ae!=null&&!h.hasOwnProperty(et)&&Zt(s,a,et,null,h,ae);for(ne in h)if(ae=h[ne],ce=l[ne],h.hasOwnProperty(ne)&&ae!==ce&&(ae!=null||ce!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,a));break;default:Zt(s,a,ne,ae,h,ce)}return;default:if(ta(a)){for(var Jt in l)ae=l[Jt],l.hasOwnProperty(Jt)&&ae!==void 0&&!h.hasOwnProperty(Jt)&&Dg(s,a,Jt,void 0,h,ae);for(fe in h)ae=h[fe],ce=l[fe],!h.hasOwnProperty(fe)||ae===ce||ae===void 0&&ce===void 0||Dg(s,a,fe,ae,h,ce);return}}for(var Q in l)ae=l[Q],l.hasOwnProperty(Q)&&ae!=null&&!h.hasOwnProperty(Q)&&Zt(s,a,Q,null,h,ae);for(_e in h)ae=h[_e],ce=l[_e],!h.hasOwnProperty(_e)||ae===ce||ae==null&&ce==null||Zt(s,a,_e,ae,h,ce)}function cx(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function E3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,l=performance.getEntriesByType("resource"),h=0;h<l.length;h++){var m=l[h],v=m.transferSize,C=m.initiatorType,I=m.duration;if(v&&I&&cx(C)){for(C=0,I=m.responseEnd,h+=1;h<l.length;h++){var V=l[h],ne=V.startTime;if(ne>I)break;var fe=V.transferSize,_e=V.initiatorType;fe&&cx(_e)&&(V=V.responseEnd,C+=fe*(V<I?1:(I-ne)/(V-ne)))}if(--h,a+=8*(v+C)/(m.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var jg=null,Ig=null;function kd(s){return s.nodeType===9?s:s.ownerDocument}function ux(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function hx(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function Bg(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var $g=null;function T3(){var s=window.event;return s&&s.type==="popstate"?s===$g?!1:($g=s,!0):($g=null,!1)}var dx=typeof setTimeout=="function"?setTimeout:void 0,A3=typeof clearTimeout=="function"?clearTimeout:void 0,fx=typeof Promise=="function"?Promise:void 0,R3=typeof queueMicrotask=="function"?queueMicrotask:typeof fx<"u"?function(s){return fx.resolve(null).then(s).catch(N3)}:dx;function N3(s){setTimeout(function(){throw s})}function ba(s){return s==="head"}function px(s,a){var l=a,h=0;do{var m=l.nextSibling;if(s.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(h===0){s.removeChild(m),xl(a);return}h--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")h++;else if(l==="html")Qc(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Qc(l);for(var v=l.firstChild;v;){var C=v.nextSibling,I=v.nodeName;v[gn]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=C}}else l==="body"&&Qc(s.ownerDocument.body);l=m}while(l);xl(a)}function mx(s,a){var l=s;s=0;do{var h=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),h&&h.nodeType===8)if(l=h.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=h}while(l)}function Pg(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Pg(l),je(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function L3(s,a,l,h){for(;s.nodeType===1;){var m=l;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[gn])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=Es(s.nextSibling),s===null)break}return null}function M3(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Es(s.nextSibling),s===null))return null;return s}function gx(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Es(s.nextSibling),s===null))return null;return s}function zg(s){return s.data==="$?"||s.data==="$~"}function Hg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function O3(s,a){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||l.readyState!=="loading")a();else{var h=function(){a(),l.removeEventListener("DOMContentLoaded",h)};l.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function Es(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var Fg=null;function _x(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return Es(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function vx(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return s;a--}else l!=="/$"&&l!=="/&"||a++}s=s.previousSibling}return null}function yx(s,a,l){switch(a=kd(l),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Qc(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);je(s)}var Ts=new Map,bx=new Set;function Ed(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Br=B.d;B.d={f:D3,r:j3,D:I3,C:B3,L:$3,m:P3,X:H3,S:z3,M:F3};function D3(){var s=Br.f(),a=_d();return s||a}function j3(s){var a=se(s);a!==null&&a.tag===5&&a.type==="form"?BS(a):Br.r(s)}var bl=typeof document>"u"?null:document;function Sx(s,a,l){var h=bl;if(h&&typeof a=="string"&&a){var m=Ui(a);m='link[rel="'+s+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),bx.has(m)||(bx.add(m),s={rel:s,crossOrigin:l,href:a},h.querySelector(m)===null&&(a=h.createElement("link"),yi(a,"link",s),ct(a),h.head.appendChild(a)))}}function I3(s){Br.D(s),Sx("dns-prefetch",s,null)}function B3(s,a){Br.C(s,a),Sx("preconnect",s,a)}function $3(s,a,l){Br.L(s,a,l);var h=bl;if(h&&s&&a){var m='link[rel="preload"][as="'+Ui(a)+'"]';a==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Ui(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Ui(l.imageSizes)+'"]')):m+='[href="'+Ui(s)+'"]';var v=m;switch(a){case"style":v=Sl(s);break;case"script":v=wl(s)}Ts.has(v)||(s=g({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),Ts.set(v,s),h.querySelector(m)!==null||a==="style"&&h.querySelector(eu(v))||a==="script"&&h.querySelector(tu(v))||(a=h.createElement("link"),yi(a,"link",s),ct(a),h.head.appendChild(a)))}}function P3(s,a){Br.m(s,a);var l=bl;if(l&&s){var h=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Ui(h)+'"][href="'+Ui(s)+'"]',v=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=wl(s)}if(!Ts.has(v)&&(s=g({rel:"modulepreload",href:s},a),Ts.set(v,s),l.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(tu(v)))return}h=l.createElement("link"),yi(h,"link",s),ct(h),l.head.appendChild(h)}}}function z3(s,a,l){Br.S(s,a,l);var h=bl;if(h&&s){var m=lt(h).hoistableStyles,v=Sl(s);a=a||"default";var C=m.get(v);if(!C){var I={loading:0,preload:null};if(C=h.querySelector(eu(v)))I.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":a},l),(l=Ts.get(v))&&Ug(s,l);var V=C=h.createElement("link");ct(V),yi(V,"link",s),V._p=new Promise(function(ne,fe){V.onload=ne,V.onerror=fe}),V.addEventListener("load",function(){I.loading|=1}),V.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Td(C,a,h)}C={type:"stylesheet",instance:C,count:1,state:I},m.set(v,C)}}}function H3(s,a){Br.X(s,a);var l=bl;if(l&&s){var h=lt(l).hoistableScripts,m=wl(s),v=h.get(m);v||(v=l.querySelector(tu(m)),v||(s=g({src:s,async:!0},a),(a=Ts.get(m))&&Wg(s,a),v=l.createElement("script"),ct(v),yi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(m,v))}}function F3(s,a){Br.M(s,a);var l=bl;if(l&&s){var h=lt(l).hoistableScripts,m=wl(s),v=h.get(m);v||(v=l.querySelector(tu(m)),v||(s=g({src:s,async:!0,type:"module"},a),(a=Ts.get(m))&&Wg(s,a),v=l.createElement("script"),ct(v),yi(v,"link",s),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(m,v))}}function wx(s,a,l,h){var m=(m=oe.current)?Ed(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=Sl(l.href),l=lt(m).hoistableStyles,h=l.get(a),h||(h={type:"style",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=Sl(l.href);var v=lt(m).hoistableStyles,C=v.get(s);if(C||(m=m.ownerDocument||m,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,C),(v=m.querySelector(eu(s)))&&!v._p&&(C.instance=v,C.state.loading=5),Ts.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ts.set(s,l),v||U3(m,s,l,C.state))),a&&h===null)throw Error(i(528,""));return C}if(a&&h!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=wl(l),l=lt(m).hoistableScripts,h=l.get(a),h||(h={type:"script",instance:null,count:0,state:null},l.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Sl(s){return'href="'+Ui(s)+'"'}function eu(s){return'link[rel="stylesheet"]['+s+"]"}function xx(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function U3(s,a,l,h){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=s.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),yi(a,"link",l),ct(a),s.head.appendChild(a))}function wl(s){return'[src="'+Ui(s)+'"]'}function tu(s){return"script[async]"+s}function Cx(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+Ui(l.href)+'"]');if(h)return a.instance=h,ct(h),h;var m=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),ct(h),yi(h,"style",m),Td(h,l.precedence,s),a.instance=h;case"stylesheet":m=Sl(l.href);var v=s.querySelector(eu(m));if(v)return a.state.loading|=4,a.instance=v,ct(v),v;h=xx(l),(m=Ts.get(m))&&Ug(h,m),v=(s.ownerDocument||s).createElement("link"),ct(v);var C=v;return C._p=new Promise(function(I,V){C.onload=I,C.onerror=V}),yi(v,"link",h),a.state.loading|=4,Td(v,l.precedence,s),a.instance=v;case"script":return v=wl(l.src),(m=s.querySelector(tu(v)))?(a.instance=m,ct(m),m):(h=l,(m=Ts.get(v))&&(h=g({},l),Wg(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),ct(m),yi(m,"link",h),s.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Td(h,l.precedence,s));return a.instance}function Td(s,a,l){for(var h=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,v=m,C=0;C<h.length;C++){var I=h[C];if(I.dataset.precedence===a)v=I;else if(v!==m)break}v?v.parentNode.insertBefore(s,v.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(s,a.firstChild))}function Ug(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Wg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Ad=null;function kx(s,a,l){if(Ad===null){var h=new Map,m=Ad=new Map;m.set(l,h)}else m=Ad,h=m.get(l),h||(h=new Map,m.set(l,h));if(h.has(s))return h;for(h.set(s,null),l=l.getElementsByTagName(s),m=0;m<l.length;m++){var v=l[m];if(!(v[gn]||v[Kt]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var C=v.getAttribute(a)||"";C=s+C;var I=h.get(C);I?I.push(v):h.set(C,[v])}}return h}function Ex(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function W3(s,a,l){if(l===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Tx(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function q3(s,a,l,h){if(l.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var m=Sl(h.href),v=a.querySelector(eu(m));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Rd.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=v,ct(v);return}v=a.ownerDocument||a,h=xx(h),(m=Ts.get(m))&&Ug(h,m),v=v.createElement("link"),ct(v);var C=v;C._p=new Promise(function(I,V){C.onload=I,C.onerror=V}),yi(v,"link",h),l.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Rd.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var qg=0;function G3(s,a){return s.stylesheets&&s.count===0&&Ld(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var h=setTimeout(function(){if(s.stylesheets&&Ld(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+a);0<s.imgBytes&&qg===0&&(qg=62500*E3());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Ld(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>qg?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function Rd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ld(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Nd=null;function Ld(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Nd=new Map,a.forEach(K3,s),Nd=null,Rd.call(s))}function K3(s,a){if(!(a.state.loading&4)){var l=Nd.get(s);if(l)var h=l.get(null);else{l=new Map,Nd.set(s,l);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var C=m[v];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(l.set(C.dataset.precedence,C),h=C)}h&&l.set(null,h)}m=a.instance,C=m.getAttribute("data-precedence"),v=l.get(C)||h,v===h&&l.set(null,m),l.set(C,m),this.count++,h=Rd.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),v?v.parentNode.insertBefore(m,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),a.state.loading|=4}}var nu={$$typeof:z,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function V3(s,a,l,h,m,v,C,I,V){this.tag=1,this.containerInfo=s,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=Ft(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ft(0),this.hiddenUpdates=Ft(null),this.identifierPrefix=h,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function Ax(s,a,l,h,m,v,C,I,V,ne,fe,_e){return s=new V3(s,a,l,C,V,ne,fe,_e,I),a=1,v===!0&&(a|=24),v=rs(3,null,null,a),s.current=v,v.stateNode=s,a=Cm(),a.refCount++,s.pooledCache=a,a.refCount++,v.memoizedState={element:h,isDehydrated:l,cache:a},Am(v),s}function Rx(s){return s?(s=Qo,s):Qo}function Nx(s,a,l,h,m,v){m=Rx(m),h.context===null?h.context=m:h.pendingContext=m,h=ca(a),h.payload={element:l},v=v===void 0?null:v,v!==null&&(h.callback=v),l=ua(s,h,a),l!==null&&(Yi(l,s,a),Dc(l,s,a))}function Lx(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Gg(s,a){Lx(s,a),(s=s.alternate)&&Lx(s,a)}function Mx(s){if(s.tag===13||s.tag===31){var a=no(s,67108864);a!==null&&Yi(a,s,67108864),Gg(s,67108864)}}function Ox(s){if(s.tag===13||s.tag===31){var a=us();a=St(a);var l=no(s,a);l!==null&&Yi(l,s,a),Gg(s,a)}}var Md=!0;function Y3(s,a,l,h){var m=k.T;k.T=null;var v=B.p;try{B.p=2,Kg(s,a,l,h)}finally{B.p=v,k.T=m}}function X3(s,a,l,h){var m=k.T;k.T=null;var v=B.p;try{B.p=8,Kg(s,a,l,h)}finally{B.p=v,k.T=m}}function Kg(s,a,l,h){if(Md){var m=Vg(h);if(m===null)Og(s,a,h,Od,l),jx(s,h);else if(J3(m,s,a,l,h))h.stopPropagation();else if(jx(s,h),a&4&&-1<Z3.indexOf(s)){for(;m!==null;){var v=se(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var C=Gt(v.pendingLanes);if(C!==0){var I=v;for(I.pendingLanes|=2,I.entangledLanes|=2;C;){var V=1<<31-Pe(C);I.entanglements[1]|=V,C&=~V}rr(v),(zt&6)===0&&(md=st()+500,Xc(0))}}break;case 31:case 13:I=no(v,2),I!==null&&Yi(I,v,2),_d(),Gg(v,2)}if(v=Vg(h),v===null&&Og(s,a,h,Od,l),v===m)break;m=v}m!==null&&h.stopPropagation()}else Og(s,a,h,null,l)}}function Vg(s){return s=dt(s),Yg(s)}var Od=null;function Yg(s){if(Od=null,s=q(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=c(a),s!==null)return s;s=null}else if(l===31){if(s=d(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Od=s,null}function Dx(s){switch(s){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(Vn()){case bt:return 2;case Ee:return 8;case ft:case pn:return 32;case Ci:return 268435456;default:return 32}default:return 32}}var Xg=!1,Sa=null,wa=null,xa=null,iu=new Map,su=new Map,Ca=[],Z3="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 jx(s,a){switch(s){case"focusin":case"focusout":Sa=null;break;case"dragenter":case"dragleave":wa=null;break;case"mouseover":case"mouseout":xa=null;break;case"pointerover":case"pointerout":iu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":su.delete(a.pointerId)}}function ru(s,a,l,h,m,v){return s===null||s.nativeEvent!==v?(s={blockedOn:a,domEventName:l,eventSystemFlags:h,nativeEvent:v,targetContainers:[m]},a!==null&&(a=se(a),a!==null&&Mx(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function J3(s,a,l,h,m){switch(a){case"focusin":return Sa=ru(Sa,s,a,l,h,m),!0;case"dragenter":return wa=ru(wa,s,a,l,h,m),!0;case"mouseover":return xa=ru(xa,s,a,l,h,m),!0;case"pointerover":var v=m.pointerId;return iu.set(v,ru(iu.get(v)||null,s,a,l,h,m)),!0;case"gotpointercapture":return v=m.pointerId,su.set(v,ru(su.get(v)||null,s,a,l,h,m)),!0}return!1}function Ix(s){var a=q(s.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=c(l),a!==null){s.blockedOn=a,ns(s.priority,function(){Ox(l)});return}}else if(a===31){if(a=d(l),a!==null){s.blockedOn=a,ns(s.priority,function(){Ox(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Dd(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=Vg(s.nativeEvent);if(l===null){l=s.nativeEvent;var h=new l.constructor(l.type,l);We=h,l.target.dispatchEvent(h),We=null}else return a=se(l),a!==null&&Mx(a),s.blockedOn=l,!1;a.shift()}return!0}function Bx(s,a,l){Dd(s)&&l.delete(a)}function Q3(){Xg=!1,Sa!==null&&Dd(Sa)&&(Sa=null),wa!==null&&Dd(wa)&&(wa=null),xa!==null&&Dd(xa)&&(xa=null),iu.forEach(Bx),su.forEach(Bx)}function jd(s,a){s.blockedOn===a&&(s.blockedOn=null,Xg||(Xg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Q3)))}var Id=null;function $x(s){Id!==s&&(Id=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Id===s&&(Id=null);for(var a=0;a<s.length;a+=3){var l=s[a],h=s[a+1],m=s[a+2];if(typeof h!="function"){if(Yg(h||l)===null)continue;break}var v=se(l);v!==null&&(s.splice(a,3),a-=3,Vm(v,{pending:!0,data:m,method:l.method,action:h},h,m))}}))}function xl(s){function a(V){return jd(V,s)}Sa!==null&&jd(Sa,s),wa!==null&&jd(wa,s),xa!==null&&jd(xa,s),iu.forEach(a),su.forEach(a);for(var l=0;l<Ca.length;l++){var h=Ca[l];h.blockedOn===s&&(h.blockedOn=null)}for(;0<Ca.length&&(l=Ca[0],l.blockedOn===null);)Ix(l),l.blockedOn===null&&Ca.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(h=0;h<l.length;h+=3){var m=l[h],v=l[h+1],C=m[re]||null;if(typeof v=="function")C||$x(l);else if(C){var I=null;if(v&&v.hasAttribute("formAction")){if(m=v,C=v[re]||null)I=C.formAction;else if(Yg(m)!==null)continue}else I=C.action;typeof I=="function"?l[h+1]=I:(l.splice(h,3),h-=3),$x(l)}}}function Px(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(C){return m=C})},focusReset:"manual",scroll:"manual"})}function a(){m!==null&&(m(),m=null),h||setTimeout(l,20)}function l(){if(!h&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),m!==null&&(m(),m=null)}}}function Zg(s){this._internalRoot=s}Bd.prototype.render=Zg.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,h=us();Nx(l,h,s,a,null,null)},Bd.prototype.unmount=Zg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Nx(s.current,2,null,s,null,null),_d(),a[ht]=null}};function Bd(s){this._internalRoot=s}Bd.prototype.unstable_scheduleHydration=function(s){if(s){var a=Hs();s={blockedOn:null,target:s,priority:a};for(var l=0;l<Ca.length&&a!==0&&a<Ca[l].priority;l++);Ca.splice(l,0,s),l===0&&Ix(s)}};var zx=t.version;if(zx!=="19.2.7")throw Error(i(527,zx,"19.2.7"));B.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=p(a),s=s!==null?_(s):null,s=s===null?null:s.stateNode,s};var e6={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$d.isDisabled&&$d.supportsFiber)try{mn=$d.inject(e6),ie=$d}catch{}}return ou.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,h="",m=KS,v=VS,C=YS;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),a=Ax(s,1,!1,null,null,l,h,null,m,v,C,Px),s[ht]=a.current,Mg(s),new Zg(a)},ou.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var h=!1,m="",v=KS,C=VS,I=YS,V=null;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(C=l.onCaughtError),l.onRecoverableError!==void 0&&(I=l.onRecoverableError),l.formState!==void 0&&(V=l.formState)),a=Ax(s,1,!0,a,l??null,h,m,V,v,C,I,Px),a.context=Rx(null),l=a.current,h=us(),h=St(h),m=ca(h),m.callback=null,ua(l,m,h),l=h,a.current.lanes=l,Dt(a,l),rr(a),s[ht]=a.current,Mg(s),new Bd(a)},ou.version="19.2.7",ou}var Zx;function H6(){if(Zx)return t_.exports;Zx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),t_.exports=z6(),t_.exports}var F6=H6();var Jx="popstate";function Qx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function U6(e={}){function t(i,r){let o=r.state?.masked,{pathname:c,search:d,hash:f}=o||i.location;return jv("",{pathname:c,search:d,hash:f},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:eh(r)}return q6(t,n,null,e)}function vn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function W6(){return Math.random().toString(36).substring(2,10)}function eC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function jv(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ac(t):t,state:n,key:t&&t.key||i||W6(),mask:r}}function eh({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ac(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function q6(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,c=r.history,d="POP",f=null,p=_();p==null&&(p=0,c.replaceState({...c.state,idx:p},""));function _(){return(c.state||{idx:null}).idx}function g(){d="POP";let E=_(),D=E==null?null:E-p;p=E,f&&f({action:d,location:x.location,delta:D})}function b(E,D){d="PUSH";let j=Qx(E)?E:jv(x.location,E,D);p=_()+1;let z=eC(j,p),T=x.createHref(j.mask||j);try{c.pushState(z,"",T)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;r.location.assign(T)}o&&f&&f({action:d,location:x.location,delta:1})}function S(E,D){d="REPLACE";let j=Qx(E)?E:jv(x.location,E,D);p=_();let z=eC(j,p),T=x.createHref(j.mask||j);c.replaceState(z,"",T),o&&f&&f({action:d,location:x.location,delta:0})}function w(E){return G6(r,E)}let x={get action(){return d},get location(){return e(r,c)},listen(E){if(f)throw new Error("A history only accepts one active listener");return r.addEventListener(Jx,g),f=E,()=>{r.removeEventListener(Jx,g),f=null}},createHref(E){return t(r,E)},createURL:w,encodeLocation(E){let D=w(E);return{pathname:D.pathname,search:D.search,hash:D.hash}},push:b,replace:S,go(E){return c.go(E)}};return x}function G6(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),vn(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:eh(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function a5(e,t,n="/"){return K6(e,t,n,!1)}function K6(e,t,n,i,r){let o=typeof t=="string"?ac(t):t,c=Xr(o.pathname||"/",n);if(c==null)return null;let d=V6(e),f=null,p=a4(c);for(let _=0;f==null&&_<d.length;++_)f=s4(d[_],p,i);return f}function V6(e){let t=o5(e);return Y6(t),t}function o5(e,t=[],n=[],i="",r=!1){let o=(c,d,f=r,p)=>{let _={relativePath:p===void 0?c.path||"":p,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(_.relativePath.startsWith("/")){if(!_.relativePath.startsWith(i)&&f)return;vn(_.relativePath.startsWith(i),`Absolute route path "${_.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),_.relativePath=_.relativePath.slice(i.length)}let g=Vs([i,_.relativePath]),b=n.concat(_);c.children&&c.children.length>0&&(vn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),o5(c.children,t,b,g,f)),!(c.path==null&&!c.index)&&t.push({path:g,score:n4(g,c.index),routesMeta:b})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))o(c,d);else for(let f of l5(c.path))o(c,d,!0,f)}),t}function l5(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,r=n.endsWith("?"),o=n.replace(/\?$/,"");if(i.length===0)return r?[o,""]:[o];let c=l5(i.join("/")),d=[];return d.push(...c.map(f=>f===""?o:[o,f].join("/"))),r&&d.push(...c),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function Y6(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:i4(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var X6=/^:[\w-]+$/,Z6=3,J6=2,Q6=1,e4=10,t4=-2,tC=e=>e==="*";function n4(e,t){let n=e.split("/"),i=n.length;return n.some(tC)&&(i+=t4),t&&(i+=J6),n.filter(r=>!tC(r)).reduce((r,o)=>r+(X6.test(o)?Z6:o===""?Q6:e4),i)}function i4(e,t){return e.length===t.length&&e.slice(0,-1).every((i,r)=>i===t[r])?e[e.length-1]-t[t.length-1]:0}function s4(e,t,n=!1){let{routesMeta:i}=e,r={},o="/",c=[];for(let d=0;d<i.length;++d){let f=i[d],p=d===i.length-1,_=o==="/"?t:t.slice(o.length)||"/",g=Uf({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},_),b=f.route;if(!g&&p&&n&&!i[i.length-1].route.index&&(g=Uf({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},_)),!g)return null;Object.assign(r,g.params),c.push({params:r,pathname:Vs([o,g.pathname]),pathnameBase:u4(Vs([o,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(o=Vs([o,g.pathnameBase]))}return c}function Uf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=r4(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],c=o.replace(/(.)\/+$/,"$1"),d=r.slice(1);return{params:i.reduce((p,{paramName:_,isOptional:g},b)=>{if(_==="*"){let w=d[b]||"";c=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=d[b];return g&&!S?p[_]=void 0:p[_]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:c,pattern:e}}function r4(e,t=!1,n=!0){Xs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,f,p,_)=>{if(i.push({paramName:d,isOptional:f!=null}),f){let g=_.charAt(p+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function a4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xs(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Xr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}var o4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function l4(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?ac(e):e,o;return n?(n=c5(n),n.startsWith("/")?o=nC(n.substring(1),"/"):o=nC(n,t)):o=t,{pathname:o,search:h4(i),hash:d4(r)}}function nC(e,t){let n=Wf(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function r_(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function c4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function zb(e){let t=c4(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Cp(e,t,n,i=!1){let r;typeof e=="string"?r=ac(e):(r={...e},vn(!r.pathname||!r.pathname.includes("?"),r_("?","pathname","search",r)),vn(!r.pathname||!r.pathname.includes("#"),r_("#","pathname","hash",r)),vn(!r.search||!r.search.includes("#"),r_("#","search","hash",r)));let o=e===""||r.pathname==="",c=o?"/":r.pathname,d;if(c==null)d=n;else{let g=t.length-1;if(!i&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;r.pathname=b.join("/")}d=g>=0?t[g]:"/"}let f=l4(r,d),p=c&&c!=="/"&&c.endsWith("/"),_=(o||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||_)&&(f.pathname+="/"),f}var c5=e=>e.replace(/\/\/+/g,"/"),Vs=e=>c5(e.join("/")),Wf=e=>e.replace(/\/+$/,""),u4=e=>Wf(e).replace(/^\/*/,"/"),h4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,d4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,f4=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function p4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function m4(e){let t=e.map(n=>n.route.path).filter(Boolean);return Vs(t)||"/"}var u5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function h5(e,t){let n=e;if(typeof n!="string"||!o4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(u5)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Xr(c.pathname,t);c.origin===o.origin&&d!=null?n=d+c.search+c.hash:r=!0}catch{Xs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var d5=["POST","PUT","PATCH","DELETE"];new Set(d5);var g4=["GET",...d5];new Set(g4);var oc=y.createContext(null);oc.displayName="DataRouter";var kp=y.createContext(null);kp.displayName="DataRouterState";var f5=y.createContext(!1);function _4(){return y.useContext(f5)}var p5=y.createContext({isTransitioning:!1});p5.displayName="ViewTransition";var v4=y.createContext(new Map);v4.displayName="Fetchers";var y4=y.createContext(null);y4.displayName="Await";var vs=y.createContext(null);vs.displayName="Navigation";var yh=y.createContext(null);yh.displayName="Location";var yr=y.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var Hb=y.createContext(null);Hb.displayName="RouteError";var m5="REACT_ROUTER_ERROR",b4="REDIRECT",S4="ROUTE_ERROR_RESPONSE";function w4(e){if(e.startsWith(`${m5}:${b4}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function x4(e){if(e.startsWith(`${m5}:${S4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new f4(t.status,t.statusText,t.data)}catch{}}function C4(e,{relative:t}={}){vn(lc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=y.useContext(vs),{hash:r,pathname:o,search:c}=bh(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Vs([n,o])),i.createHref({pathname:d,search:c,hash:r})}function lc(){return y.useContext(yh)!=null}function zs(){return vn(lc(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(yh).location}var g5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _5(e){y.useContext(vs).static||y.useLayoutEffect(e)}function cc(){let{isDataRoute:e}=y.useContext(yr);return e?B4():k4()}function k4(){vn(lc(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(oc),{basename:t,navigator:n}=y.useContext(vs),{matches:i}=y.useContext(yr),{pathname:r}=zs(),o=JSON.stringify(zb(i)),c=y.useRef(!1);return _5(()=>{c.current=!0}),y.useCallback((f,p={})=>{if(Xs(c.current,g5),!c.current)return;if(typeof f=="number"){n.go(f);return}let _=Cp(f,JSON.parse(o),r,p.relative==="path");e==null&&t!=="/"&&(_.pathname=_.pathname==="/"?t:Vs([t,_.pathname])),(p.replace?n.replace:n.push)(_,p.state,p)},[t,n,o,r,e])}y.createContext(null);function bh(e,{relative:t}={}){let{matches:n}=y.useContext(yr),{pathname:i}=zs(),r=JSON.stringify(zb(n));return y.useMemo(()=>Cp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function E4(e,t){return v5(e,t)}function v5(e,t,n){vn(lc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(vs),{matches:r}=y.useContext(yr),o=r[r.length-1],c=o?o.params:{},d=o?o.pathname:"/",f=o?o.pathnameBase:"/",p=o&&o.route;{let E=p&&p.path||"";b5(d,!p||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
-
|
|
11
|
-
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let _=zs(),g;if(t){let E=typeof t=="string"?ac(t):t;vn(f==="/"||E.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${E.pathname}" was given in the \`location\` prop.`),g=E}else g=_;let b=g.pathname||"/",S=b;if(f!=="/"){let E=f.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(E=>Object.assign(E,{route:n.manifest[E.route.id]||E.route})):a5(e,{pathname:S});Xs(p||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Xs(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=L4(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:Vs([f,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?f:Vs([f,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),r,n);return t&&x?y.createElement(yh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},x):x}function T4(){let e=I4(),t=p4(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:o},"ErrorBoundary")," or"," ",y.createElement("code",{style:o},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),n?y.createElement("pre",{style:r},n):null,c)}var A4=y.createElement(T4,null),y5=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=x4(e.digest);n&&(e=n)}let t=e!==void 0?y.createElement(yr.Provider,{value:this.props.routeContext},y.createElement(Hb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(R4,{error:e},t):t}};y5.contextType=f5;var a_=new WeakMap;function R4({children:e,error:t}){let{basename:n}=y.useContext(vs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=w4(t.digest);if(i){let r=a_.get(t);if(r)throw r;let o=h5(i.location,n);if(u5&&!a_.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw a_.set(t,c),c}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function N4({routeContext:e,match:t,children:n}){let i=y.useContext(oc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(yr.Provider,{value:e},n)}function L4(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,o=i?.errors;if(o!=null){let _=r.findIndex(g=>g.route.id&&o?.[g.route.id]!==void 0);vn(_>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,_+1))}let c=!1,d=-1;if(n&&i){c=i.renderFallback;for(let _=0;_<r.length;_++){let g=r[_];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=_),g.route.id){let{loaderData:b,errors:S}=i,w=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!S||S[g.route.id]===void 0);if(g.route.lazy||w){n.isStatic&&(c=!0),d>=0?r=r.slice(0,d+1):r=[r[0]];break}}}}let f=n?.onError,p=i&&f?(_,g)=>{f(_,{location:i.location,params:i.matches?.[0]?.params??{},pattern:m4(i.matches),errorInfo:g})}:void 0;return r.reduceRight((_,g,b)=>{let S,w=!1,x=null,E=null;i&&(S=o&&g.route.id?o[g.route.id]:void 0,x=g.route.errorElement||A4,c&&(d<0&&b===0?(b5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===b&&(w=!0,E=g.route.hydrateFallbackElement||null)));let D=t.concat(r.slice(0,b+1)),j=()=>{let z;return S?z=x:w?z=E:g.route.Component?z=y.createElement(g.route.Component,null):g.route.element?z=g.route.element:z=_,y.createElement(N4,{match:g,routeContext:{outlet:_,matches:D,isDataRoute:i!=null},children:z})};return i&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?y.createElement(y5,{location:i.location,revalidation:i.revalidation,component:x,error:S,children:j(),routeContext:{outlet:null,matches:D,isDataRoute:!0},onError:p}):j()},null)}function Fb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function M4(e){let t=y.useContext(oc);return vn(t,Fb(e)),t}function O4(e){let t=y.useContext(kp);return vn(t,Fb(e)),t}function D4(e){let t=y.useContext(yr);return vn(t,Fb(e)),t}function Ub(e){let t=D4(e),n=t.matches[t.matches.length-1];return vn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function j4(){return Ub("useRouteId")}function I4(){let e=y.useContext(Hb),t=O4("useRouteError"),n=Ub("useRouteError");return e!==void 0?e:t.errors?.[n]}function B4(){let{router:e}=M4("useNavigate"),t=Ub("useNavigate"),n=y.useRef(!1);return _5(()=>{n.current=!0}),y.useCallback(async(r,o={})=>{Xs(n.current,g5),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var iC={};function b5(e,t,n){!t&&!iC[e]&&(iC[e]=!0,Xs(!1,n))}y.memo($4);function $4({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return v5(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function o_({to:e,replace:t,state:n,relative:i}){vn(lc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=y.useContext(vs);Xs(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=y.useContext(yr),{pathname:c}=zs(),d=cc(),f=Cp(e,zb(o),c,i==="path"),p=JSON.stringify(f);return y.useEffect(()=>{d(JSON.parse(p),{replace:t,state:n,relative:i})},[d,p,i,t,n]),null}function Ml(e){vn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function P4({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:c}){vn(!lc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=y.useMemo(()=>({basename:d,navigator:r,static:o,useTransitions:c,future:{}}),[d,r,o,c]);typeof n=="string"&&(n=ac(n));let{pathname:p="/",search:_="",hash:g="",state:b=null,key:S="default",mask:w}=n,x=y.useMemo(()=>{let E=Xr(p,d);return E==null?null:{location:{pathname:E,search:_,hash:g,state:b,key:S,mask:w},navigationType:i}},[d,p,_,g,b,S,i,w]);return Xs(x!=null,`<Router basename="${d}"> is not able to match the URL "${p}${_}${g}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:y.createElement(vs.Provider,{value:f},y.createElement(yh.Provider,{children:t,value:x}))}function z4({children:e,location:t}){return E4(Iv(e),t)}function Iv(e,t=[]){let n=[];return y.Children.forEach(e,(i,r)=>{if(!y.isValidElement(i))return;let o=[...t,r];if(i.type===y.Fragment){n.push.apply(n,Iv(i.props.children,o));return}vn(i.type===Ml,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),vn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let c={id:i.props.id||o.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(c.children=Iv(i.props.children,o)),n.push(c)}),n}var vf="get",yf="application/x-www-form-urlencoded";function Ep(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function H4(e){return Ep(e)&&e.tagName.toLowerCase()==="button"}function F4(e){return Ep(e)&&e.tagName.toLowerCase()==="form"}function U4(e){return Ep(e)&&e.tagName.toLowerCase()==="input"}function W4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function q4(e,t){return e.button===0&&(!t||t==="_self")&&!W4(e)}var Pd=null;function G4(){if(Pd===null)try{new FormData(document.createElement("form"),0),Pd=!1}catch{Pd=!0}return Pd}var K4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function l_(e){return e!=null&&!K4.has(e)?(Xs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yf}"`),null):e}function V4(e,t){let n,i,r,o,c;if(F4(e)){let d=e.getAttribute("action");i=d?Xr(d,t):null,n=e.getAttribute("method")||vf,r=l_(e.getAttribute("enctype"))||yf,o=new FormData(e)}else if(H4(e)||U4(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(i=f?Xr(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||vf,r=l_(e.getAttribute("formenctype"))||l_(d.getAttribute("enctype"))||yf,o=new FormData(d,e),!G4()){let{name:p,type:_,value:g}=e;if(_==="image"){let b=p?`${p}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else p&&o.append(p,g)}}else{if(Ep(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=vf,i=null,r=yf,c=e}return o&&r==="text/plain"&&(c=o,o=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Wb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function S5(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&Xr(r.pathname,t)==="/"?r.pathname=`${Wf(t)}/_root.${i}`:r.pathname=`${Wf(r.pathname)}.${i}`,r}async function Y4(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function X4(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Z4(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let c=await Y4(o,n);return c.links?c.links():[]}return[]}));return tO(i.flat(1).filter(X4).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function sC(e,t,n,i,r,o){let c=(f,p)=>n[p]?f.route.id!==n[p].route.id:!0,d=(f,p)=>n[p].pathname!==f.pathname||n[p].route.path?.endsWith("*")&&n[p].params["*"]!==f.params["*"];return o==="assets"?t.filter((f,p)=>c(f,p)||d(f,p)):o==="data"?t.filter((f,p)=>{let _=i.routes[f.route.id];if(!_||!_.hasLoader)return!1;if(c(f,p)||d(f,p))return!0;if(f.route.shouldRevalidate){let g=f.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function J4(e,t,{includeHydrateFallback:n}={}){return Q4(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function Q4(e){return[...new Set(e)]}function eO(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function tO(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(eO(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function qb(){let e=y.useContext(oc);return Wb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function nO(){let e=y.useContext(kp);return Wb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Gb=y.createContext(void 0);Gb.displayName="FrameworkContext";function Kb(){let e=y.useContext(Gb);return Wb(e,"You must render this element inside a <HydratedRouter> element"),e}function iO(e,t){let n=y.useContext(Gb),[i,r]=y.useState(!1),[o,c]=y.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:p,onMouseLeave:_,onTouchStart:g}=t,b=y.useRef(null);y.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=D=>{D.forEach(j=>{c(j.isIntersecting)})},E=new IntersectionObserver(x,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[e]),y.useEffect(()=>{if(i){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[i]);let S=()=>{r(!0)},w=()=>{r(!1),c(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:lu(d,S),onBlur:lu(f,w),onMouseEnter:lu(p,S),onMouseLeave:lu(_,w),onTouchStart:lu(g,S)}]:[!1,b,{}]}function lu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function sO({page:e,...t}){let n=_4(),{router:i}=qb(),r=y.useMemo(()=>a5(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?y.createElement(aO,{page:e,matches:r,...t}):y.createElement(oO,{page:e,matches:r,...t}):null}function rO(e){let{manifest:t,routeModules:n}=Kb(),[i,r]=y.useState([]);return y.useEffect(()=>{let o=!1;return Z4(e,t,n).then(c=>{o||r(c)}),()=>{o=!0}},[e,t,n]),i}function aO({page:e,matches:t,...n}){let i=zs(),{future:r}=Kb(),{basename:o}=qb(),c=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=S5(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,p=[];for(let _ of t)typeof _.route.shouldRevalidate=="function"?f=!0:p.push(_.route.id);return f&&p.length>0&&d.searchParams.set("_routes",p.join(",")),[d.pathname+d.search]},[o,r.v8_trailingSlashAwareDataRequests,e,i,t]);return y.createElement(y.Fragment,null,c.map(d=>y.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function oO({page:e,matches:t,...n}){let i=zs(),{future:r,manifest:o,routeModules:c}=Kb(),{basename:d}=qb(),{loaderData:f,matches:p}=nO(),_=y.useMemo(()=>sC(e,t,p,o,i,"data"),[e,t,p,o,i]),g=y.useMemo(()=>sC(e,t,p,o,i,"assets"),[e,t,p,o,i]),b=y.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,E=!1;if(t.forEach(j=>{let z=o.routes[j.route.id];!z||!z.hasLoader||(!_.some(T=>T.route.id===j.route.id)&&j.route.id in f&&c[j.route.id]?.shouldRevalidate||z.hasClientLoader?E=!0:x.add(j.route.id))}),x.size===0)return[];let D=S5(e,d,r.v8_trailingSlashAwareDataRequests,"data");return E&&x.size>0&&D.searchParams.set("_routes",t.filter(j=>x.has(j.route.id)).map(j=>j.route.id).join(",")),[D.pathname+D.search]},[d,r.v8_trailingSlashAwareDataRequests,f,i,o,_,t,e,c]),S=y.useMemo(()=>J4(g,o),[g,o]),w=rO(g);return y.createElement(y.Fragment,null,b.map(x=>y.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),S.map(x=>y.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),w.map(({key:x,link:E})=>y.createElement("link",{key:x,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function lO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var cO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{cO&&(window.__reactRouterVersion="7.17.0")}catch{}function uO({basename:e,children:t,useTransitions:n,window:i}){let r=y.useRef();r.current==null&&(r.current=U6({window:i,v5Compat:!0}));let o=r.current,[c,d]=y.useState({action:o.action,location:o.location}),f=y.useCallback(p=>{n===!1?d(p):y.startTransition(()=>d(p))},[n]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.createElement(P4,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:n})}var w5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,th=y.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:c,mask:d,state:f,target:p,to:_,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:S,...w},x){let{basename:E,navigator:D,useTransitions:j}=y.useContext(vs),z=typeof _=="string"&&w5.test(_),T=h5(_,E);_=T.to;let N=C4(_,{relative:r}),L=zs(),H=null;if(d){let M=Cp(d,[],L.mask?L.mask.pathname:"/",!0);E!=="/"&&(M.pathname=M.pathname==="/"?E:Vs([E,M.pathname])),H=D.createHref(M)}let[F,J,pe]=iO(i,w),G=pO(_,{replace:c,mask:d,state:f,target:p,preventScrollReset:g,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:j});function P(M){t&&t(M),M.defaultPrevented||G(M)}let A=!(T.isExternal||o),$=y.createElement("a",{...w,...pe,href:(A?H:void 0)||T.absoluteURL||N,onClick:A?P:t,ref:lO(x,J),target:p,"data-discover":!z&&n==="render"?"true":void 0});return F&&!z?y.createElement(y.Fragment,null,$,y.createElement(sO,{page:N})):$});th.displayName="Link";var hO=y.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:c,viewTransition:d,children:f,...p},_){let g=bh(c,{relative:p.relative}),b=zs(),S=y.useContext(kp),{navigator:w,basename:x}=y.useContext(vs),E=S!=null&&yO(g)&&d===!0,D=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,j=b.pathname,z=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(j=j.toLowerCase(),z=z?z.toLowerCase():null,D=D.toLowerCase()),z&&x&&(z=Xr(z,x)||z);const T=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let N=j===D||!r&&j.startsWith(D)&&j.charAt(T)==="/",L=z!=null&&(z===D||!r&&z.startsWith(D)&&z.charAt(D.length)==="/"),H={isActive:N,isPending:L,isTransitioning:E},F=N?t:void 0,J;typeof i=="function"?J=i(H):J=[i,N?"active":null,L?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let pe=typeof o=="function"?o(H):o;return y.createElement(th,{...p,"aria-current":F,className:J,ref:_,style:pe,to:c,viewTransition:d},typeof f=="function"?f(H):f)});hO.displayName="NavLink";var dO=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:c=vf,action:d,onSubmit:f,relative:p,preventScrollReset:_,viewTransition:g,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:x}=y.useContext(vs),E=_O(),D=vO(d,{relative:p}),j=c.toLowerCase()==="get"?"get":"post",z=typeof d=="string"&&w5.test(d),T=N=>{if(f&&f(N),N.defaultPrevented)return;N.preventDefault();let L=N.nativeEvent.submitter,H=L?.getAttribute("formmethod")||c,F=()=>E(L||N.currentTarget,{fetcherKey:t,method:H,navigate:n,replace:r,state:o,relative:p,preventScrollReset:_,viewTransition:g,defaultShouldRevalidate:b});x&&n!==!1?y.startTransition(()=>F()):F()};return y.createElement("form",{ref:w,method:j,action:D,onSubmit:i?f:T,...S,"data-discover":!z&&e==="render"?"true":void 0})});dO.displayName="Form";function fO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function x5(e){let t=y.useContext(oc);return vn(t,fO(e)),t}function pO(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:f,useTransitions:p}={}){let _=cc(),g=zs(),b=bh(e,{relative:c});return y.useCallback(S=>{if(q4(S,t)){S.preventDefault();let w=n!==void 0?n:eh(g)===eh(b),x=()=>_(e,{replace:w,mask:i,state:r,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:f});p?y.startTransition(()=>x()):x()}},[g,_,b,n,i,r,t,e,o,c,d,f,p])}var mO=0,gO=()=>`__${String(++mO)}__`;function _O(){let{router:e}=x5("useSubmit"),{basename:t}=y.useContext(vs),n=j4(),i=e.fetch,r=e.navigate;return y.useCallback(async(o,c={})=>{let{action:d,method:f,encType:p,formData:_,body:g}=V4(o,t);if(c.navigate===!1){let b=c.fetcherKey||gO();await i(b,n,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:_,body:g,formMethod:c.method||f,formEncType:c.encType||p,flushSync:c.flushSync})}else await r(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:_,body:g,formMethod:c.method||f,formEncType:c.encType||p,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[i,r,t,n])}function vO(e,{relative:t}={}){let{basename:n}=y.useContext(vs),i=y.useContext(yr);vn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...bh(e||".",{relative:t})},c=zs();if(e==null){o.search=c.search;let d=new URLSearchParams(o.search),f=d.getAll("index");if(f.some(_=>_==="")){d.delete("index"),f.filter(g=>g).forEach(g=>d.append("index",g));let _=d.toString();o.search=_?`?${_}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Vs([n,o.pathname])),eh(o)}function yO(e,{relative:t}={}){let n=y.useContext(p5);vn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=x5("useViewTransitionState"),r=bh(e,{relative:t});if(!n.isTransitioning)return!1;let o=Xr(n.currentLocation.pathname,i)||n.currentLocation.pathname,c=Xr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Uf(r.pathname,c)!=null||Uf(r.pathname,o)!=null}var Va=r5();const bO=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let an=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function rC(e){return(await C5(e)).theaters}async function C5(e){const t=await fetch("/api/v1/theaters",{signal:e});await di(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new an(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>Yb(i,t.status))}}async function SO(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await di(i),MO(await i.json(),i.status)}async function wO(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await di(t),OO(await t.json(),t.status)}async function xO(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const n=t.size>0?`?${t}`:"",i=await fetch(`/api/v1/updates/release-notes${n}`,{signal:e.signal});return await di(i),jO(await i.json(),i.status)}async function CO(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await di(t),DO(await t.json(),t.status)}async function k5(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await di(n);const i=await n.json();return Yb(i,n.status)}async function kO(e,t,n){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:t}),signal:n});return await di(i),Yb(await i.json(),i.status)}async function EO(e,t){const n=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await di(n),zO(await n.json(),n.status)}async function E5(e,t){const n=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await di(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new an(n.status,"Invalid folder grant response");return i.folderGrantId}async function TO(e,t){const n=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e}),signal:t});return await di(n),await n.json()}async function AO(e,t,n){const i=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,name:t}),signal:n});return await di(i),await i.json()}async function RO(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await di(n)}async function Qi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await di(i);const r=await i.json();if(!Array.isArray(r.operations))throw new an(i.status,"Invalid operations response");return r.operations.map(o=>A5(o,i.status))}async function So(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await di(i);const r=await i.json();if(!Array.isArray(r.groups))throw new an(i.status,"Invalid groups response");return r.groups.map(o=>Vb(o,i.status))}async function NO(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await di(n);const i=await n.json();return Vb(i.group,n.status)}async function c_(e,t,n){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await di(i);const r=await i.json();return Vb(r.group,i.status)}async function LO(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await di(n)}async function T5(e,t,n){return bf(e,{title:t},n)}async function bf(e,t,n){const i=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await di(i);const r=await i.json();return A5(r.operation,i.status)}function A5(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||nh(n)||nh(n.payload))throw new an(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,accent:typeof n.accent=="string"?n.accent:null,groupId:n.groupId===null?null:typeof n.groupId=="string"?n.groupId:void 0,ts:n.ts}}function Vb(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.name!="string"||typeof n.color!="string"||typeof n.order!="number"||typeof n.createdAt!="number")throw new an(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function Yb(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string"||typeof n.createdAt!="string"||typeof n.lastOpenedAt!="string"||typeof n.hasWiki!="boolean"||typeof n.activeAdmiralCount!="number"||nh(n))throw new an(t,"Invalid Theater response");return{id:n.id,label:n.label,createdAt:n.createdAt,lastOpenedAt:n.lastOpenedAt,...typeof n.order=="number"&&Number.isInteger(n.order)&&n.order>=0?{order:n.order}:{},hasWiki:n.hasWiki,activeAdmiralCount:n.activeAdmiralCount}}function MO(e,t){const n=e;if(!n||typeof n.workspaces!="number"||typeof n.version!="string"||n.channel!=="stable"&&n.channel!=="local"&&n.channel!=="unknown"||typeof n.updateAvailable!="boolean"||typeof n.port!="number"||n.portMode!=="dynamic"&&n.portMode!=="static"||n.requestedPort!==null&&typeof n.requestedPort!="number"||typeof n.effectivePort!="number"||typeof n.portHonored!="boolean"||n.wikiServerStatus!=="available"&&n.wikiServerStatus!=="unavailable"&&n.wikiServerStatus!=="unknown")throw new an(t,"Invalid status response");return{workspaces:n.workspaces,version:n.version,channel:n.channel,updateAvailable:n.updateAvailable,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:void 0,port:n.port,portMode:n.portMode,requestedPort:n.requestedPort,effectivePort:n.effectivePort,portHonored:n.portHonored,wikiServerStatus:n.wikiServerStatus}}function OO(e,t){const n=e;if(!n||n.channel!=="local"||typeof n.version!="string"||typeof n.effectivePort!="number"||typeof n.dataDir!="string"||typeof n.lockFile!="string"||Object.keys(n).length!==5)throw new an(t,"Invalid environment response");return n}function DO(e,t){const n=e;if(!n||n.status!=="accepted")throw new an(t,"Invalid update response");return{status:"accepted"}}function jO(e,t){const n=e;if(!n||!Array.isArray(n.notes)||n.sourceRef!=="main"||typeof n.fetchedAt!="number"||typeof n.stale!="boolean"||"url"in n||"token"in n||"path"in n)throw new an(t,"Invalid release notes response");return{notes:n.notes.map(i=>IO(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function IO(e,t){const n=e;if(!n||typeof n.version!="string"||n.date!==null&&typeof n.date!="string"||!Array.isArray(n.sections)||typeof n.localizationFallback!="boolean")throw new an(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>BO(i,t)),localizationFallback:n.localizationFallback}}function BO(e,t){const n=e;if(!n||n.heading!=="Added"&&n.heading!=="Changed"&&n.heading!=="Fixed"&&n.heading!=="Removed"&&n.heading!=="Breaking Changes"||!Array.isArray(n.items))throw new an(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>$O(i,t))}}function $O(e,t){const n=e;if(!n||!Array.isArray(n.packageTags)||!n.packageTags.every(i=>typeof i=="string")||typeof n.text!="string"||"product"in n&&!PO(n.product))throw new an(t,"Invalid release notes response");return"product"in n?{packageTags:n.packageTags,text:n.text,product:n.product}:{packageTags:n.packageTags,text:n.text}}function PO(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function zO(e,t){const n=e;if(!n||typeof n.path!="string"||n.parentPath!==null&&typeof n.parentPath!="string"||!Array.isArray(n.roots)||!Array.isArray(n.entries)||nh(n))throw new an(t,"Invalid folder list response");return{path:n.path,parentPath:n.parentPath??null,roots:n.roots.filter(i=>typeof i=="string"),entries:n.entries.map(i=>HO(i,t)),truncated:n.truncated===!0?!0:void 0}}function HO(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||nh(n))throw new an(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function nh(e){if(!e||typeof e!="object")return!1;const t=e;return bO.some(n=>n in t)}async function di(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const n=await e.json();typeof n.error=="string"?t=n.error:typeof n.message=="string"&&(t=n.message)}catch{}throw new an(e.status,t)}function aC(e,t){return e!==null&&e===t?e:null}const FO="__unassigned__";function UO(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(GO(i,t.get(i.theaterId)));return n}function WO(e,t){const n=R5(t);return n.length===0?e:e.filter(i=>{const r=KO(i);return n.every(o=>r.includes(o))})}function qO(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??FO,o=n.get(r);if(o!==void 0){const c=t[o];c&&(t[o]={...c,entries:[...c.entries,i]});continue}n.set(r,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function R5(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function GO(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function KO(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const VO=200,YO=.5,XO="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",ZO=["monospace","serif","sans-serif"],Ou=new Map;function JO(e,t={}){const n=Tp(e);if(!n)return!1;const i=n.toLocaleLowerCase(),r=Ou.get(i);if(r!==void 0)return r;const o=t.document??globalThis.document;if(!o)return!1;const c=o.createElement("canvas").getContext("2d");if(!c)return!1;const d=ZO.some(f=>{const p=oC(c,`${N5(n)}, ${f}`),_=oC(c,f);return Math.abs(p-_)>YO});return QO(i,d,t.maxEntries??VO),d}function N5(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function qf(e,t){const n=Tp(e);return n?`${N5(n)}, ${t}`:t}function Tp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function oC(e,t){return e.font=`28px ${t}`,e.measureText(XO).width}function QO(e,t,n){if(Ou.size>=Math.max(1,n)){const i=Ou.keys().next().value;i&&Ou.delete(i)}Ou.set(e,t)}const ql={min:12,max:18,step:1,defaultValue:14},Ku={source:"builtin",id:"manrope",size:ql.defaultValue},Gf=[{id:"manrope",label:"Fleet UI",name:"Manrope",description:"Balanced · Fleet default",family:'"Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["Manrope","Fleet UI"]},{id:"jetbrains-mono",label:"Instrument Mono",name:"JetBrains Mono",description:"Uniform · technical scan",family:'"JetBrains Mono Variable", "Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["JetBrains Mono","Instrument Mono"]},{id:"source-code-pro",label:"Source Mono",name:"Source Code Pro",description:"Open forms · compact",family:'"Source Code Pro Variable", "Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["Source Code Pro","Source Mono"]}];function eD(e){if(!e||typeof e!="object")return Ku;const t=e,n=tD(t.size);if(t.source==="builtin"&&iD(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=Tp(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return Ku}function tD(e){return typeof e!="number"||!Number.isInteger(e)||e<ql.min||e>ql.max?ql.defaultValue:e}function L5(e){return e.source==="system"?qf(e.familyName,Gf[0].family):nD(e.id).family}function nD(e){return Gf.find(t=>t.id===e)??Gf[0]}function iD(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const Bv="fleet-console.activeTheaterId",M5="fleet-console.commissioningSeen",O5="fleet-console.whatsNewSeenVersion",D5="fleet-console.notificationPreferences",j5=1,sD="instrument",zd={globalMute:!1,dnd:!1,mutedTheaterIds:{}},$v=new Set;let lC=0,Pv=null,Ze={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:sD,version:"",updateAvailable:!1,latestVersion:null,portMode:"dynamic",requestedPort:null,effectivePort:0,portHonored:!0,theaters:[],operations:[],operationsHydrated:!1,groups:[],activeTheaterId:null,activeOperationId:null,operationStatus:{},addingTheater:!1,theaterError:null,operationsViewActive:!1,operationSearchOpen:!1,whatsNewOpen:!1,releaseNotes:[],releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:null,releaseNotesFetchedAt:null,releaseNotesStale:!1,automaticWhatsNewVersion:null,selectedReleaseNoteKey:null,onboardingOpen:!1,bootstrapped:!1,pendingOperationFocus:null,keyboardFocusRequest:null,operationNotifications:{},notificationPreferences:DD(),codexReader:null,codexReaderExpanded:!1};function Bo(){return Ze}function I5(e){return $v.add(e),()=>{$v.delete(e)}}function _t(e){Ze={...Ze,...e},ND()}function rD(e){Ze.operationsViewActive!==e&&_t({operationsViewActive:e})}function Kf(e){uD(e),_t({activeTheme:e})}function zv(e){dD(e)}function aD(e){_t({channel:e.channel,version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...W5({...Ze,version:e.version})})}function oD(){_t({releaseNotesLoading:!0,releaseNotesError:null})}function lD(e){const t={...Ze,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Ze.selectedReleaseNoteKey&&G5(e.notes,Ze.selectedReleaseNoteKey)?Ze.selectedReleaseNoteKey:q5(e.notes)};_t({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...W5(t)})}function cD(e){_t({releaseNotesLoading:!1,releaseNotesError:e})}function uD(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function hD(){if(!(typeof document>"u"||typeof navigator>"u")&&navigator.userAgent.includes("Electron")){document.documentElement.setAttribute("data-desktop-shell","true");const e=navigator.userAgent.includes("Windows")?"win32":navigator.userAgent.includes("Mac OS X")?"darwin":"linux";document.documentElement.setAttribute("data-desktop-platform",e)}}function dD(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",L5(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function Hv(e){const t=U5(e,Ze.activeTheaterId);_t({theaters:e,activeTheaterId:t})}function fD(e){Hv(e.theaters)}function ms(e){_t({operations:e,operationsHydrated:!0})}function pD(e){const t=new Set(e.map(i=>i.id)),n=Ze.operations.filter(i=>!t.has(i.id));_t({operations:[...e,...n],operationsHydrated:!0})}function mD(e){const t=Ze.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Ze.operations];n[t]=e,_t({operations:n})}function wo(e){_t({groups:e})}function gD(e){Ap(e),_t({activeTheaterId:e})}function Bi(e){Ze.activeOperationId!==e&&_t({activeOperationId:e})}function _D(e,t){if(t==="idle"){B5(e);return}Ze.operationStatus[e]!==t&&_t({operationStatus:{...Ze.operationStatus,[e]:t}})}function B5(e){if(!(e in Ze.operationStatus))return;const t={...Ze.operationStatus};delete t[e],_t({operationStatus:t})}function vD(e){if(!e.operationId)return;const t=Ze.operations.find(c=>c.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Ze.theaters.find(c=>c.id===n)?.label??n??"Unknown",r=t.title,o=MD(e.kind);lC+=1,_t({operationNotifications:{...Ze.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:lC}}})}function $5(){_t({addingTheater:!0,theaterError:null})}function P5(e){const t=[e,...Ze.theaters.filter(n=>n.id!==e.id)];Ap(e.id),_t({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function yD(){_t({addingTheater:!1,theaterError:null})}function Fv(e){_t({addingTheater:!1,theaterError:e})}function ih(e){const t=Ze.operations.find(n=>n.id===e);t&&(Ap(t.theaterId),_t({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:F5(Ze.operationNotifications,e)}))}function bD(){Ze.pendingOperationFocus!==null&&_t({pendingOperationFocus:null})}function go(e){_t({keyboardFocusRequest:{operationId:e,requestId:(Ze.keyboardFocusRequest?.requestId??0)+1}})}function SD(e,t,n){if(e.length===0)return null;const i=t?e.indexOf(t):-1,r=i===-1?n>0?0:e.length-1:(i+n+e.length)%e.length;return e[r]??null}function Xb(e,t){if(t.length===0)return[...e].sort(Uv);const n=new Map(t.map((i,r)=>[i,r]));return[...e].sort((i,r)=>{const o=n.get(i.id),c=n.get(r.id);return o!==void 0&&c!==void 0?o-c:o!==void 0?-1:c!==void 0?1:Uv(i,r)})}function z5(e,t,n,i=[]){const r=Xb(e,n),o=new Set(i),c=[...t].sort((f,p)=>f.order-p.order||f.createdAt-p.createdAt),d=new Map;for(const f of c)d.set(f.id,[]);d.set(null,[]);for(const f of r){const p=f.groupId??null;p!==null&&d.has(p)?d.get(p).push(f):d.get(null).push(f)}return[...c.filter(f=>!o.has(f.id)).flatMap(f=>d.get(f.id)??[]),...d.get(null)??[]]}function wD(e,t,n,i,r){const o=new Set(r),c=z5(e,t,n,i),d=c.filter(f=>!o.has(f.id));return(d.length>0?d:c).map(f=>f.id)}function Uv(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function u_(){_t({operationSearchOpen:!1})}function H5(){_t({operationSearchOpen:!Ze.operationSearchOpen})}function xD(){Ze.releaseNotes.length===0||Ze.whatsNewOpen||_t({whatsNewOpen:!0,selectedReleaseNoteKey:Ze.selectedReleaseNoteKey??q5(Ze.releaseNotes)})}function Hd(){Ze.whatsNewOpen&&(Ze.automaticWhatsNewVersion&&$D(Ze.automaticWhatsNewVersion),_t({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function cC(e){G5(Ze.releaseNotes,e)&&_t({selectedReleaseNoteKey:e})}function cu(){ID(!0),Ze.onboardingOpen&&_t({onboardingOpen:!1})}function hr(e){_t({codexReader:e,codexReaderExpanded:!1})}function Sf(){Ze.codexReader!==null&&_t({codexReaderExpanded:!0})}function CD(){_t({codexReaderExpanded:!1})}function h_(){_t({codexReader:null,codexReaderExpanded:!1})}function uC(){if(Ze.bootstrapped)return;const e=Ze.theaters.length===0&&!jD();_t({bootstrapped:!0,onboardingOpen:e?!0:Ze.onboardingOpen})}function hC(e){const t=Ze.theaters.filter(c=>c.id!==e),n=U5(t,Ze.activeTheaterId===e?null:Ze.activeTheaterId),i=LD(Ze.operationNotifications,e),r=new Set(Ze.operations.filter(c=>c.theaterId===e).map(c=>c.id)),o=Ze.activeOperationId&&r.has(Ze.activeOperationId)?null:Ze.activeOperationId;Ap(n),_t({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function kD(e){const t=F5(Ze.operationNotifications,e);t!==Ze.operationNotifications&&_t({operationNotifications:t})}function ED(e){const t={...Ze.notificationPreferences,globalMute:e};Jb(t),_t({notificationPreferences:t})}function TD(e){const t={...Ze.notificationPreferences,dnd:e};Jb(t),_t({notificationPreferences:t})}function AD(e){const t={...Ze.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Ze.notificationPreferences,mutedTheaterIds:t};Jb(n),_t({notificationPreferences:n})}function RD(e){return UO(e)}function ND(){for(const e of $v)e()}function F5(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function LD(e,t){let n=!1;const i={};for(const[r,o]of Object.entries(e)){if(o.theaterId===t){n=!0;continue}i[r]=o}return n?i:e}function U5(e,t){const n=new Set(e.map(r=>r.id)),i=OD();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function MD(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function W5(e){const t=e.releaseNotes.findIndex(i=>i.version!=="Unreleased"),n=t>=0?e.releaseNotes[t]:void 0;return!n||!e.version||n.version!==e.version||BD()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:Zb(n.version,t)}}function q5(e){return e[0]?Zb(e[0].version,0):null}function G5(e,t){return e.some((n,i)=>Zb(n.version,i)===t)}function Zb(e,t){return`${e}:${t}`}function OD(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Bv)}catch{return null}}function Ap(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Bv,e):window.localStorage.removeItem(Bv)}catch{}}function DD(){if(typeof window>"u")return zd;try{const e=window.localStorage.getItem(D5);if(!e)return zd;const t=JSON.parse(e);return PD(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:zd}catch{return zd}}function jD(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(M5)==="1"}catch{return!1}}function ID(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(M5,"1")}catch{}}function BD(){if(Pv!==null)return Pv;if(typeof window>"u")return null;try{return window.localStorage.getItem(O5)}catch{return null}}function $D(e){if(Pv=e,!(typeof window>"u"))try{window.localStorage.setItem(O5,e)}catch{}}function Jb(e){if(!(typeof window>"u"))try{window.localStorage.setItem(D5,JSON.stringify({version:j5,preferences:e}))}catch{}}function PD(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==j5||!t.preferences||typeof t.preferences!="object")return!1;const n=t.preferences;return typeof n.globalMute=="boolean"&&typeof n.dnd=="boolean"&&!!n.mutedTheaterIds&&typeof n.mutedTheaterIds=="object"}function er(){return y.useSyncExternalStore(I5,Bo,Bo)}const zD=[{title:"Console",entries:[{combos:[["Mod","K"]],description:"Search Operations across Theaters"},{combos:[["Mod","B"]],description:"Toggle the left sidebar"},{combos:[["Mod","Alt","B"]],description:"Toggle the right activity rail"},{combos:[["Esc"]],description:"Close the open overlay or menu"}]},{title:"Operations",entries:[{combos:[["Esc"]],description:"Close the carrier job stream"},{combos:[["Shift","Enter"]],description:"Insert a newline in the terminal instead of submitting"},{combos:[["Enter"],["Esc"]],description:"Confirm or cancel a session rename"},{combos:[["↑"],["↓"]],description:"Move between Theater, Theme, and launch menu items"}]},{title:"Map",entries:[{combos:[["Alt","←"],["Alt","→"]],description:"Focus the previous / next Operation"},{combos:[["Alt","F"]],description:"Toggle Formation view"},{combos:[["Drag"]],description:"Pan the operations map"},{combos:[["Shift","Drag"]],description:"Draw a new Operation terminal"},{combos:[["Space","Drag"]],description:"Pan even while a terminal has focus"},{combos:[["Scroll"]],description:"Zoom the map in or out"},{combos:[["Right-click"]],description:"Open the canvas actions menu"},{combos:[["Double-click"]],description:"Focus an Operation from its title bar; rename from its name"},{combos:[["Click"]],description:"Clear terminal focus on the empty canvas"}]},{title:"Codex",entries:[{combos:[["Mod","K"]],description:"Toggle the command palette"},{combos:[["↑"],["↓"]],description:"Move through command palette results"},{combos:[["Enter"]],description:"Open the selected result"},{combos:[["Tab"]],description:"Move focus within the command palette"},{combos:[["Esc"]],description:"Close the command palette or diagram lightbox"},{combos:[["+"],["−"],["0"]],description:"Zoom the diagram lightbox in / out / reset"},{combos:[["F"]],description:"Fit the diagram lightbox to the viewport"}]}],Du="data-keyboard-shortcuts-open",HD='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function K5(){return document.body.getAttribute(Du)==="true"}function FD(){return!K5()}function UD({onClose:e}){const t=y.useRef(null);y.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(Du);return document.body.setAttribute(Du,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute(Du):document.body.setAttribute(Du,o),r&&(r.inert=!1)}},[e]);const n=i=>{if(i.key==="Escape"){i.preventDefault(),e();return}if(i.key!=="Tab")return;const r=[...t.current?.querySelectorAll(HD)??[]];if(r.length===0){i.preventDefault(),t.current?.focus();return}const o=r[0],c=r[r.length-1],d=document.activeElement;(d===t.current||!t.current?.contains(d)||(i.shiftKey?d===o:d===c))&&(i.preventDefault(),(i.shiftKey?c:o)?.focus())};return Va.createPortal(u.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:u.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:n,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[u.jsx("strong",{children:"Keyboard Shortcuts"}),u.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),zD.map(i=>u.jsxs("section",{className:"keyboard-shortcuts-group",children:[u.jsx("h3",{children:i.title}),u.jsx("dl",{children:i.entries.map(r=>u.jsxs("div",{children:[u.jsx("dt",{children:r.combos.map((o,c)=>u.jsxs("span",{children:[c>0?" or ":null,o.map(d=>u.jsx("kbd",{children:d==="Mod"?"⌘/Ctrl":d},d))]},o.join("+")))}),u.jsx("dd",{children:r.description})]},`${i.title}:${r.description}`))})]},i.title))]})}),document.body)}const WD=1400,qD="https://github.com/sbluemin/fleet-harness",GD="https://github.com/sbluemin/fleet-harness/stargazers",KD="https://api.github.com/repos/sbluemin/fleet-harness",Qb="fleet-console.github-stars",VD=360*60*1e3,dC='[role="menuitem"]:not([disabled])';function YD(){const e=er();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(ZD,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(JD,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function XD({className:e="brand-foot-home"}){return u.jsxs(th,{className:e,to:"/operations","aria-label":"Operations",children:[u.jsx(cj,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function ZD({latestVersion:e,updateAvailable:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),d=cc();V5(n,i,r,o,c);const f=p=>{c(!1),d(p),window.requestAnimationFrame(()=>{const _=document.querySelector("main h2, h2");_?.focus?.(),_&&document.activeElement!==_&&(_.setAttribute("tabindex","-1"),_.focus())})};return u.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-system-menu",children:[u.jsxs("button",{ref:i,type:"button",className:"brand-foot-system-trigger",onClick:()=>c(p=>!p),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"System Menu",title:"System Menu",children:[u.jsx(fC,{}),u.jsx("span",{children:"System Menu"})]}),o?u.jsxs("div",{ref:r,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>f("/settings"),children:[u.jsx(fC,{}),u.jsx("span",{children:"Settings"})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(QD,{latestVersion:e})]}):null]}):null]})}function JD({releaseDisabled:e,version:t}){const n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),[o,c]=y.useState(!1),[d,f]=y.useState(!1);return V5(n,i,r,o,c),u.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-help-menu",children:[u.jsx("button",{ref:i,type:"button",className:"brand-foot-help-trigger",onClick:()=>c(p=>!p),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"Help",title:"Help",children:u.jsx(uj,{})}),o?u.jsxs("div",{ref:r,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[u.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{c(!1),xD()},children:[u.jsx(hj,{}),u.jsx("span",{children:"What's New"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{c(!1),f(!0)},children:[u.jsx(dj,{}),u.jsx("span",{children:"Keyboard Shortcuts"})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(ej,{menuItem:!0,version:t})]}):null,d?u.jsx(UD,{onClose:()=>{f(!1),i.current?.focus()}}):null]})}function V5(e,t,n,i,r){y.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(dC)?.focus()}),c=f=>{f.target instanceof Node&&e.current?.contains(f.target)||r(!1)},d=f=>{if(f.key==="Escape"){r(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(f.key))return;const p=[...n.current?.querySelectorAll(dC)??[]];if(p.length===0)return;f.preventDefault();const _=p.findIndex(b=>b===document.activeElement),g=f.key==="Home"||f.key==="ArrowDown"&&_===p.length-1?0:f.key==="End"||f.key==="ArrowUp"&&_<=0?p.length-1:f.key==="ArrowDown"?_+1:_-1;p[g]?.focus()};return window.addEventListener("pointerdown",c,!0),window.addEventListener("keydown",d,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerdown",c,!0),window.removeEventListener("keydown",d,!0)}},[n,i,e,r,t])}function QD({latestVersion:e}){const[t,n]=y.useState("idle"),[i,r]=y.useState(null),o=y.useRef(null),c=tj(t,i,e);y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const d=async()=>{if(!c.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),n("applying"),r(null);try{if((await CO()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},WD)}catch(f){const p=f instanceof an?f.message:"network_error";r(p),n(ij(p)?"blocked":"error")}}};return u.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${c.tone}`,onClick:d,disabled:c.disabled,title:c.title,"aria-live":"polite",children:c.label})}function ej({menuItem:e=!1,version:t}){const n=sj(),i=n.count!==null;return u.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[u.jsx("a",{className:"brand-foot-github-link",href:qD,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(fj,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:GD,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":i?`GitHub stars ${n.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[u.jsx(pj,{}),i?u.jsx("span",{className:"brand-foot-github-stars-count",children:lj(n.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function tj(e,t,n){const i=n?`Latest version ${n}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?nj(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:i,tone:"warn",disabled:!1}}function nj(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",tone:"blocked",disabled:!0}:e==="managed_runtime_update_requires_relaunch"?{label:"Update and Restart",title:"This managed Console installation updates through Fleet Console Desktop. Use Desktop Update and Restart.",tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:"Busy",title:"Another update is already in progress.",tone:"blocked",disabled:!0}:e==="update_not_available"?{label:"Current",title:"The server re-check found no update to apply.",tone:"blocked",disabled:!0}:{label:"Blocked",title:"The console is not ready to start an update. Try again shortly.",tone:"error",disabled:!1}}function ij(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function sj(){const[e,t]=y.useState(()=>{const n=rj();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return y.useEffect(()=>{if(aj())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(KD,{headers:{Accept:"application/vnd.github+json"}}).then(i=>i.ok?i.json():Promise.reject(new Error(`status ${i.status}`))).then(i=>{if(n)return;const r=typeof i.stargazers_count=="number"?i.stargazers_count:null;if(r===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}oj(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function rj(){try{const e=window.localStorage.getItem(Qb);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function aj(){try{const e=window.localStorage.getItem(Qb);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<VD}catch{return!1}}function oj(e){try{window.localStorage.setItem(Qb,JSON.stringify({count:e,at:Date.now()}))}catch{}}function lj(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function cj(){return u.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),u.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),u.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),u.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),u.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),u.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function fC(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function uj(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M6.2 6.2a1.8 1.8 0 1 1 2.6 1.7c-.5.3-.8.6-.8 1.1v.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function hj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function dj(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function fj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function pj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 2.2 9.41 6.26 13.71 6.35 10.28 8.94 11.53 13.05 8 10.6 4.47 13.05 5.72 8.94 2.29 6.35 6.59 6.26Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}const Vf="fleet-console.rail.activePanelId",Y5="fleet-console.rail.chromeExpanded",mj="fleet-console.repository.source",Wv=new Set;let Is={activeRailPanelId:Sj(),railChromeExpanded:wj(),panelExtraWidth:0};function e0(e){return Wv.add(e),()=>{Wv.delete(e)}}function t0(){return Is}function gj(e){const t=Is.activeRailPanelId===e?null:e;Rp({...Is,activeRailPanelId:t,panelExtraWidth:0}),Q5(t)}function _j(){Is.activeRailPanelId!==null&&(Rp({...Is,activeRailPanelId:null,panelExtraWidth:0}),Q5(null))}function vj(e){Is.railChromeExpanded!==e&&(Rp({...Is,railChromeExpanded:e}),xj(e))}function X5(){vj(!Is.railChromeExpanded)}function yj(e,t){if(e!==Is.activeRailPanelId)return;const n=t===null||!Number.isFinite(t)?0:t,i=Math.max(0,Math.round(n)),r=typeof window<"u"?Math.min(i,Math.max(0,window.innerWidth-548)):i;r!==Is.panelExtraWidth&&Rp({...Is,panelExtraWidth:r})}function Z5(){return y.useSyncExternalStore(e0,t0).activeRailPanelId}function J5(){return y.useSyncExternalStore(e0,t0).railChromeExpanded}function bj(){return y.useSyncExternalStore(e0,t0).panelExtraWidth}function Sj(){try{const e=localStorage.getItem(Vf);if(e==="diff"||e==="history"){try{localStorage.setItem(Vf,"repository"),e==="history"&&localStorage.setItem(mj,"history")}catch{}return"repository"}return e}catch{return null}}function wj(){try{return localStorage.getItem(Y5)!=="0"}catch{return!0}}function Q5(e){try{e===null?localStorage.removeItem(Vf):localStorage.setItem(Vf,e)}catch{}}function xj(e){try{localStorage.setItem(Y5,e?"1":"0")}catch{}}function Rp(e){Is=e;for(const t of Wv)t()}function eT(e){const{sizeRange:t}=e,[n,i]=y.useState(""),[r,o]=y.useState(e.size),c=y.useRef(Promise.resolve()),d=y.useId(),f=y.useMemo(()=>Cj(e),[e]),p=y.useMemo(()=>kj(f,n),[f,n]),_=y.useMemo(()=>p.map((L,H)=>({row:L,index:H})),[p]),[g,b]=y.useState(()=>Ej(f,e.selected)),S=f.find(L=>Yf(L.selection,e.selected))??null,w=_[Math.min(g,Math.max(0,_.length-1))]?.row??null,x=`${d}-built-ins`,E=`${d}-installed`;y.useEffect(()=>{o(e.size)},[e.size]),y.useEffect(()=>{g>=_.length&&b(Math.max(0,_.length-1))},[g,_.length]);const D=y.useCallback(L=>{const H=mC(L,t);o(H),c.current=c.current.catch(()=>{}).then(()=>e.onSizeCommit(H))},[e.onSizeCommit,t]),j=y.useCallback(L=>{p.length&&b(H=>(H+L+p.length)%p.length)},[p.length]),z=y.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),T=y.useCallback((L,H)=>{b(L),e.onSelectionChange(H)},[e]),N=L=>{L.key==="ArrowDown"?(L.preventDefault(),j(1)):L.key==="ArrowUp"?(L.preventDefault(),j(-1)):L.key==="Home"?(L.preventDefault(),b(0)):L.key==="End"?(L.preventDefault(),b(Math.max(0,p.length-1))):(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),z())};return u.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:u.jsxs("div",{className:"fc-font-browser__panes",children:[u.jsxs("div",{className:"fc-font-browser__chooser",children:[u.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${d}-search`,children:"Search fonts"}),u.jsx("input",{id:`${d}-search`,className:"fc-font-browser__search",type:"search",value:n,disabled:e.disabled,placeholder:"Search installed fonts",onChange:L=>{i(L.currentTarget.value),b(0)}}),e.loading?u.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?u.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,u.jsxs("div",{id:d,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":w?tT(d,g):void 0,"aria-busy":e.loading||void 0,onKeyDown:N,children:[u.jsx(pC,{groupId:x,label:"Built-in",rows:_.filter(({row:L})=>L.source==="builtin"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:T}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx(pC,{groupId:E,label:"Installed on this machine",rows:_.filter(({row:L})=>L.source==="system"),activeRow:w,selected:e.selected,listboxId:d,disabled:e.disabled,onSelect:T}),!e.loading&&!_.length?u.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),u.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[u.jsxs("div",{className:"fc-font-browser__preview-head",children:[u.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),u.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?"Unavailable":"Available"})]}),u.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${r}px`},children:e.previewText}),u.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r<=t.min,onClick:()=>D(r-t.step),"aria-label":"Decrease font size",children:"−"}),u.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[r,"px"]}),u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r>=t.max,onClick:()=>D(r+t.step),"aria-label":"Increase font size",children:"+"})]}),u.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:r,disabled:e.disabled,"aria-label":"Font size slider",onChange:L=>o(mC(Number(L.currentTarget.value),t)),onPointerUp:L=>D(Number(L.currentTarget.value)),onKeyUp:L=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(L.key)&&D(Number(L.currentTarget.value))}})]})]})})}function pC({groupId:e,label:t,rows:n,activeRow:i,selected:r,listboxId:o,disabled:c,onSelect:d}){return u.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[u.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),n.map(({row:f,index:p})=>u.jsxs("button",{id:tT(o,p),type:"button",className:`fc-font-browser__row${Yf(f.selection,i?.selection??null)?" is-active":""}${f.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Yf(f.selection,r),disabled:c||f.unavailable,onClick:()=>d(p,f.selection),children:[u.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:f.previewFamily},children:f.label}),f.description?u.jsx("span",{className:"fc-font-browser__row-meta",children:f.description}):null,f.unavailable?u.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},f.id))]})}function Cj(e){const t=new Set,n=e.builtIns.flatMap(o=>{const c=[o.id,o.label,...o.aliases??[]].map(Vu);return c.some(d=>t.has(d))?[]:(c.forEach(d=>t.add(d)),[{id:`builtin-${o.id}`,label:o.label,family:o.family,previewFamily:o.family,source:"builtin",selection:{source:"builtin",id:o.id},description:o.description,unavailable:!1}])}),i=e.installedFonts.map(o=>({id:`system-${Vu(o.family)}`,label:o.family,family:o.family,previewFamily:qf(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!JO(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${Vu(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:qf(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function kj(e,t){const n=Vu(t);return n?e.filter(i=>Vu(`${i.label} ${i.description??""}`).includes(n)):e}function Vu(e){return e.trim().toLocaleLowerCase()}function tT(e,t){return`${e}-option-${t}`}function Ej(e,t){const n=e.findIndex(i=>Yf(i.selection,t));return n>=0?n:0}function Yf(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function mC(e,t){if(!Number.isFinite(e))return t.defaultValue;const n=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,n))}const Tj="/api/v1/settings/fonts/system";class $l extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function Aj(e){if(!iT(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new $l("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(Rj)}}async function nT(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new $l("System font fetching is unavailable in this environment.");let n;try{n=await t(Tj,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new $l("System fonts could not be loaded.")}if(!n.ok)throw new $l("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new $l("System font response is not valid JSON.",n.status)}return Aj(i)}function Rj(e){if(!iT(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new $l("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function Nj(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iT(e,t){return Nj(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const gC=250,Lj=5e3,_C=1,Mj=1013,Oj=4e3,Dj=4001;function jj(e){const t=new AbortController,n=new TextEncoder;let i=gC,r=null,o=null,c=null,d=!1;const f=()=>{o?.dispose(),o=null},p=(b,S)=>{c={cols:b,rows:S},r?.readyState===_C&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},_=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await Bj(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await g(Ij(b,e.location,e.wsPath),e),i=gC}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await Pj(i,t.signal),i=Math.min(i*2,Lj)}},g=async(b,S)=>{await new Promise((w,x)=>{const E=(S.webSocketFactory??$j)(b);r=E,E.binaryType="arraybuffer",E.onopen=()=>{S.onStatus?.("live"),f(),o=S.terminal.onData(D=>{E.readyState===_C&&E.send(n.encode(D))}),c&&p(c.cols,c.rows)},E.onmessage=D=>{D.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(D.data))},E.onerror=()=>{x(new Error("Terminal WebSocket error"))},E.onclose=D=>{f(),r===E&&(r=null);const j=D?.code;j===Oj?(t.abort(),S.onStatus?.("closed","terminal_replaced")):j===Dj?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):j===Mj&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{d||(d=!0,_())},resize:p,dispose:()=>{t.abort(),f(),e.onStatus?.("closed"),r?.close(),r=null}}}function Ij(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function Bj(e,t,n){const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:n});if(!i.ok)throw new Error(`Terminal ticket request failed: ${i.status}`);const r=await i.json();if(typeof r.ticket!="string"||typeof r.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:r.ticket,ttlMs:r.ttlMs}}function $j(e){return new WebSocket(e)}async function Pj(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var zj=2,Hj=1,Fj=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),r=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},d=c.top+c.bottom,f=c.right+c.left,p=i-d,_=r-f-t;return{cols:Math.max(zj,Math.floor(_/e.css.cell.width)),rows:Math.max(Hj,Math.floor(p/e.css.cell.height))}}};var d_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Uj=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Jn;function Wj(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var qj=class{constructor(){if(this.version="6",!Jn){Jn=new Uint8Array(65536),Jn.fill(1),Jn[0]=0,Jn.fill(0,1,32),Jn.fill(0,127,160),Jn.fill(2,4352,4448),Jn[9001]=2,Jn[9002]=2,Jn.fill(2,11904,42192),Jn[12351]=1,Jn.fill(2,44032,55204),Jn.fill(2,63744,64256),Jn.fill(2,65040,65050),Jn.fill(2,65072,65136),Jn.fill(2,65280,65377),Jn.fill(2,65504,65511);for(let t=0;t<d_.length;++t)Jn.fill(0,d_[t][0],d_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Jn[t]:Wj(t,Uj)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=Zf.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return Zf.createPropertyValue(0,i,r)}},Gj=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?vC.isErrorNoTelemetry(t)?new vC(t.message+`
|
|
12
|
-
|
|
13
|
-
`+t.stack):new Error(t.message+`
|
|
14
|
-
|
|
15
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(n=>{n(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Kj=new Gj;function f_(e){Vj(e)||Kj.onUnexpectedError(e)}var qv="Canceled";function Vj(e){return e instanceof Yj?!0:e instanceof Error&&e.name===qv&&e.message===qv}var Yj=class extends Error{constructor(){super(qv),this.name=this.message}},vC=class Gv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Gv)return t;let n=new Gv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Xj(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var Zj;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zj||={});var sT;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function c(T){return T||n}e.from=c;function*d(T){for(let N=T.length-1;N>=0;N--)yield T[N]}e.reverse=d;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(T){return T[Symbol.iterator]().next().value}e.first=p;function _(T,N){let L=0;for(let H of T)if(N(H,L++))return!0;return!1}e.some=_;function g(T,N){for(let L of T)if(N(L))return L}e.find=g;function*b(T,N){for(let L of T)N(L)&&(yield L)}e.filter=b;function*S(T,N){let L=0;for(let H of T)yield N(H,L++)}e.map=S;function*w(T,N){let L=0;for(let H of T)yield*N(H,L++)}e.flatMap=w;function*x(...T){for(let N of T)yield*N}e.concat=x;function E(T,N,L){let H=L;for(let F of T)H=N(H,F);return H}e.reduce=E;function*D(T,N,L=T.length){for(N<0&&(N+=T.length),L<0?L+=T.length:L>T.length&&(L=T.length);N<L;N++)yield T[N]}e.slice=D;function j(T,N=Number.POSITIVE_INFINITY){let L=[];if(N===0)return[L,T];let H=T[Symbol.iterator]();for(let F=0;F<N;F++){let J=H.next();if(J.done)return[L,e.empty()];L.push(J.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=j;async function z(T){let N=[];for await(let L of T)N.push(L);return Promise.resolve(N)}e.asyncToArray=z})(sT||={});function rT(e){if(sT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Jj(...e){return aT(()=>rT(e))}function aT(e){return{dispose:Xj(()=>{e()})}}var oT=class lT{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{rT(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?lT.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};oT.DISABLE_DISPOSED_WARNING=!1;var n0=oT,Xf=class{constructor(){this._store=new n0,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Xf.None=Object.freeze({dispose(){}});var Qj=globalThis.performance&&typeof globalThis.performance.now=="function",eI=class cT{static create(t){return new cT(t)}constructor(t){this._now=Qj&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},tI;(e=>{e.None=()=>Xf.None;function t(P,A){return g(P,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(P){return(A,$=null,M)=>{let k=!1,B;return B=P(O=>{if(!k)return B?B.dispose():k=!0,A.call($,O)},null,M),k&&B.dispose(),B}}e.once=n;function i(P,A,$){return p((M,k=null,B)=>P(O=>M.call(k,A(O)),null,B),$)}e.map=i;function r(P,A,$){return p((M,k=null,B)=>P(O=>{A(O),M.call(k,O)},null,B),$)}e.forEach=r;function o(P,A,$){return p((M,k=null,B)=>P(O=>A(O)&&M.call(k,O),null,B),$)}e.filter=o;function c(P){return P}e.signal=c;function d(...P){return(A,$=null,M)=>{let k=Jj(...P.map(B=>B(O=>A.call($,O))));return _(k,M)}}e.any=d;function f(P,A,$,M){let k=$;return i(P,B=>(k=A(k,B),k),M)}e.reduce=f;function p(P,A){let $,M={onWillAddFirstListener(){$=P(k.fire,k)},onDidRemoveLastListener(){$?.dispose()}},k=new La(M);return A?.add(k),k.event}function _(P,A){return A instanceof Array?A.push(P):A&&A.add(P),P}function g(P,A,$=100,M=!1,k=!1,B,O){let W,U,R,Y=0,Z,me={leakWarningThreshold:B,onWillAddFirstListener(){W=P(oe=>{Y++,U=A(U,oe),M&&!R&&(ue.fire(U),U=void 0),Z=()=>{let ke=U;U=void 0,R=void 0,(!M||Y>1)&&ue.fire(ke),Y=0},typeof $=="number"?(clearTimeout(R),R=setTimeout(Z,$)):R===void 0&&(R=0,queueMicrotask(Z))})},onWillRemoveListener(){k&&Y>0&&Z?.()},onDidRemoveLastListener(){Z=void 0,W.dispose()}},ue=new La(me);return O?.add(ue),ue.event}e.debounce=g;function b(P,A=0,$){return e.debounce(P,(M,k)=>M?(M.push(k),M):[k],A,void 0,!0,void 0,$)}e.accumulate=b;function S(P,A=(M,k)=>M===k,$){let M=!0,k;return o(P,B=>{let O=M||!A(B,k);return M=!1,k=B,O},$)}e.latch=S;function w(P,A,$){return[e.filter(P,A,$),e.filter(P,M=>!A(M),$)]}e.split=w;function x(P,A=!1,$=[],M){let k=$.slice(),B=P(U=>{k?k.push(U):W.fire(U)});M&&M.add(B);let O=()=>{k?.forEach(U=>W.fire(U)),k=null},W=new La({onWillAddFirstListener(){B||(B=P(U=>W.fire(U)),M&&M.add(B))},onDidAddFirstListener(){k&&(A?setTimeout(O):O())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return M&&M.add(W),W.event}e.buffer=x;function E(P,A){return($,M,k)=>{let B=A(new j);return P(function(O){let W=B.evaluate(O);W!==D&&$.call(M,W)},void 0,k)}}e.chain=E;let D=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push($=>(A($),$)),this}filter(A){return this.steps.push($=>A($)?$:D),this}reduce(A,$){let M=$;return this.steps.push(k=>(M=A(M,k),M)),this}latch(A=($,M)=>$===M){let $=!0,M;return this.steps.push(k=>{let B=$||!A(k,M);return $=!1,M=k,B?k:D}),this}evaluate(A){for(let $ of this.steps)if(A=$(A),A===D)break;return A}}function z(P,A,$=M=>M){let M=(...W)=>O.fire($(...W)),k=()=>P.on(A,M),B=()=>P.removeListener(A,M),O=new La({onWillAddFirstListener:k,onDidRemoveLastListener:B});return O.event}e.fromNodeEventEmitter=z;function T(P,A,$=M=>M){let M=(...W)=>O.fire($(...W)),k=()=>P.addEventListener(A,M),B=()=>P.removeEventListener(A,M),O=new La({onWillAddFirstListener:k,onDidRemoveLastListener:B});return O.event}e.fromDOMEventEmitter=T;function N(P){return new Promise(A=>n(P)(A))}e.toPromise=N;function L(P){let A=new La;return P.then($=>{A.fire($)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=L;function H(P,A){return P($=>A.fire($))}e.forward=H;function F(P,A,$){return A($),P(M=>A(M))}e.runAndSubscribe=F;class J{constructor(A,$){this._observable=A,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new La(M),$&&$.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,$){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function pe(P,A){return new J(P,A).emitter.event}e.fromObservable=pe;function G(P){return(A,$,M)=>{let k=0,B=!1,O={beginUpdate(){k++},endUpdate(){k--,k===0&&(P.reportChanges(),B&&(B=!1,A.call($)))},handlePossibleChange(){},handleChange(){B=!0}};P.addObserver(O),P.reportChanges();let W={dispose(){P.removeObserver(O)}};return M instanceof n0?M.add(W):Array.isArray(M)&&M.push(W),W}}e.fromObservableLight=G})(tI||={});var Kv=class Vv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Vv._idPool++}`,Vv.all.add(this)}start(t){this._stopWatch=new eI,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Kv.all=new Set,Kv._idPool=0;var nI=Kv,iI=-1,uT=class hT{constructor(t,n,i=(hT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let f=new aI(d,o);this._errorHandler(f)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};uT._idPool=1;var sI=uT,rI=class dT{constructor(t){this.value=t}static create(){let t=new Error;return new dT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
-
`).slice(2).join(`
|
|
17
|
-
`))}},aI=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},oI=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},lI=0,p_=class{constructor(t){this.value=t,this.id=lI++}},cI=2,uI,La=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new sI(t?.onListenerError??f_,this._options?.leakWarningThreshold??iI):void 0,this._perfMon=this._options?._profName?new nI(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new oI(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||f_)(p),Xf.None}if(this._disposed)return Xf.None;n&&(t=t.bind(n));let r=new p_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=rI.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof p_?(this._deliveryQueue??=new hI,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=aT(()=>{o?.(),this._removeListener(r)});return i instanceof n0?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*cI<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||f_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof p_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},hI=class{constructor(){this.i=-1,this.end=0}enqueue(t,n,i){this.i=0,this.end=i,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Zf=class wf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new La,this.onChange=this._onChange.event;let t=new qj;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return n+this.wcwidth(c);let p=t.charCodeAt(o);56320<=p&&p<=57343?c=(c-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(c,i),f=wf.extractWidth(d);wf.extractShouldJoin(d)&&(f-=wf.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},m_=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],dI=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],g_=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],fI=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],$r;function yC(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var pI=class{constructor(){if(this.version="11",!$r){$r=new Uint8Array(65536),$r.fill(1),$r[0]=0,$r.fill(0,1,32),$r.fill(0,127,160);for(let t=0;t<m_.length;++t)$r.fill(0,m_[t][0],m_[t][1]+1);for(let t=0;t<g_.length;++t)$r.fill(2,g_[t][0],g_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?$r[t]:yC(t,dI)?0:yC(t,fI)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=Zf.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return Zf.createPropertyValue(0,i,r)}},mI=class{activate(t){t.unicode.register(new pI)}dispose(){}};var gI=(e,t,n,i)=>{for(var r=t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=c(r)||r);return r},_I=(e,t)=>(n,i)=>t(n,i,e),vI=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?bC.isErrorNoTelemetry(e)?new bC(e.message+`
|
|
18
|
-
|
|
19
|
-
`+e.stack):new Error(e.message+`
|
|
20
|
-
|
|
21
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},yI=new vI;function __(e){bI(e)||yI.onUnexpectedError(e)}var Yv="Canceled";function bI(e){return e instanceof SI?!0:e instanceof Error&&e.name===Yv&&e.message===Yv}var SI=class extends Error{constructor(){super(Yv),this.name=this.message}},bC=class Xv extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Xv)return t;let n=new Xv;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},wI;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(wI||={});function xI(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var fT;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function c(T){return T||n}e.from=c;function*d(T){for(let N=T.length-1;N>=0;N--)yield T[N]}e.reverse=d;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(T){return T[Symbol.iterator]().next().value}e.first=p;function _(T,N){let L=0;for(let H of T)if(N(H,L++))return!0;return!1}e.some=_;function g(T,N){for(let L of T)if(N(L))return L}e.find=g;function*b(T,N){for(let L of T)N(L)&&(yield L)}e.filter=b;function*S(T,N){let L=0;for(let H of T)yield N(H,L++)}e.map=S;function*w(T,N){let L=0;for(let H of T)yield*N(H,L++)}e.flatMap=w;function*x(...T){for(let N of T)yield*N}e.concat=x;function E(T,N,L){let H=L;for(let F of T)H=N(H,F);return H}e.reduce=E;function*D(T,N,L=T.length){for(N<0&&(N+=T.length),L<0?L+=T.length:L>T.length&&(L=T.length);N<L;N++)yield T[N]}e.slice=D;function j(T,N=Number.POSITIVE_INFINITY){let L=[];if(N===0)return[L,T];let H=T[Symbol.iterator]();for(let F=0;F<N;F++){let J=H.next();if(J.done)return[L,e.empty()];L.push(J.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=j;async function z(T){let N=[];for await(let L of T)N.push(L);return Promise.resolve(N)}e.asyncToArray=z})(fT||={});function pT(e){if(fT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function mT(...e){return Ri(()=>pT(e))}function Ri(e){return{dispose:xI(()=>{e()})}}var gT=class _T{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pT(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?_T.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};gT.DISABLE_DISPOSED_WARNING=!1;var Gl=gT,Zs=class{constructor(){this._store=new Gl,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Zs.None=Object.freeze({dispose(){}});var uu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},i0=typeof process<"u"&&"title"in process,Np=i0?"node":navigator.userAgent,CI=i0?"node":navigator.platform,kI=Np.includes("Firefox"),EI=Np.includes("Edge"),vT=/^((?!chrome|android).)*safari/i.test(Np);function TI(){if(!vT)return 0;let e=Np.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}CI.indexOf("Linux")>=0;var AI="",ri=0,ai=0,oi=0,Rn=0,Ns={css:"#00000000",rgba:0},Ii;(e=>{function t(r,o,c,d){return d!==void 0?`#${_o(r)}${_o(o)}${_o(c)}${_o(d)}`:`#${_o(r)}${_o(o)}${_o(c)}`}e.toCss=t;function n(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=n;function i(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=i})(Ii||={});var ju;(e=>{function t(f,p){if(Rn=(p.rgba&255)/255,Rn===1)return{css:p.css,rgba:p.rgba};let _=p.rgba>>24&255,g=p.rgba>>16&255,b=p.rgba>>8&255,S=f.rgba>>24&255,w=f.rgba>>16&255,x=f.rgba>>8&255;ri=S+Math.round((_-S)*Rn),ai=w+Math.round((g-w)*Rn),oi=x+Math.round((b-x)*Rn);let E=Ii.toCss(ri,ai,oi),D=Ii.toRgba(ri,ai,oi);return{css:E,rgba:D}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,_){let g=Ro.ensureContrastRatio(f.rgba,p.rgba,_);if(g)return Ii.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=i;function r(f){let p=(f.rgba|255)>>>0;return[ri,ai,oi]=Ro.toChannels(p),{css:Ii.toCss(ri,ai,oi),rgba:p}}e.opaque=r;function o(f,p){return Rn=Math.round(p*255),[ri,ai,oi]=Ro.toChannels(f.rgba),{css:Ii.toCss(ri,ai,oi,Rn),rgba:Ii.toRgba(ri,ai,oi,Rn)}}e.opacity=o;function c(f,p){return Rn=f.rgba&255,o(f,Rn*p/255)}e.multiplyOpacity=c;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(ju||={});var RI;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ri=parseInt(r.slice(1,2).repeat(2),16),ai=parseInt(r.slice(2,3).repeat(2),16),oi=parseInt(r.slice(3,4).repeat(2),16),Ii.toColor(ri,ai,oi);case 5:return ri=parseInt(r.slice(1,2).repeat(2),16),ai=parseInt(r.slice(2,3).repeat(2),16),oi=parseInt(r.slice(3,4).repeat(2),16),Rn=parseInt(r.slice(4,5).repeat(2),16),Ii.toColor(ri,ai,oi,Rn);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return ri=parseInt(o[1]),ai=parseInt(o[2]),oi=parseInt(o[3]),Rn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Ii.toColor(ri,ai,oi,Rn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ri,ai,oi,Rn]=t.getImageData(0,0,1,1).data,Rn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ii.toRgba(ri,ai,oi,Rn),css:r}}e.toColor=i})(RI||={});var Oi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let c=i/255,d=r/255,f=o/255,p=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),_=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+_*.7152+g*.0722}e.relativeLuminance2=n})(Oi||={});var Ro;(e=>{function t(c,d){if(Rn=(d&255)/255,Rn===1)return d;let f=d>>24&255,p=d>>16&255,_=d>>8&255,g=c>>24&255,b=c>>16&255,S=c>>8&255;return ri=g+Math.round((f-g)*Rn),ai=b+Math.round((p-b)*Rn),oi=S+Math.round((_-S)*Rn),Ii.toRgba(ri,ai,oi)}e.blend=t;function n(c,d,f){let p=Oi.relativeLuminance(c>>8),_=Oi.relativeLuminance(d>>8);if(Pr(p,_)<f){if(_<p){let S=i(c,d,f),w=Pr(p,Oi.relativeLuminance(S>>8));if(w<f){let x=r(c,d,f),E=Pr(p,Oi.relativeLuminance(x>>8));return w>E?S:x}return S}let g=r(c,d,f),b=Pr(p,Oi.relativeLuminance(g>>8));if(b<f){let S=i(c,d,f),w=Pr(p,Oi.relativeLuminance(S>>8));return b>w?g:S}return g}}e.ensureContrastRatio=n;function i(c,d,f){let p=c>>24&255,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Pr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(p,_,g));for(;x<f&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Pr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(p,_,g));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(c,d,f){let p=c>>24&255,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Pr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(p,_,g));for(;x<f&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Pr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(p,_,g));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(Ro||={});function _o(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Pr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Wn(e){if(!e)throw new Error("value must not be falsy");return e}function s0(e){return 57508<=e&&e<=57558}function NI(e){return 57520<=e&&e<=57527}function LI(e){return 57344<=e&&e<=63743}function MI(e){return 9472<=e&&e<=9631}function OI(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function DI(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!OI(e)&&!s0(e)&&!LI(e)}function yT(e){return s0(e)||MI(e)}function jI(){return{css:{canvas:Fd(),cell:Fd()},device:{canvas:Fd(),cell:Fd(),char:{width:0,height:0,left:0,top:0}}}}function Fd(){return{width:0,height:0}}function II(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var bi=0,ii=0,ar=!1,zr=!1,Ud=!1,Xi,v_=0,BI=class{constructor(e,t,n,i,r,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=i,this._coreBrowserService=r,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,ii=0,bi=0,zr=!1,ar=!1,Ud=!1,Xi=this._themeService.colors,v_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));v_=t*i%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",r=>{r.backgroundColorRGB&&(ii=r.backgroundColorRGB.rgba>>8&16777215,zr=!0),r.foregroundColorRGB&&(bi=r.foregroundColorRGB.rgba>>8&16777215,ar=!0)}),Ud=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Ud){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ii=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ii=(this.result.fg&16777215)<<8|255;break;default:ii=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ii=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ii=(this.result.bg&16777215)<<8|255;break}ii=Ro.blend(ii,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ii=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(zr=!0,Xi.selectionForeground&&(bi=Xi.selectionForeground.rgba>>8&16777215,ar=!0),yT(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)bi=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:bi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:bi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:bi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:bi=(this.result.fg&16777215)<<8|255;break;default:bi=this._themeService.colors.foreground.rgba}bi=Ro.blend(bi,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ar=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(ii=r.backgroundColorRGB.rgba>>8&16777215,zr=!0),r.foregroundColorRGB&&(bi=r.foregroundColorRGB.rgba>>8&16777215,ar=!0)}),zr&&(Ud?ii=e.bg&-16777216&-134217729|ii|50331648:ii=e.bg&-16777216|ii|50331648),ar&&(bi=e.fg&-16777216&-67108865|bi|50331648),this.result.fg&67108864&&(zr&&!ar&&((this.result.bg&50331648)===0?bi=this.result.fg&-134217728|Xi.background.rgba>>8&16777215&16777215|50331648:bi=this.result.fg&-134217728|this.result.bg&67108863,ar=!0),!zr&&ar&&((this.result.fg&50331648)===0?ii=this.result.bg&-67108864|Xi.foreground.rgba>>8&16777215&16777215|50331648:ii=this.result.bg&-67108864|this.result.fg&67108863,zr=!0)),Xi=void 0,this.result.bg=zr?ii:this.result.bg,this.result.fg=ar?bi:this.result.fg,this.result.ext&=536870911,this.result.ext|=v_<<29&3758096384}},$I=.5,bT=kI||EI?"bottom":"ideographic",PI={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},zI={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},HI={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},sh={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};sh[""]=sh[""];sh[""]=sh[""];function FI(e,t,n,i,r,o,c,d){let f=PI[t];if(f)return UI(e,f,n,i,r,o),!0;let p=zI[t];if(p)return WI(e,p,n,i,r,o),!0;let _=HI[t];if(_)return qI(e,_,n,i,r,o,d),!0;let g=sh[t];return g?(GI(e,g,n,i,r,o,c,d),!0):!1}function UI(e,t,n,i,r,o){for(let c=0;c<t.length;c++){let d=t[c],f=r/8,p=o/8;e.fillRect(n+d.x*f,i+d.y*p,d.w*f,d.h*p)}}var SC=new Map;function WI(e,t,n,i,r,o){let c=SC.get(t);c||(c=new Map,SC.set(t,c));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let f=c.get(d);if(!f){let p=t[0].length,_=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=p,g.height=_;let b=Wn(g.getContext("2d")),S=new ImageData(p,_),w,x,E,D;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),E=parseInt(d.slice(5,7),16),D=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,x,E,D]=d.substring(5,d.length-1).split(",").map(j=>parseFloat(j));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let j=0;j<_;j++)for(let z=0;z<p;z++)S.data[(j*p+z)*4]=w,S.data[(j*p+z)*4+1]=x,S.data[(j*p+z)*4+2]=E,S.data[(j*p+z)*4+3]=t[j][z]*(D*255);b.putImageData(S,0,0),f=Wn(e.createPattern(g,null)),c.set(d,f)}e.fillStyle=f,e.fillRect(n,i,r,o)}function qI(e,t,n,i,r,o,c){e.strokeStyle=e.fillStyle;for(let[d,f]of Object.entries(t)){e.beginPath(),e.lineWidth=c*Number.parseInt(d);let p;if(typeof f=="function"){let _=.15/o*r;p=f(.15,_)}else p=f;for(let _ of p.split(" ")){let g=_[0],b=ST[g];if(!b){console.error(`Could not find drawing instructions for "${g}"`);continue}let S=_.substring(1).split(",");!S[0]||!S[1]||b(e,wT(S,r,o,n,i,!0,c))}e.stroke(),e.closePath()}}function GI(e,t,n,i,r,o,c,d){let f=new Path2D;f.rect(n,i,r,o),e.clip(f),e.beginPath();let p=c/12;e.lineWidth=d*p;for(let _ of t.d.split(" ")){let g=_[0],b=ST[g];if(!b){console.error(`Could not find drawing instructions for "${g}"`);continue}let S=_.substring(1).split(",");!S[0]||!S[1]||b(e,wT(S,r,o,n,i,!1,d,(t.leftPadding??0)*(p/2),(t.rightPadding??0)*(p/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function wC(e,t,n=0){return Math.max(Math.min(e,t),n)}var ST={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function wT(e,t,n,i,r,o,c,d=0,f=0){let p=e.map(_=>parseFloat(_)||parseInt(_));if(p.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<p.length;_+=2)p[_]*=t-d*c-f*c,o&&p[_]!==0&&(p[_]=wC(Math.round(p[_]+.5)-.5,t,0)),p[_]+=i+d*c;for(let _=1;_<p.length;_+=2)p[_]*=n,o&&p[_]!==0&&(p[_]=wC(Math.round(p[_]+.5)-.5,n,0)),p[_]+=r;return p}var xC=class{constructor(){this._data={}}set(t,n,i){this._data[t]||(this._data[t]={}),this._data[t][n]=i}get(t,n){return this._data[t]?this._data[t][n]:void 0}clear(){this._data={}}},CC=class{constructor(){this._data=new xC}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new xC),this._data.get(e,t).set(n,i,r)}get(e,t,n,i){return this._data.get(e,t)?.get(n,i)}clear(){this._data.clear()}},xT=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},KI=class extends xT{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let n=performance.now()+t;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},VI=class extends xT{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},YI=!i0&&"requestIdleCallback"in window?VI:KI,Pl=class CT{constructor(){this.fg=0,this.bg=0,this.extended=new kT}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new CT;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},kT=class ET{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new ET(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},XI=globalThis.performance&&typeof globalThis.performance.now=="function",ZI=class TT{static create(t){return new TT(t)}constructor(t){this._now=XI&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Gr;(e=>{e.None=()=>Zs.None;function t(P,A){return g(P,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(P){return(A,$=null,M)=>{let k=!1,B;return B=P(O=>{if(!k)return B?B.dispose():k=!0,A.call($,O)},null,M),k&&B.dispose(),B}}e.once=n;function i(P,A,$){return p((M,k=null,B)=>P(O=>M.call(k,A(O)),null,B),$)}e.map=i;function r(P,A,$){return p((M,k=null,B)=>P(O=>{A(O),M.call(k,O)},null,B),$)}e.forEach=r;function o(P,A,$){return p((M,k=null,B)=>P(O=>A(O)&&M.call(k,O),null,B),$)}e.filter=o;function c(P){return P}e.signal=c;function d(...P){return(A,$=null,M)=>{let k=mT(...P.map(B=>B(O=>A.call($,O))));return _(k,M)}}e.any=d;function f(P,A,$,M){let k=$;return i(P,B=>(k=A(k,B),k),M)}e.reduce=f;function p(P,A){let $,M={onWillAddFirstListener(){$=P(k.fire,k)},onDidRemoveLastListener(){$?.dispose()}},k=new dn(M);return A?.add(k),k.event}function _(P,A){return A instanceof Array?A.push(P):A&&A.add(P),P}function g(P,A,$=100,M=!1,k=!1,B,O){let W,U,R,Y=0,Z,me={leakWarningThreshold:B,onWillAddFirstListener(){W=P(oe=>{Y++,U=A(U,oe),M&&!R&&(ue.fire(U),U=void 0),Z=()=>{let ke=U;U=void 0,R=void 0,(!M||Y>1)&&ue.fire(ke),Y=0},typeof $=="number"?(clearTimeout(R),R=setTimeout(Z,$)):R===void 0&&(R=0,queueMicrotask(Z))})},onWillRemoveListener(){k&&Y>0&&Z?.()},onDidRemoveLastListener(){Z=void 0,W.dispose()}},ue=new dn(me);return O?.add(ue),ue.event}e.debounce=g;function b(P,A=0,$){return e.debounce(P,(M,k)=>M?(M.push(k),M):[k],A,void 0,!0,void 0,$)}e.accumulate=b;function S(P,A=(M,k)=>M===k,$){let M=!0,k;return o(P,B=>{let O=M||!A(B,k);return M=!1,k=B,O},$)}e.latch=S;function w(P,A,$){return[e.filter(P,A,$),e.filter(P,M=>!A(M),$)]}e.split=w;function x(P,A=!1,$=[],M){let k=$.slice(),B=P(U=>{k?k.push(U):W.fire(U)});M&&M.add(B);let O=()=>{k?.forEach(U=>W.fire(U)),k=null},W=new dn({onWillAddFirstListener(){B||(B=P(U=>W.fire(U)),M&&M.add(B))},onDidAddFirstListener(){k&&(A?setTimeout(O):O())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return M&&M.add(W),W.event}e.buffer=x;function E(P,A){return($,M,k)=>{let B=A(new j);return P(function(O){let W=B.evaluate(O);W!==D&&$.call(M,W)},void 0,k)}}e.chain=E;let D=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push($=>(A($),$)),this}filter(A){return this.steps.push($=>A($)?$:D),this}reduce(A,$){let M=$;return this.steps.push(k=>(M=A(M,k),M)),this}latch(A=($,M)=>$===M){let $=!0,M;return this.steps.push(k=>{let B=$||!A(k,M);return $=!1,M=k,B?k:D}),this}evaluate(A){for(let $ of this.steps)if(A=$(A),A===D)break;return A}}function z(P,A,$=M=>M){let M=(...W)=>O.fire($(...W)),k=()=>P.on(A,M),B=()=>P.removeListener(A,M),O=new dn({onWillAddFirstListener:k,onDidRemoveLastListener:B});return O.event}e.fromNodeEventEmitter=z;function T(P,A,$=M=>M){let M=(...W)=>O.fire($(...W)),k=()=>P.addEventListener(A,M),B=()=>P.removeEventListener(A,M),O=new dn({onWillAddFirstListener:k,onDidRemoveLastListener:B});return O.event}e.fromDOMEventEmitter=T;function N(P){return new Promise(A=>n(P)(A))}e.toPromise=N;function L(P){let A=new dn;return P.then($=>{A.fire($)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=L;function H(P,A){return P($=>A.fire($))}e.forward=H;function F(P,A,$){return A($),P(M=>A(M))}e.runAndSubscribe=F;class J{constructor(A,$){this._observable=A,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new dn(M),$&&$.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,$){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function pe(P,A){return new J(P,A).emitter.event}e.fromObservable=pe;function G(P){return(A,$,M)=>{let k=0,B=!1,O={beginUpdate(){k++},endUpdate(){k--,k===0&&(P.reportChanges(),B&&(B=!1,A.call($)))},handlePossibleChange(){},handleChange(){B=!0}};P.addObserver(O),P.reportChanges();let W={dispose(){P.removeObserver(O)}};return M instanceof Gl?M.add(W):Array.isArray(M)&&M.push(W),W}}e.fromObservableLight=G})(Gr||={});var Zv=class Jv{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Jv._idPool++}`,Jv.all.add(this)}start(t){this._stopWatch=new ZI,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Zv.all=new Set,Zv._idPool=0;var JI=Zv,QI=-1,AT=class RT{constructor(t,n,i=(RT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let f=new n8(d,o);this._errorHandler(f)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};AT._idPool=1;var e8=AT,t8=class NT{constructor(t){this.value=t}static create(){let t=new Error;return new NT(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
-
`).slice(2).join(`
|
|
23
|
-
`))}},n8=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},i8=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},s8=0,y_=class{constructor(t){this.value=t,this.id=s8++}},r8=2,a8,dn=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new e8(t?.onListenerError??__,this._options?.leakWarningThreshold??QI):void 0,this._perfMon=this._options?._profName?new JI(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new i8(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||__)(p),Zs.None}if(this._disposed)return Zs.None;n&&(t=t.bind(n));let r=new y_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=t8.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof y_?(this._deliveryQueue??=new o8,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Ri(()=>{o?.(),this._removeListener(r)});return i instanceof Gl?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*r8<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||__;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof y_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},o8=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},kC={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},hu=2,du,Ma=class Ol{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new CC,this._cacheMapCombined=new CC,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Pl,this._textureSize=512,this._onAddTextureAtlasCanvas=new dn,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new dn,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=LT(t,this._config.deviceCellWidth*4+hu*2,this._config.deviceCellHeight+hu*2),this._tmpCtx=Wn(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new YI;for(let n=33;n<126;n++)t.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let i=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ol.maxAtlasPages&&this._pages.length>=Math.max(4,Ol.maxAtlasPages)){let n=this._pages.filter(p=>p.canvas.width*2<=(Ol.maxTextureSize||4096)).sort((p,_)=>_.canvas.width!==p.canvas.width?_.canvas.width-p.canvas.width:_.percentageUsed-p.percentageUsed),i=-1,r=0;for(let p=0;p<n.length;p++)if(n[p].canvas.width!==r)i=p,r=n[p].canvas.width;else if(p-i===3)break;let o=n.slice(i,i+4),c=o.map(p=>p.glyphs[0].texturePage).sort((p,_)=>p>_?1:-1),d=this.pages.length-o.length,f=this._mergePages(o,d);f.version++;for(let p=c.length-1;p>=0;p--)this._deletePage(c[p]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new b_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,n){let i=t[0].canvas.width*2,r=new b_(this._document,i,t);for(let[o,c]of t.entries()){let d=o*c.canvas.width%i,f=Math.floor(o/2)*c.canvas.height;r.ctx.drawImage(c.canvas,d,f);for(let _ of c.glyphs)_.texturePage=n,_.sizeClipSpace.x=_.size.x/i,_.sizeClipSpace.y=_.size.y/i,_.texturePosition.x+=d,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/i,_.texturePositionClipSpace.y=_.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let p=this._activePages.indexOf(c);p!==-1&&this._activePages.splice(p,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let i=this._pages[n];for(let r of i.glyphs)r.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,n,i,r,o,c){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,r,o,c)}getRasterizedGlyph(t,n,i,r,o,c){return this._getFromCacheMap(this._cacheMap,t,n,i,r,o,c)}_getFromCacheMap(t,n,i,r,o,c,d){return du=t.get(n,i,r,o),du||(du=this._drawToCache(n,i,r,o,c,d),t.set(n,i,r,o,du)),du}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Ns;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let c=Pl.toColorRGB(n);o=Ii.toColor(c[0],c[1],c[2]);break;default:i?o=ju.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=ju.opaque(o)),o}_getForegroundColor(t,n,i,r,o,c,d,f,p,_){let g=this._getMinimumContrastColor(t,n,i,r,o,c,d,p,f,_);if(g)return g;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&p&&c<8&&(c+=8),b=this._getColorFromAnsiIndex(c);break;case 50331648:let S=Pl.toColorRGB(c);b=Ii.toColor(S[0],S[1],S[2]);break;default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=ju.opaque(b)),f&&(b=ju.multiplyOpacity(b,$I)),b}_resolveBackgroundRgba(t,n,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,n,i,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,n,i,r,o,c,d,f,p,_){if(this._config.minimumContrastRatio===1||_)return;let g=this._getContrastCache(p),b=g.getColor(t,r);if(b!==void 0)return b||void 0;let S=this._resolveBackgroundRgba(n,i,d),w=this._resolveForegroundRgba(o,c,d,f),x=Ro.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(p?2:1));if(!x){g.setColor(t,r,null);return}let E=Ii.toColor(x>>24&255,x>>16&255,x>>8&255);return g.setColor(t,r,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,r,o,c){let d=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+hu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let p=Math.min(this._config.deviceCellHeight+hu*4,this._textureSize);if(this._tmpCanvas.height<p&&(this._tmpCanvas.height=p),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return kC;let _=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),D=this._workAttributeData.getFgColor(),j=this._workAttributeData.getFgColorMode(),z=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(g){let U=D;D=z,z=U;let R=j;j=T,T=R}let N=this._getBackgroundColor(T,z,g,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=N.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=_?this._config.fontWeightBold:this._config.fontWeight,H=S?"italic":"";this._tmpCtx.font=`${H} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=bT;let F=d.length===1&&s0(d.charCodeAt(0)),J=d.length===1&&NI(d.charCodeAt(0)),pe=this._getForegroundColor(n,T,z,i,j,D,g,b,_,yT(d.charCodeAt(0)));this._tmpCtx.fillStyle=pe.css;let G=J?0:hu*2,P=!1;this._config.customGlyphs!==!1&&(P=FI(this._tmpCtx,d,G,G,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let A=!F,$;if(typeof t=="number"?$=this._unicodeService.wcwidth(t):$=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let U=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),R=U%2===1?.5:0;if(this._tmpCtx.lineWidth=U,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())A=!1,this._tmpCtx.strokeStyle=`rgb(${Pl.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{A=!1;let ke=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ke<8&&(ke+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ke).css}this._tmpCtx.beginPath();let Y=G,Z=Math.ceil(G+this._config.deviceCharHeight)-R-(o?U*2:0),me=Z+U,ue=Z+U*2,oe=this._workAttributeData.getUnderlineVariantOffset();for(let ke=0;ke<$;ke++){this._tmpCtx.save();let Ne=Y+ke*this._config.deviceCellWidth,Re=Y+(ke+1)*this._config.deviceCellWidth,ot=Ne+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ne,Z),this._tmpCtx.lineTo(Re,Z),this._tmpCtx.moveTo(Ne,ue),this._tmpCtx.lineTo(Re,ue);break;case 3:let Le=U<=1?ue:Math.ceil(G+this._config.deviceCharHeight-U/2)-R,Se=U<=1?Z:Math.ceil(G+this._config.deviceCharHeight+U/2)-R,xe=new Path2D;xe.rect(Ne,Z,this._config.deviceCellWidth,ue-Z),this._tmpCtx.clip(xe),this._tmpCtx.moveTo(Ne-this._config.deviceCellWidth/2,me),this._tmpCtx.bezierCurveTo(Ne-this._config.deviceCellWidth/2,Se,Ne,Se,Ne,me),this._tmpCtx.bezierCurveTo(Ne,Le,ot,Le,ot,me),this._tmpCtx.bezierCurveTo(ot,Se,Re,Se,Re,me),this._tmpCtx.bezierCurveTo(Re,Le,Re+this._config.deviceCellWidth/2,Le,Re+this._config.deviceCellWidth/2,me);break;case 4:let Me=oe===0?0:oe>=U?U*2-oe:U-oe;oe>=U||Me===0?(this._tmpCtx.setLineDash([Math.round(U),Math.round(U)]),this._tmpCtx.moveTo(Ne+Me,Z),this._tmpCtx.lineTo(Re,Z)):(this._tmpCtx.setLineDash([Math.round(U),Math.round(U)]),this._tmpCtx.moveTo(Ne,Z),this._tmpCtx.lineTo(Ne+Me,Z),this._tmpCtx.moveTo(Ne+Me+U,Z),this._tmpCtx.lineTo(Re,Z)),oe=II(Re-Ne,U,oe);break;case 5:let Ke=.6,it=.3,Ge=Re-Ne,he=Math.floor(Ke*Ge),Qe=Math.floor(it*Ge),Ye=Ge-he-Qe;this._tmpCtx.setLineDash([he,Qe,Ye]),this._tmpCtx.moveTo(Ne,Z),this._tmpCtx.lineTo(Re,Z);break;default:this._tmpCtx.moveTo(Ne,Z),this._tmpCtx.lineTo(Re,Z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!P&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ke=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ke&&ke.actualBoundingBoxDescent>0){this._tmpCtx.save();let Ne=new Path2D;Ne.rect(Y,Z-Math.ceil(U/2),this._config.deviceCellWidth*$,ue-Z+Math.ceil(U/2)),this._tmpCtx.clip(Ne),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=N.css,this._tmpCtx.strokeText(d,G,G+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let U=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),R=U%2===1?.5:0;this._tmpCtx.lineWidth=U,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+R),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*$,G+R),this._tmpCtx.stroke()}if(P||this._tmpCtx.fillText(d,G,G+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let U=S_(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),N,pe,A);if(U)for(let R=1;R<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=N.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,G,G+this._config.deviceCharHeight-R),U=S_(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),N,pe,A),!!U);R++);}if(x){let U=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),R=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=U,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+Math.floor(this._config.deviceCharHeight/2)-R),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*$,G+Math.floor(this._config.deviceCharHeight/2)-R),this._tmpCtx.stroke()}this._tmpCtx.restore();let M=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),k;if(this._config.allowTransparency?k=l8(M):k=S_(M,N,pe,A),k)return kC;let B=this._findGlyphBoundingBox(M,this._workBoundingBox,f,J,P,G),O,W;for(;;){if(this._activePages.length===0){let U=this._createNewPage();O=U,W=U.currentRow,W.height=B.size.y;break}O=this._activePages[this._activePages.length-1],W=O.currentRow;for(let U of this._activePages)B.size.y<=U.currentRow.height&&(O=U,W=U.currentRow);for(let U=this._activePages.length-1;U>=0;U--)for(let R of this._activePages[U].fixedRows)R.height<=W.height&&B.size.y<=R.height&&(O=this._activePages[U],W=R);if(B.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new b_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),O=this._overflowSizePage,W=this._overflowSizePage.currentRow,W.x+B.size.x>=O.canvas.width&&(W.x=0,W.y+=W.height,W.height=0);break}if(W.y+B.size.y>=O.canvas.height||W.height>B.size.y+2){let U=!1;if(O.currentRow.y+O.currentRow.height+B.size.y>=O.canvas.height){let R;for(let Y of this._activePages)if(Y.currentRow.y+Y.currentRow.height+B.size.y<Y.canvas.height){R=Y;break}if(R)O=R;else if(Ol.maxAtlasPages&&this._pages.length>=Ol.maxAtlasPages&&W.y+B.size.y<=O.canvas.height&&W.height>=B.size.y&&W.x+B.size.x<=O.canvas.width)U=!0;else{let Y=this._createNewPage();O=Y,W=Y.currentRow,W.height=B.size.y,U=!0}}U||(O.currentRow.height>0&&O.fixedRows.push(O.currentRow),W={x:0,y:O.currentRow.y+O.currentRow.height,height:B.size.y},O.fixedRows.push(W),O.currentRow={x:0,y:W.y+W.height,height:0})}if(W.x+B.size.x<=O.canvas.width)break;W===O.currentRow?(W.x=0,W.y+=W.height,W.height=0):O.fixedRows.splice(O.fixedRows.indexOf(W),1)}return B.texturePage=this._pages.indexOf(O),B.texturePosition.x=W.x,B.texturePosition.y=W.y,B.texturePositionClipSpace.x=W.x/O.canvas.width,B.texturePositionClipSpace.y=W.y/O.canvas.height,B.sizeClipSpace.x/=O.canvas.width,B.sizeClipSpace.y/=O.canvas.height,W.height=Math.max(W.height,B.size.y),W.x+=B.size.x,O.ctx.putImageData(M,B.texturePosition.x-this._workBoundingBox.left,B.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,B.size.x,B.size.y),O.addGlyph(B),O.version++,B}_findGlyphBoundingBox(t,n,i,r,o,c){n.top=0;let d=r?this._config.deviceCellHeight:this._tmpCanvas.height,f=r?this._config.deviceCellWidth:i,p=!1;for(let _=0;_<d;_++){for(let g=0;g<f;g++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.top=_,p=!0;break}}if(p)break}n.left=0,p=!1;for(let _=0;_<c+f;_++){for(let g=0;g<d;g++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.left=_,p=!0;break}}if(p)break}n.right=f,p=!1;for(let _=c+f-1;_>=c;_--){for(let g=0;g<d;g++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.right=_,p=!0;break}}if(p)break}n.bottom=d,p=!1;for(let _=d-1;_>=0;_--){for(let g=0;g<f;g++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.bottom=_,p=!0;break}}if(p)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+c+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+c+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},b_=class{constructor(t,n,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=LT(t,n,n),this.ctx=Wn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function S_(e,t,n,i){let r=t.rgba>>>24,o=t.rgba>>>16&255,c=t.rgba>>>8&255,d=n.rgba>>>24,f=n.rgba>>>16&255,p=n.rgba>>>8&255,_=Math.floor((Math.abs(r-d)+Math.abs(o-f)+Math.abs(c-p))/12),g=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===r&&e.data[b+1]===o&&e.data[b+2]===c||i&&Math.abs(e.data[b]-r)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-c)<_?e.data[b+3]=0:g=!1;return g}function l8(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function LT(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function c8(e,t,n,i,r,o,c,d){let f={foreground:o.foreground,background:o.background,cursor:Ns,cursorAccent:Ns,selectionForeground:Ns,selectionBackgroundTransparent:Ns,selectionBackgroundOpaque:Ns,selectionInactiveBackgroundTransparent:Ns,selectionInactiveBackgroundOpaque:Ns,overviewRulerBorder:Ns,scrollbarSliderBackground:Ns,scrollbarSliderHoverBackground:Ns,scrollbarSliderActiveBackground:Ns,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:c,deviceMaxTextureSize:d,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:f}}function EC(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function u8(e){return(e&50331648)===16777216||(e&50331648)===33554432}var js=[];function MT(e,t,n,i,r,o,c,d,f){let p=c8(i,r,o,c,t,n,d,f);for(let b=0;b<js.length;b++){let S=js[b],w=S.ownedBy.indexOf(e);if(w>=0){if(EC(S.config,p))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),js.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<js.length;b++){let S=js[b];if(EC(S.config,p))return S.ownedBy.push(e),S.atlas}let _=e._core,g={atlas:new Ma(document,p,_.unicodeService),config:p,ownedBy:[e]};return js.push(g),g.atlas}function TC(e){for(let t=0;t<js.length;t++){let n=js[t].ownedBy.indexOf(e);if(n!==-1){js[t].ownedBy.length===1?(js[t].atlas.dispose(),js.splice(t,1)):js[t].ownedBy.splice(n,1);break}}}var Wd=600,h8=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Wd){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Wd-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Wd-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Wd)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function AC(e,t,n){let i=new t.ResizeObserver(r=>{let o=r.find(f=>f.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let c=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;c>0&&d>0&&n(c,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ri(()=>i?.disconnect())}function d8(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var RC=class OT extends Pl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new kT,this.combinedData=""}static fromCharData(t){let n=new OT;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?d8(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},DT=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function jT(e,t,n){let i=Wn(e.createProgram());if(e.attachShader(i,Wn(NC(e,e.VERTEX_SHADER,t))),e.attachShader(i,Wn(NC(e,e.FRAGMENT_SHADER,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function NC(e,t,n){let i=Wn(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function f8(e,t){let n=Math.min(e.length*2,t),i=new Float32Array(n);for(let r=0;r<e.length;r++)i[r]=e[r];return i}var p8=class{constructor(t){this.texture=t,this.version=-1}},m8=`#version 300 es
|
|
24
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
25
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
26
|
-
layout (location = 2) in vec2 a_offset;
|
|
27
|
-
layout (location = 3) in vec2 a_size;
|
|
28
|
-
layout (location = 4) in float a_texpage;
|
|
29
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
30
|
-
layout (location = 6) in vec2 a_texsize;
|
|
31
|
-
|
|
32
|
-
uniform mat4 u_projection;
|
|
33
|
-
uniform vec2 u_resolution;
|
|
34
|
-
|
|
35
|
-
out vec2 v_texcoord;
|
|
36
|
-
flat out int v_texpage;
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
40
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
41
|
-
v_texpage = int(a_texpage);
|
|
42
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
43
|
-
}`;function g8(e){let t="";for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
44
|
-
precision lowp float;
|
|
45
|
-
|
|
46
|
-
in vec2 v_texcoord;
|
|
47
|
-
flat in int v_texpage;
|
|
48
|
-
|
|
49
|
-
uniform sampler2D u_texture[${e}];
|
|
50
|
-
|
|
51
|
-
out vec4 outColor;
|
|
52
|
-
|
|
53
|
-
void main() {
|
|
54
|
-
if (v_texpage == 0) {
|
|
55
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
56
|
-
} ${t}
|
|
57
|
-
}`}var Oa=11,Cl=Oa*Float32Array.BYTES_PER_ELEMENT,_8=2,En=0,un,w_=0,fu=0,v8=class extends Zs{constructor(t,n,i,r){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;Ma.maxAtlasPages===void 0&&(Ma.maxAtlasPages=Math.min(32,Wn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Ma.maxTextureSize=Wn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=Wn(jT(o,m8,g8(Ma.maxAtlasPages))),this._register(Ri(()=>o.deleteProgram(this._program))),this._projectionLocation=Wn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Wn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Wn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let c=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(Ri(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,c,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=o.createBuffer();this._register(Ri(()=>o.deleteBuffer(p))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p),o.bufferData(o.ELEMENT_ARRAY_BUFFER,f,o.STATIC_DRAW),this._attributesBuffer=Wn(o.createBuffer()),this._register(Ri(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Cl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Cl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Cl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Cl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Cl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Cl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let _=new Int32Array(Ma.maxAtlasPages);for(let g=0;g<Ma.maxAtlasPages;g++)_[g]=g;o.uniform1iv(this._textureLocation,_),o.uniformMatrix4fv(this._projectionLocation,!1,DT),this._atlasTextures=[];for(let g=0;g<Ma.maxAtlasPages;g++){let b=new p8(Wn(o.createTexture()));this._register(Ri(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+g),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[g]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,i,r,o,c,d,f,p){this._updateCell(this._vertices.attributes,t,n,i,r,o,c,d,f,p)}_updateCell(t,n,i,r,o,c,d,f,p,_){if(En=(i*this._terminal.cols+n)*Oa,r===0||r===void 0){t.fill(0,En,En+Oa-1-_8);return}this._atlas&&(f&&f.length>1?un=this._atlas.getRasterizedGlyphCombinedChar(f,o,c,d,!1,this._terminal.element):un=this._atlas.getRasterizedGlyph(r,o,c,d,!1,this._terminal.element),w_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==_&&un.offset.x>w_?(fu=un.offset.x-w_,t[En]=-(un.offset.x-fu)+this._dimensions.device.char.left,t[En+1]=-un.offset.y+this._dimensions.device.char.top,t[En+2]=(un.size.x-fu)/this._dimensions.device.canvas.width,t[En+3]=un.size.y/this._dimensions.device.canvas.height,t[En+4]=un.texturePage,t[En+5]=un.texturePositionClipSpace.x+fu/this._atlas.pages[un.texturePage].canvas.width,t[En+6]=un.texturePositionClipSpace.y,t[En+7]=un.sizeClipSpace.x-fu/this._atlas.pages[un.texturePage].canvas.width,t[En+8]=un.sizeClipSpace.y):(t[En]=-un.offset.x+this._dimensions.device.char.left,t[En+1]=-un.offset.y+this._dimensions.device.char.top,t[En+2]=un.size.x/this._dimensions.device.canvas.width,t[En+3]=un.size.y/this._dimensions.device.canvas.height,t[En+4]=un.texturePage,t[En+5]=un.texturePositionClipSpace.x,t[En+6]=un.texturePositionClipSpace.y,t[En+7]=un.sizeClipSpace.x,t[En+8]=un.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&DI(r,p,un.size.x,this._dimensions.device.cell.width)&&(t[En+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*Oa;this._vertices.count!==n?this._vertices.attributes=new Float32Array(n):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==n?this._vertices.attributesBuffers[i]=new Float32Array(n):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=n,i=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=Oa}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let o=0;o<t.lineLengths.length;o++){let c=o*this._terminal.cols*Oa,d=this._vertices.attributes.subarray(c,c+t.lineLengths[o]*Oa);i.set(d,r),r+=d.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,i.subarray(0,r),n.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(n,this._atlas,o);n.drawElementsInstanced(n.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,r/Oa)}setAtlas(t){this._atlas=t;for(let n of this._atlasTextures)n.version=-1}_bindAtlasPageTexture(t,n,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=n.pages[i].version}setDimensions(t){this._dimensions=t}},y8=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,n,i,r=!1){if(this.selectionStart=n,this.selectionEnd=i,!n||!i||n[0]===i[0]&&n[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,c=n[1]-o,d=i[1]-o,f=Math.max(c,0),p=Math.min(d,t.rows-1);if(f>=t.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=n[0],this.endCol=i[0]}isCellSelected(t,n,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&i>=this.viewportCappedStartRow&&n<this.endCol&&i<=this.viewportCappedEndRow:n<this.startCol&&i>=this.viewportCappedStartRow&&n>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol):!1}};function b8(){return new y8}var Jf=4,xf=1,Cf=2,x_=3,S8=2147483648,w8=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=b8()}resize(t,n){let i=t*n*Jf;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},x8=`#version 300 es
|
|
58
|
-
layout (location = 0) in vec2 a_position;
|
|
59
|
-
layout (location = 1) in vec2 a_size;
|
|
60
|
-
layout (location = 2) in vec4 a_color;
|
|
61
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
62
|
-
|
|
63
|
-
uniform mat4 u_projection;
|
|
64
|
-
|
|
65
|
-
out vec4 v_color;
|
|
66
|
-
|
|
67
|
-
void main() {
|
|
68
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
69
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
70
|
-
v_color = a_color;
|
|
71
|
-
}`,C8=`#version 300 es
|
|
72
|
-
precision lowp float;
|
|
73
|
-
|
|
74
|
-
in vec4 v_color;
|
|
75
|
-
|
|
76
|
-
out vec4 outColor;
|
|
77
|
-
|
|
78
|
-
void main() {
|
|
79
|
-
outColor = v_color;
|
|
80
|
-
}`,qr=8,C_=qr*Float32Array.BYTES_PER_ELEMENT,k8=20*qr,LC=class{constructor(){this.attributes=new Float32Array(k8),this.count=0}},Hr=0,MC=0,OC=0,DC=0,jC=0,IC=0,BC=0,E8=class extends Zs{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new LC,this._verticesCursor=new LC;let r=this._gl;this._program=Wn(jT(r,x8,C8)),this._register(Ri(()=>r.deleteProgram(this._program))),this._projectionLocation=Wn(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),c=r.createBuffer();this._register(Ri(()=>r.deleteBuffer(c))),r.bindBuffer(r.ARRAY_BUFFER,c),r.bufferData(r.ARRAY_BUFFER,o,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),f=r.createBuffer();this._register(Ri(()=>r.deleteBuffer(f))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,f),r.bufferData(r.ELEMENT_ARRAY_BUFFER,d,r.STATIC_DRAW),this._attributesBuffer=Wn(r.createBuffer()),this._register(Ri(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,C_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,C_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,C_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(p=>{this._updateCachedColors(p),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,DT),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,i=1,r,o,c,d,f,p,_,g,b,S,w;for(r=0;r<t.rows;r++){for(c=-1,d=0,f=0,p=!1,o=0;o<t.cols;o++)_=(r*t.cols+o)*Jf,g=e.cells[_+xf],b=e.cells[_+Cf],S=!!(b&67108864),(g!==d||b!==f&&(p||S))&&((d!==0||p&&f!==0)&&(w=i++*qr,this._updateRectangle(n,w,f,d,c,o,r)),c=o,d=g,f=b,p=S);(d!==0||p&&f!==0)&&(w=i++*qr,this._updateRectangle(n,w,f,d,c,t.cols,r))}n.count=i}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style==="block"){t.count=0;return}let i,r=0;(n.style==="bar"||n.style==="outline")&&(i=r++*qr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=r++*qr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=r++*qr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=r++*qr,this._addRectangleFloat(t.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,n,i,r,o,c){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Hr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Hr=(n&16777215)<<8;break;default:Hr=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Hr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Hr=(i&16777215)<<8;break;default:Hr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=f8(e.attributes,this._terminal.rows*this._terminal.cols*qr)),MC=r*this._dimensions.device.cell.width,OC=c*this._dimensions.device.cell.height,DC=(Hr>>24&255)/255,jC=(Hr>>16&255)/255,IC=(Hr>>8&255)/255,BC=1,this._addRectangle(e.attributes,t,MC,OC,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,DC,jC,IC,BC)}_addRectangle(e,t,n,i,r,o,c,d,f,p){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c,e[t+5]=d,e[t+6]=f,e[t+7]=p}_addRectangleFloat(e,t,n,i,r,o,c){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=c[0],e[t+5]=c[1],e[t+6]=c[2],e[t+7]=c[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},T8=class extends Zs{constructor(t,n,i,r,o,c,d,f){super(),this._container=n,this._alpha=o,this._coreBrowserService=c,this._optionsService=d,this._themeService=f,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(t,p),this.reset(t)})),this._register(Ri(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Wn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,i){}handleSelectionChanged(t,n,i,r=!1){}_setTransparency(t,n){if(n===this._alpha)return;let i=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=MT(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,n,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=bT,this._clipCell(i,r,n.getWidth()),this._ctx.fillText(n.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,i){let r=n?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},A8=class extends T8{constructor(t,n,i,r,o,c,d){super(i,t,"link",n,!0,o,c,d),this._register(r.onShowLinkUnderline(f=>this._handleShowLinkUnderline(f))),this._register(r.onHideLinkUnderline(f=>this._handleHideLinkUnderline(f)))}resize(t,n){super.resize(t,n),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&u8(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let n=t.y1+1;n<t.y2;n++)this._fillBottomLineAtCells(0,n,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},ko=typeof window=="object"?window:globalThis,Qv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new dn,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new dn,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Qv.INSTANCE=new Qv;var IT=Qv;function R8(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}IT.INSTANCE.onDidChangeZoomLevel;IT.INSTANCE.onDidChangeFullscreen;var uc=typeof navigator=="object"?navigator.userAgent:"";uc.indexOf("Firefox")>=0;uc.indexOf("AppleWebKit")>=0;var N8=uc.indexOf("Chrome")>=0;!N8&&uc.indexOf("Safari")>=0;uc.indexOf("Electron/")>=0;uc.indexOf("Android")>=0;var k_=!1;if(typeof ko.matchMedia=="function"){let e=ko.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ko.matchMedia("(display-mode: fullscreen)");k_=e.matches,R8(ko,e,({matches:n})=>{k_&&t.matches||(k_=n)})}var zl="en",E_=!1,BT=!1,qd,kf=zl,$C=zl,L8,Ur,No=globalThis,fs;typeof No.vscode<"u"&&typeof No.vscode.process<"u"?fs=No.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(fs=process);var M8=typeof fs?.versions?.electron=="string",O8=M8&&fs?.type==="renderer";if(typeof fs=="object"){fs.platform,fs.platform,E_=fs.platform==="linux",E_&&fs.env.SNAP&&fs.env.SNAP_REVISION,fs.env.CI||fs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qd=zl,kf=zl;let e=fs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);qd=t.userLocale,$C=t.osLocale,kf=t.resolvedLanguage||zl,L8=t.languagePack?.translationsConfigFile}catch{}BT=!0}else typeof navigator=="object"&&!O8?(Ur=navigator.userAgent,Ur.indexOf("Windows")>=0,Ur.indexOf("Macintosh")>=0,(Ur.indexOf("Macintosh")>=0||Ur.indexOf("iPad")>=0||Ur.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,E_=Ur.indexOf("Linux")>=0,Ur?.indexOf("Mobi")>=0,kf=globalThis._VSCODE_NLS_LANGUAGE||zl,qd=navigator.language.toLowerCase(),$C=qd):console.error("Unable to resolve platform.");var PC=BT,gr=Ur,Ea=kf,D8;(e=>{function t(){return Ea}e.value=t;function n(){return Ea.length===2?Ea==="en":Ea.length>=3?Ea[0]==="e"&&Ea[1]==="n"&&Ea[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ea==="en"}e.isDefault=i})(D8||={});var j8=typeof No.postMessage=="function"&&!No.importScripts;(()=>{if(j8){let e=[];No.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),No.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var I8=!!(gr&&gr.indexOf("Chrome")>=0);gr&&gr.indexOf("Firefox")>=0;!I8&&gr&&gr.indexOf("Safari")>=0;gr&&gr.indexOf("Edg/")>=0;gr&&gr.indexOf("Android")>=0;var kl=typeof navigator=="object"?navigator:{};PC||document.queryCommandSupported&&document.queryCommandSupported("copy")||kl&&kl.clipboard&&kl.clipboard.writeText,PC||kl&&kl.clipboard&&kl.clipboard.readText;var r0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},T_=new r0,zC=new r0,HC=new r0;new Array(230);var B8;(e=>{function t(d){return T_.keyCodeToStr(d)}e.toString=t;function n(d){return T_.strToKeyCode(d)}e.fromString=n;function i(d){return zC.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return HC.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return zC.strToKeyCode(d)||HC.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return T_.keyCodeToStr(d)}e.toElectronAccelerator=c})(B8||={});var $T=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),$8;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof P8?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Gr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$T})})($8||={});var P8=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$T:(this._emitter||(this._emitter=new dn),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},z8;(e=>{async function t(i){let r,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(c){o(c)}})}e.withAsyncBody=n})(z8||={});var FC=class Ls{static fromArray(t){return new Ls(n=>{n.emitMany(t)})}static fromPromise(t){return new Ls(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ls(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ls(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new dn,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Gr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ls(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ls.map(this,t)}static filter(t,n){return new Ls(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ls.filter(this,t)}static coalesce(t){return Ls.filter(t,n=>!!n)}coalesce(){return Ls.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ls.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};FC.EMPTY=FC.fromArray([]);var{getWindow:H8}=(function(){let e=new Map,t={window:ko,disposables:new Gl};e.set(ko.vscodeWindowId,t);let n=new dn,i=new dn,r=new dn;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Zs.None;let d=new Gl,f={window:c,disposables:d.add(new Gl)};return e.set(c.vscodeWindowId,f),d.add(Ri(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(ey(c,U8.BEFORE_UNLOAD,()=>{r.fire(c)})),n.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){let d=c;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let f=c;return f?.view?f.view.window:ko},getDocument(c){return H8(c).document}}})(),F8=class{constructor(t,n,i,r){this._node=t,this._type=n,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ey(e,t,n,i){return new F8(e,t,n,i)}var U8={BEFORE_UNLOAD:"beforeunload"},W8=class extends Zs{constructor(t,n,i,r,o,c,d,f,p){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=r,this._coreService=o,this._decorationService=c,this._optionsService=d,this._themeService=f,this._cursorBlinkStateManager=new uu,this._charAtlasDisposable=this._register(new uu),this._observerDisposable=this._register(new uu),this._model=new w8,this._workCell=new RC,this._workCell2=new RC,this._rectangleRenderer=this._register(new uu),this._glyphRenderer=this._register(new uu),this._onChangeTextureAtlas=this._register(new dn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new dn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new dn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new dn),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new dn),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let _={antialias:!1,depth:!1,preserveDrawingBuffer:p};if(this._gl=this._canvas.getContext("webgl2",_),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new BI(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new A8(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=jI(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(ey(this._canvas,"webglcontextlost",g=>{console.log("webglcontextlost event received"),g.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(g)},3e3)})),this._register(ey(this._canvas,"webglcontextrestored",g=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,TC(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=AC(this._canvas,this._coreBrowserService.window,(g,b)=>this._setCanvasDevicePixelDimensions(g,b)),this._register(this._coreBrowserService.onWindowChange(g=>{this._observerDisposable.value=AC(this._canvas,g,(b,S)=>this._setCanvasDevicePixelDimensions(b,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ri(()=>{for(let g of this._renderLayers)g.dispose();this._canvas.parentElement?.removeChild(this._canvas),TC(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,n,i);this._model.selection.update(this._core,t,n,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new E8(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new v8(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=MT(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=mT(Gr.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Gr.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,n){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new h8(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,r=this._workCell,o,c,d,f,p,_,g=0,b=!0,S,w,x,E,D,j,z,T,N;t=UC(t,i.rows-1,0),n=UC(n,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,F=H-i.buffer.ydisp,J=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),pe=-1,G=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let P=!1;for(c=t;c<=n;c++)for(d=c+i.buffer.ydisp,f=i.buffer.lines.get(d),this._model.lineLengths[c]=0,x=H===d,g=0,p=this._characterJoinerService.getJoinedCharacters(d),T=0;T<i.cols;T++){if(o=this._cellColorResolver.result.bg,f.loadCell(T,r),T===0&&(o=this._cellColorResolver.result.bg),_=!1,b=T>=g,S=T,p.length>0&&T===p[0][0]&&b){w=p.shift();let A=this._model.selection.isCellSelected(this._terminal,w[0],d);for(z=w[0]+1;z<w[1];z++)b&&=A===this._model.selection.isCellSelected(this._terminal,z,d);b&&=!x||J<w[0]||J>=w[1],b?(_=!0,r=new q8(r,f.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):g=w[1]}if(E=r.getChars(),D=r.getCode(),z=(c*i.cols+T)*Jf,this._cellColorResolver.resolve(r,T,d,this.dimensions.device.cell.width),G&&d===H&&(T===J&&(this._model.cursor={x:J,y:F,width:r.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},pe=J+r.getWidth()-1),T>=J&&T<=pe&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),D!==0&&(this._model.lineLengths[c]=T+1),!(this._model.cells[z]===D&&this._model.cells[z+xf]===this._cellColorResolver.result.bg&&this._model.cells[z+Cf]===this._cellColorResolver.result.fg&&this._model.cells[z+x_]===this._cellColorResolver.result.ext)&&(P=!0,E.length>1&&(D|=S8),this._model.cells[z]=D,this._model.cells[z+xf]=this._cellColorResolver.result.bg,this._model.cells[z+Cf]=this._cellColorResolver.result.fg,this._model.cells[z+x_]=this._cellColorResolver.result.ext,j=r.getWidth(),this._glyphRenderer.value.updateCell(T,c,D,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,j,o),_)){for(r=this._workCell,T++;T<=S;T++)N=(c*i.cols+T)*Jf,this._glyphRenderer.value.updateCell(T,c,0,0,0,0,AI,0,0),this._model.cells[N]=0,this._model.cells[N+xf]=this._cellColorResolver.result.bg,this._model.cells[N+Cf]=this._cellColorResolver.result.fg,this._model.cells[N+x_]=this._cellColorResolver.result.ext;T--}}P&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},q8=class extends Pl{constructor(t,n,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function UC(e,t,n=0){return Math.max(Math.min(e,t),n)}var WC="di$target",qC="di$dependencies",A_=new Map;function br(e){if(A_.has(e))return A_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");G8(t,n,r)};return t._id=e,A_.set(e,t),t}function G8(e,t,n){t[WC]===t?t[qC].push({id:e,index:n}):(t[qC]=[{id:e,index:n}],t[WC]=t)}br("BufferService");br("CoreMouseService");br("CoreService");br("CharsetService");br("InstantiationService");br("LogService");var K8=br("OptionsService");br("OscLinkService");br("UnicodeService");br("DecorationService");var V8={trace:0,debug:1,info:2,warn:3,error:4,off:5},Y8="xterm.js: ",GC=class extends Zs{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=V8[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":Y8)+n,...i)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};GC=gI([_I(0,K8)],GC);var X8=class extends Zs{constructor(t){if(vT&&TI()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new dn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new dn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new dn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new dn),this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=n.coreService,r=n.optionsService,o=n,c=o._renderService,d=o._characterJoinerService,f=o._charSizeService,p=o._coreBrowserService,_=o._decorationService;o._logService;let g=o._themeService;this._renderer=this._register(new W8(t,d,f,p,i,_,r,g,this._preserveDrawingBuffer)),this._register(Gr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Gr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Gr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Gr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Ri(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var PT=Object.defineProperty,Z8=Object.getOwnPropertyDescriptor,J8=(e,t)=>{for(var n in t)PT(e,n,{get:t[n],enumerable:!0})},Ln=(e,t,n,i)=>{for(var r=i>1?void 0:i?Z8(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(r=(i?c(t,n,r):c(r))||r);return i&&r&&PT(t,n,r),r},Ie=(e,t)=>(n,i)=>t(n,i,e),KC="Terminal input",ty={get:()=>KC,set:e=>KC=e},VC="Too much output to announce, navigate to rows manually to read",ny={get:()=>VC,set:e=>VC=e};function Q8(e){return e.replace(/\r?\n/g,"\r")}function e7(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function t7(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function n7(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");zT(r,t,n,i)}}function zT(e,t,n,i){e=Q8(e),e=e7(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function HT(e,t,n){let i=n.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function YC(e,t,n,i,r){HT(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function ja(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Lp(e,t=0,n=e.length){let i="";for(let r=t;r<n;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var i7=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(c-55296)*1024+d-56320+65536:(t[i++]=c,t[i++]=d);continue}c!==65279&&(t[i++]=c)}return i}},s7=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r,o,c,d,f=0,p=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,x;for(;(x=this.interim[++w]&63)&&w<4;)S<<=6,S|=x;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=E-w;for(;p<D;){if(p>=n)return 0;if(x=e[p++],(x&192)!==128){p--,b=!0;break}else this.interim[w++]=x,S<<=6,S|=x&63}b||(E===2?S<128?p--:t[i++]=S:E===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let _=n-4,g=p;for(;g<n;){for(;g<_&&!((r=e[g])&128)&&!((o=e[g+1])&128)&&!((c=e[g+2])&128)&&!((d=e[g+3])&128);)t[i++]=r,t[i++]=o,t[i++]=c,t[i++]=d,g+=4;if(r=e[g++],r<128)t[i++]=r;else if((r&224)===192){if(g>=n)return this.interim[0]=r,i;if(o=e[g++],(o&192)!==128){g--;continue}if(f=(r&31)<<6|o&63,f<128){g--;continue}t[i++]=f}else if((r&240)===224){if(g>=n)return this.interim[0]=r,i;if(o=e[g++],(o&192)!==128){g--;continue}if(g>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[g++],(c&192)!==128){g--;continue}if(f=(r&15)<<12|(o&63)<<6|c&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[i++]=f}else if((r&248)===240){if(g>=n)return this.interim[0]=r,i;if(o=e[g++],(o&192)!==128){g--;continue}if(g>=n)return this.interim[0]=r,this.interim[1]=o,i;if(c=e[g++],(c&192)!==128){g--;continue}if(g>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=c,i;if(d=e[g++],(d&192)!==128){g--;continue}if(f=(r&7)<<18|(o&63)<<12|(c&63)<<6|d&63,f<65536||f>1114111)continue;t[i++]=f}}return i}},FT="",$a=" ",Sh=class UT{constructor(){this.fg=0,this.bg=0,this.extended=new Qf}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new UT;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Qf=class WT{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new WT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Bs=class qT extends Sh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Qf,this.combinedData=""}static fromCharData(t){let n=new qT;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ja(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},XC="di$target",iy="di$dependencies",R_=new Map;function r7(e){return e[iy]||[]}function fi(e){if(R_.has(e))return R_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");a7(t,n,r)};return t._id=e,R_.set(e,t),t}function a7(e,t,n){t[XC]===t?t[iy].push({id:e,index:n}):(t[iy]=[{id:e,index:n}],t[XC]=t)}var Hi=fi("BufferService"),GT=fi("CoreMouseService"),Uo=fi("CoreService"),o7=fi("CharsetService"),a0=fi("InstantiationService"),KT=fi("LogService"),Fi=fi("OptionsService"),VT=fi("OscLinkService"),l7=fi("UnicodeService"),wh=fi("DecorationService"),sy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Bs,c=n.getTrimmedLength(),d=-1,f=-1,p=!1;for(let _=0;_<c;_++)if(!(f===-1&&!n.hasContent(_))){if(n.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(f===-1){f=_,d=o.extended.urlId;continue}else p=o.extended.urlId!==d;else f!==-1&&(p=!0);if(p||f!==-1&&_===c-1){let g=this._oscLinkService.getLinkData(d)?.uri;if(g){let b={start:{x:f+1,y:e},end:{x:_+(!p&&_===c-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:g,range:b,activate:(w,x)=>r?r.activate(w,x,b):c7(w,x),hover:(w,x)=>r?.hover?.(w,x,b),leave:(w,x)=>r?.leave?.(w,x,b)})}p=!1,o.hasExtendedAttrs()&&o.extended.urlId?(f=_,d=o.extended.urlId):(f=-1,d=-1)}}t(i)}};sy=Ln([Ie(0,Hi),Ie(1,Fi),Ie(2,VT)],sy);function c7(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
81
|
-
|
|
82
|
-
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Mp=fi("CharSizeService"),Jr=fi("CoreBrowserService"),o0=fi("MouseService"),Qr=fi("RenderService"),u7=fi("SelectionService"),YT=fi("CharacterJoinerService"),hc=fi("ThemeService"),XT=fi("LinkProviderService"),h7=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ZC.isErrorNoTelemetry(e)?new ZC(e.message+`
|
|
83
|
-
|
|
84
|
-
`+e.stack):new Error(e.message+`
|
|
85
|
-
|
|
86
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},d7=new h7;function Ef(e){f7(e)||d7.onUnexpectedError(e)}var ry="Canceled";function f7(e){return e instanceof p7?!0:e instanceof Error&&e.name===ry&&e.message===ry}var p7=class extends Error{constructor(){super(ry),this.name=this.message}};function m7(e){return new Error(`Illegal argument: ${e}`)}var ZC=class ay extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ay)return t;let n=new ay;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},oy=class ZT extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,ZT.prototype)}};function hs(e,t=0){return e[e.length-(1+t)]}var g7;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(g7||={});function _7(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var JT;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(T){yield T}e.single=r;function o(T){return t(T)?T:r(T)}e.wrap=o;function c(T){return T||n}e.from=c;function*d(T){for(let N=T.length-1;N>=0;N--)yield T[N]}e.reverse=d;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(T){return T[Symbol.iterator]().next().value}e.first=p;function _(T,N){let L=0;for(let H of T)if(N(H,L++))return!0;return!1}e.some=_;function g(T,N){for(let L of T)if(N(L))return L}e.find=g;function*b(T,N){for(let L of T)N(L)&&(yield L)}e.filter=b;function*S(T,N){let L=0;for(let H of T)yield N(H,L++)}e.map=S;function*w(T,N){let L=0;for(let H of T)yield*N(H,L++)}e.flatMap=w;function*x(...T){for(let N of T)yield*N}e.concat=x;function E(T,N,L){let H=L;for(let F of T)H=N(H,F);return H}e.reduce=E;function*D(T,N,L=T.length){for(N<0&&(N+=T.length),L<0?L+=T.length:L>T.length&&(L=T.length);N<L;N++)yield T[N]}e.slice=D;function j(T,N=Number.POSITIVE_INFINITY){let L=[];if(N===0)return[L,T];let H=T[Symbol.iterator]();for(let F=0;F<N;F++){let J=H.next();if(J.done)return[L,e.empty()];L.push(J.value)}return[L,{[Symbol.iterator](){return H}}]}e.consume=j;async function z(T){let N=[];for await(let L of T)N.push(L);return Promise.resolve(N)}e.asyncToArray=z})(JT||={});function $o(e){if(JT.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function v7(...e){return yn(()=>$o(e))}function yn(e){return{dispose:_7(()=>{e()})}}var QT=class eA{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{$o(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?eA.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};QT.DISABLE_DISPOSED_WARNING=!1;var Ha=QT,yt=class{constructor(){this._store=new Ha,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};yt.None=Object.freeze({dispose(){}});var Ql=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Kr=typeof window=="object"?window:globalThis,ly=class cy{constructor(t){this.element=t,this.next=cy.Undefined,this.prev=cy.Undefined}};ly.Undefined=new ly(void 0);var Sn=ly,JC=class{constructor(){this._first=Sn.Undefined,this._last=Sn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Sn.Undefined}clear(){let e=this._first;for(;e!==Sn.Undefined;){let t=e.next;e.prev=Sn.Undefined,e.next=Sn.Undefined,e=t}this._first=Sn.Undefined,this._last=Sn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Sn(e);if(this._first===Sn.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==Sn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Sn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Sn.Undefined&&e.next!==Sn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Sn.Undefined&&e.next===Sn.Undefined?(this._first=Sn.Undefined,this._last=Sn.Undefined):e.next===Sn.Undefined?(this._last=this._last.prev,this._last.next=Sn.Undefined):e.prev===Sn.Undefined&&(this._first=this._first.next,this._first.prev=Sn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Sn.Undefined;)yield e.element,e=e.next}},y7=globalThis.performance&&typeof globalThis.performance.now=="function",b7=class tA{static create(t){return new tA(t)}constructor(t){this._now=y7&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},wi;(e=>{e.None=()=>yt.None;function t(P,A){return g(P,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(P){return(A,$=null,M)=>{let k=!1,B;return B=P(O=>{if(!k)return B?B.dispose():k=!0,A.call($,O)},null,M),k&&B.dispose(),B}}e.once=n;function i(P,A,$){return p((M,k=null,B)=>P(O=>M.call(k,A(O)),null,B),$)}e.map=i;function r(P,A,$){return p((M,k=null,B)=>P(O=>{A(O),M.call(k,O)},null,B),$)}e.forEach=r;function o(P,A,$){return p((M,k=null,B)=>P(O=>A(O)&&M.call(k,O),null,B),$)}e.filter=o;function c(P){return P}e.signal=c;function d(...P){return(A,$=null,M)=>{let k=v7(...P.map(B=>B(O=>A.call($,O))));return _(k,M)}}e.any=d;function f(P,A,$,M){let k=$;return i(P,B=>(k=A(k,B),k),M)}e.reduce=f;function p(P,A){let $,M={onWillAddFirstListener(){$=P(k.fire,k)},onDidRemoveLastListener(){$?.dispose()}},k=new Ce(M);return A?.add(k),k.event}function _(P,A){return A instanceof Array?A.push(P):A&&A.add(P),P}function g(P,A,$=100,M=!1,k=!1,B,O){let W,U,R,Y=0,Z,me={leakWarningThreshold:B,onWillAddFirstListener(){W=P(oe=>{Y++,U=A(U,oe),M&&!R&&(ue.fire(U),U=void 0),Z=()=>{let ke=U;U=void 0,R=void 0,(!M||Y>1)&&ue.fire(ke),Y=0},typeof $=="number"?(clearTimeout(R),R=setTimeout(Z,$)):R===void 0&&(R=0,queueMicrotask(Z))})},onWillRemoveListener(){k&&Y>0&&Z?.()},onDidRemoveLastListener(){Z=void 0,W.dispose()}},ue=new Ce(me);return O?.add(ue),ue.event}e.debounce=g;function b(P,A=0,$){return e.debounce(P,(M,k)=>M?(M.push(k),M):[k],A,void 0,!0,void 0,$)}e.accumulate=b;function S(P,A=(M,k)=>M===k,$){let M=!0,k;return o(P,B=>{let O=M||!A(B,k);return M=!1,k=B,O},$)}e.latch=S;function w(P,A,$){return[e.filter(P,A,$),e.filter(P,M=>!A(M),$)]}e.split=w;function x(P,A=!1,$=[],M){let k=$.slice(),B=P(U=>{k?k.push(U):W.fire(U)});M&&M.add(B);let O=()=>{k?.forEach(U=>W.fire(U)),k=null},W=new Ce({onWillAddFirstListener(){B||(B=P(U=>W.fire(U)),M&&M.add(B))},onDidAddFirstListener(){k&&(A?setTimeout(O):O())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return M&&M.add(W),W.event}e.buffer=x;function E(P,A){return($,M,k)=>{let B=A(new j);return P(function(O){let W=B.evaluate(O);W!==D&&$.call(M,W)},void 0,k)}}e.chain=E;let D=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push($=>(A($),$)),this}filter(A){return this.steps.push($=>A($)?$:D),this}reduce(A,$){let M=$;return this.steps.push(k=>(M=A(M,k),M)),this}latch(A=($,M)=>$===M){let $=!0,M;return this.steps.push(k=>{let B=$||!A(k,M);return $=!1,M=k,B?k:D}),this}evaluate(A){for(let $ of this.steps)if(A=$(A),A===D)break;return A}}function z(P,A,$=M=>M){let M=(...W)=>O.fire($(...W)),k=()=>P.on(A,M),B=()=>P.removeListener(A,M),O=new Ce({onWillAddFirstListener:k,onDidRemoveLastListener:B});return O.event}e.fromNodeEventEmitter=z;function T(P,A,$=M=>M){let M=(...W)=>O.fire($(...W)),k=()=>P.addEventListener(A,M),B=()=>P.removeEventListener(A,M),O=new Ce({onWillAddFirstListener:k,onDidRemoveLastListener:B});return O.event}e.fromDOMEventEmitter=T;function N(P){return new Promise(A=>n(P)(A))}e.toPromise=N;function L(P){let A=new Ce;return P.then($=>{A.fire($)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=L;function H(P,A){return P($=>A.fire($))}e.forward=H;function F(P,A,$){return A($),P(M=>A(M))}e.runAndSubscribe=F;class J{constructor(A,$){this._observable=A,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new Ce(M),$&&$.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,$){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function pe(P,A){return new J(P,A).emitter.event}e.fromObservable=pe;function G(P){return(A,$,M)=>{let k=0,B=!1,O={beginUpdate(){k++},endUpdate(){k--,k===0&&(P.reportChanges(),B&&(B=!1,A.call($)))},handlePossibleChange(){},handleChange(){B=!0}};P.addObserver(O),P.reportChanges();let W={dispose(){P.removeObserver(O)}};return M instanceof Ha?M.add(W):Array.isArray(M)&&M.push(W),W}}e.fromObservableLight=G})(wi||={});var uy=class hy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${hy._idPool++}`,hy.all.add(this)}start(t){this._stopWatch=new b7,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};uy.all=new Set,uy._idPool=0;var S7=uy,w7=-1,nA=class iA{constructor(t,n,i=(iA._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(o);let f=new k7(d,o);this._errorHandler(f)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};nA._idPool=1;var x7=nA,C7=class sA{constructor(t){this.value=t}static create(){let t=new Error;return new sA(t.stack??"")}print(){console.warn(this.value.split(`
|
|
87
|
-
`).slice(2).join(`
|
|
88
|
-
`))}},k7=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},E7=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},T7=0,N_=class{constructor(e){this.value=e,this.id=T7++}},A7=2,R7,Ce=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new x7(t?.onListenerError??Ef,this._options?.leakWarningThreshold??w7):void 0,this._perfMon=this._options?._profName?new S7(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new E7(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Ef)(p),yt.None}if(this._disposed)return yt.None;n&&(t=t.bind(n));let r=new N_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=C7.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof N_?(this._deliveryQueue??=new N7,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=yn(()=>{o?.(),this._removeListener(r)});return i instanceof Ha?i.add(c):Array.isArray(i)&&i.push(c),c},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*A7<=n.length){let o=0;for(let c=0;c<n.length;c++)n[c]?n[o++]=n[c]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||Ef;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof N_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},N7=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},dy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Ce,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Ce,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};dy.INSTANCE=new dy;var l0=dy;function L7(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}l0.INSTANCE.onDidChangeZoomLevel;function M7(e){return l0.INSTANCE.getZoomFactor(e)}l0.INSTANCE.onDidChangeFullscreen;var dc=typeof navigator=="object"?navigator.userAgent:"",fy=dc.indexOf("Firefox")>=0,O7=dc.indexOf("AppleWebKit")>=0,c0=dc.indexOf("Chrome")>=0,D7=!c0&&dc.indexOf("Safari")>=0;dc.indexOf("Electron/")>=0;dc.indexOf("Android")>=0;var L_=!1;if(typeof Kr.matchMedia=="function"){let e=Kr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Kr.matchMedia("(display-mode: fullscreen)");L_=e.matches,L7(Kr,e,({matches:n})=>{L_&&t.matches||(L_=n)})}var Hl="en",py=!1,my=!1,Tf=!1,rA=!1,Gd,Af=Hl,QC=Hl,j7,Wr,Lo=globalThis,ps;typeof Lo.vscode<"u"&&typeof Lo.vscode.process<"u"?ps=Lo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ps=process);var I7=typeof ps?.versions?.electron=="string",B7=I7&&ps?.type==="renderer";if(typeof ps=="object"){py=ps.platform==="win32",my=ps.platform==="darwin",Tf=ps.platform==="linux",Tf&&ps.env.SNAP&&ps.env.SNAP_REVISION,ps.env.CI||ps.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Gd=Hl,Af=Hl;let e=ps.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Gd=t.userLocale,QC=t.osLocale,Af=t.resolvedLanguage||Hl,j7=t.languagePack?.translationsConfigFile}catch{}rA=!0}else typeof navigator=="object"&&!B7?(Wr=navigator.userAgent,py=Wr.indexOf("Windows")>=0,my=Wr.indexOf("Macintosh")>=0,(Wr.indexOf("Macintosh")>=0||Wr.indexOf("iPad")>=0||Wr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Tf=Wr.indexOf("Linux")>=0,Wr?.indexOf("Mobi")>=0,Af=globalThis._VSCODE_NLS_LANGUAGE||Hl,Gd=navigator.language.toLowerCase(),QC=Gd):console.error("Unable to resolve platform.");var aA=py,fr=my,$7=Tf,ek=rA,_r=Wr,Ta=Af,P7;(e=>{function t(){return Ta}e.value=t;function n(){return Ta.length===2?Ta==="en":Ta.length>=3?Ta[0]==="e"&&Ta[1]==="n"&&Ta[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ta==="en"}e.isDefault=i})(P7||={});var z7=typeof Lo.postMessage=="function"&&!Lo.importScripts;(()=>{if(z7){let e=[];Lo.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),Lo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var H7=!!(_r&&_r.indexOf("Chrome")>=0);_r&&_r.indexOf("Firefox")>=0;!H7&&_r&&_r.indexOf("Safari")>=0;_r&&_r.indexOf("Edg/")>=0;_r&&_r.indexOf("Android")>=0;var El=typeof navigator=="object"?navigator:{};ek||document.queryCommandSupported&&document.queryCommandSupported("copy")||El&&El.clipboard&&El.clipboard.writeText,ek||El&&El.clipboard&&El.clipboard.readText;var u0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},M_=new u0,tk=new u0,nk=new u0,F7=new Array(230),oA;(e=>{function t(d){return M_.keyCodeToStr(d)}e.toString=t;function n(d){return M_.strToKeyCode(d)}e.fromString=n;function i(d){return tk.keyCodeToStr(d)}e.toUserSettingsUS=i;function r(d){return nk.keyCodeToStr(d)}e.toUserSettingsGeneral=r;function o(d){return tk.strToKeyCode(d)||nk.strToKeyCode(d)}e.fromUserSettings=o;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return M_.keyCodeToStr(d)}e.toElectronAccelerator=c})(oA||={});var U7=class lA{constructor(t,n,i,r,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof lA&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new W7([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},W7=class{constructor(e){if(e.length===0)throw m7("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function q7(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return oA.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(fy)switch(t){case 59:return 85;case 60:if($7)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(fr)return 57;break}else if(O7&&(fr&&t===93||!fr&&t===92))return 57;return F7[t]||0}var G7=fr?256:2048,K7=512,V7=1024,Y7=fr?2048:256,ik=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=q7(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=G7),this.altKey&&(t|=K7),this.shiftKey&&(t|=V7),this.metaKey&&(t|=Y7),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new U7(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},sk=new WeakMap;function X7(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Z7=class{static getSameOriginWindowChain(e){let t=sk.get(e);if(!t){t=[],sk.set(e,t);let n=e,i;do i=X7(n),i?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=i;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let c=o.window.deref();if(n+=c?.scrollY??0,i+=c?.scrollX??0,c===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();n+=d.top,i+=d.left}return{top:n,left:i}}},Kd=class{constructor(t,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=Z7.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},rk=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let i=!1;if(c0){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,c=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*c):this.deltaY=r.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?fy&&!fr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")D7&&aA?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*c):this.deltaX=r.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?fy&&!fr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},cA=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),J7;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Q7?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:wi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:cA})})(J7||={});var Q7=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?cA:(this._emitter||(this._emitter=new Ce),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},h0=class{constructor(t,n){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof n=="number"&&this.setIfNotSet(t,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,n){if(this._isDisposed)throw new oy("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new oy("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},eB=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new oy("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=yn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},tB;(e=>{async function t(i){let r,o=await Promise.all(i.map(c=>c.then(d=>d,d=>{r||(r=d)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(c){o(c)}})}e.withAsyncBody=n})(tB||={});var ak=class Ms{static fromArray(t){return new Ms(n=>{n.emitMany(t)})}static fromPromise(t){return new Ms(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ms(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ms(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Ce,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await wi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ms(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ms.map(this,t)}static filter(t,n){return new Ms(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ms.filter(this,t)}static coalesce(t){return Ms.filter(t,n=>!!n)}coalesce(){return Ms.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ms.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};ak.EMPTY=ak.fromArray([]);var{getWindow:dr,getWindowId:nB,onDidRegisterWindow:iB}=(function(){let e=new Map,t={window:Kr,disposables:new Ha};e.set(Kr.vscodeWindowId,t);let n=new Ce,i=new Ce,r=new Ce;function o(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return yt.None;let d=new Ha,f={window:c,disposables:d.add(new Ha)};return e.set(c.vscodeWindowId,f),d.add(yn(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),d.add(at(c,si.BEFORE_UNLOAD,()=>{r.fire(c)})),n.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){let d=c;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let f=c;return f?.view?f.view.window:Kr},getDocument(c){return dr(c).document}}})(),sB=class{constructor(e,t,n,i){this._node=e,this._type=t,this._handler=n,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function at(e,t,n,i){return new sB(e,t,n,i)}var ok=function(e,t,n,i){return at(e,t,n,i)},d0,rB=class extends eB{constructor(e){super(),this.defaultTarget=e&&dr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},lk=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ef(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,r=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),i.set(o,!0);c.length>0;)c.sort(lk.sort),c.shift().execute();i.set(o,!1)};d0=(o,c,d=0)=>{let f=nB(o),p=new lk(c,d),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(p),n.get(f)||(n.set(f,!0),o.requestAnimationFrame(()=>r(f))),p}})();function aB(e){let t=e.getBoundingClientRect(),n=dr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var si={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},oB=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Zi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Zi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Zi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Zi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Zi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Zi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Zi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Zi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Zi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Zi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Zi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Zi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Zi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Zi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Zi(e){return typeof e=="number"?`${e}px`:e}function Yu(e){return new oB(e)}var uA=class{constructor(){this._hooks=new Ha,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(yn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=dr(e)}this._hooks.add(at(o,si.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(at(o,si.POINTER_UP,c=>this.stopMonitoring(!0)))}};function lB(e,t,n){let i=null,r=null;if(typeof n.value=="function"?(i="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",r=n.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;n[i]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,c)}),this[o]}}var cr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(cr||={});var Iu=class Ti extends yt{constructor(){super(),this.dispatched=!1,this.targets=new JC,this.ignoreTargets=new JC,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(wi.runAndSubscribe(iB,({window:t,disposables:n})=>{n.add(at(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(at(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(at(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Kr,disposables:this._store}))}static addTarget(t){if(!Ti.isTouchDevice())return yt.None;Ti.INSTANCE||(Ti.INSTANCE=new Ti);let n=Ti.INSTANCE.targets.push(t);return yn(n)}static ignoreTarget(t){if(!Ti.isTouchDevice())return yt.None;Ti.INSTANCE||(Ti.INSTANCE=new Ti);let n=Ti.INSTANCE.ignoreTargets.push(t);return yn(n)}static isTouchDevice(){return"ontouchstart"in Kr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(cr.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let d=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let f=this.activeTouches[d.identifier],p=Date.now()-f.initialTimeStamp;if(p<Ti.HOLD_DELAY&&Math.abs(f.initialPageX-hs(f.rollingPageX))<30&&Math.abs(f.initialPageY-hs(f.rollingPageY))<30){let _=this.newGestureEvent(cr.Tap,f.initialTarget);_.pageX=hs(f.rollingPageX),_.pageY=hs(f.rollingPageY),this.dispatchEvent(_)}else if(p>=Ti.HOLD_DELAY&&Math.abs(f.initialPageX-hs(f.rollingPageX))<30&&Math.abs(f.initialPageY-hs(f.rollingPageY))<30){let _=this.newGestureEvent(cr.Contextmenu,f.initialTarget);_.pageX=hs(f.rollingPageX),_.pageY=hs(f.rollingPageY),this.dispatchEvent(_)}else if(r===1){let _=hs(f.rollingPageX),g=hs(f.rollingPageY),b=hs(f.rollingTimestamps)-f.rollingTimestamps[0],S=_-f.rollingPageX[0],w=g-f.rollingPageY[0],x=[...this.targets].filter(E=>f.initialTarget instanceof Node&&E.contains(f.initialTarget));this.inertia(t,x,i,Math.abs(S)/b,S>0?1:-1,_,Math.abs(w)/b,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(cr.End,f.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=n,i.tapCount=0,i}dispatchEvent(t){if(t.type===cr.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Ti.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===cr.Change||t.type===cr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let n=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;n.push([r,i])}n.sort((i,r)=>i[0]-r[0]);for(let[i,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,r,o,c,d,f,p){this.handle=d0(t,()=>{let _=Date.now(),g=_-i,b=0,S=0,w=!0;r+=Ti.SCROLL_FRICTION*g,d+=Ti.SCROLL_FRICTION*g,r>0&&(w=!1,b=o*r*g),d>0&&(w=!1,S=f*d*g);let x=this.newGestureEvent(cr.Change);x.translationX=b,x.translationY=S,n.forEach(E=>E.dispatchEvent(x)),w||this.inertia(t,n,_,r,o,c+b,d,f,p+S)})}onTouchMove(t){let n=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],d=this.newGestureEvent(cr.Change,c.initialTarget);d.translationX=o.pageX-hs(c.rollingPageX),d.translationY=o.pageY-hs(c.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Iu.SCROLL_FRICTION=-.005,Iu.HOLD_DELAY=700,Iu.CLEAR_TAP_COUNT_TIME=400,Ln([lB],Iu,"isTouchDevice",1);var cB=Iu,f0=class extends yt{onclick(e,t){this._register(at(e,si.CLICK,n=>t(new Kd(dr(e),n))))}onmousedown(e,t){this._register(at(e,si.MOUSE_DOWN,n=>t(new Kd(dr(e),n))))}onmouseover(e,t){this._register(at(e,si.MOUSE_OVER,n=>t(new Kd(dr(e),n))))}onmouseleave(e,t){this._register(at(e,si.MOUSE_LEAVE,n=>t(new Kd(dr(e),n))))}onkeydown(e,t){this._register(at(e,si.KEY_DOWN,n=>t(new ik(n))))}onkeyup(e,t){this._register(at(e,si.KEY_UP,n=>t(new ik(n))))}oninput(e,t){this._register(at(e,si.INPUT,t))}onblur(e,t){this._register(at(e,si.BLUR,t))}onfocus(e,t){this._register(at(e,si.FOCUS,t))}onchange(e,t){this._register(at(e,si.CHANGE,t))}ignoreGesture(e){return cB.ignoreTarget(e)}},ck=11,uB=class extends f0{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=ck+"px",this.domNode.style.height=ck+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new uA),this._register(ok(this.bgDomNode,si.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(ok(this.domNode,si.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new rB),this._pointerdownScheduleRepeatTimer=this._register(new h0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,dr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},hB=class gy{constructor(t,n,i,r,o,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,r=r|0,o=o|0,c=c|0,d=d|0),this.rawScrollLeft=r,this.rawScrollTop=d,n<0&&(n=0),r+n>i&&(r=i-n),r<0&&(r=0),o<0&&(o=0),d+o>c&&(d=c-o),d<0&&(d=0),this.width=n,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=c,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new gy(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new gy(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:f}}},dB=class extends yt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new hB(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let i;t?i=new hk(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=hk.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},uk=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function O_(e,t){let n=t-e;return function(i){return e+n*mB(i)}}function fB(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var hk=class _y{constructor(t,n,i,r){this.from=t,this.to=n,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,i){if(Math.abs(t-n)>2.5*i){let r,o;return t<n?(r=t+.75*i,o=n-.75*i):(r=t-.75*i,o=n+.75*i),fB(O_(t,r),O_(o,n),.33)}return O_(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let i=this.scrollLeft(n),r=this.scrollTop(n);return new uk(i,r,!1)}return new uk(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return _y.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new _y(t,n,r,i)}};function pB(e){return Math.pow(e,3)}function mB(e){return 1-pB(1-e)}var gB=class extends yt{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new h0)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},_B=140,hA=class extends f0{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new gB(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new uA),this._shouldRender=!0,this.domNode=Yu(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(at(this.domNode.domNode,si.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new uB(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=Yu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(at(this.slider.domNode,si.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let r=aB(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),c=Math.abs(o-n);if(aA&&c>_B){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},dA=class vy{constructor(t,n,i,r,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new vy(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,i,r,o){let c=Math.max(0,i-t),d=Math.max(0,c-2*n),f=r>0&&r>i;if(!f)return{computedAvailableSize:Math.round(c),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(i*d/r))),_=(d-p)/(r-i),g=o*_;return{computedAvailableSize:Math.round(c),computedIsNeeded:f,computedSliderSize:Math.round(p),computedSliderRatio:_,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=vy._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,i=this._scrollPosition;return n<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},vB=class extends hA{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dA(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},yB=class extends hA{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dA(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},bB=500,dk=50,SB=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},yy=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,n+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(c0){let n=dr(t.browserEvent),i=M7(n);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,i){let r=null,o=new SB(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),n){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),d=Math.abs(n.deltaY),f=Math.max(Math.min(r,c),1),p=Math.max(Math.min(o,d),1),_=Math.max(r,c),g=Math.max(o,d);_%f===0&&g%p===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};yy.INSTANCE=new yy;var wB=yy,xB=class extends f0{constructor(e,t,n){super(),this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Ce),this.onWillScroll=this._onWillScroll.event,this._options=kB(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new yB(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new vB(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Yu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Yu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Yu(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new h0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=$o(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,fr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new rk(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=$o(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new rk(n))};this._mouseWheelToDispose.push(at(this._listenOnDomNode,si.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=wB.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let c=!fr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||c)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),f={};if(r){let p=dk*r,_=d.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(f,_)}if(o){let p=dk*o,_=d.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(f,_)}f=this._scrollable.validateScrollPosition(f),(d.scrollLeft!==f.scrollLeft||d.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),n=!0)}let i=n;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,i=n?" left":"",r=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),bB)}},CB=class extends xB{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function kB(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,fr&&(t.className+=" mac"),t}var by=class extends yt{constructor(e,t,n,i,r,o,c,d){super(),this._bufferService=n,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new Ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new dB({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>d0(i.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new CB(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(wi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(yn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(yn(()=>this._styleElement.remove())),this._register(wi.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
89
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(p=>this._handleScroll(p)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};by=Ln([Ie(2,Hi),Ie(3,Jr),Ie(4,GT),Ie(5,hc),Ie(6,Fi),Ie(7,Qr)],by);var Sy=class extends yt{constructor(e,t,n,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(yn(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Sy=Ln([Ie(1,Hi),Ie(2,Jr),Ie(3,wh),Ie(4,Qr)],Sy);var EB=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},or={full:0,left:0,center:0,right:0},Aa={full:0,left:0,center:0,right:0},pu={full:0,left:0,center:0,right:0},ep=class extends yt{constructor(e,t,n,i,r,o,c,d){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new EB,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(yn(()=>this._canvas?.remove()));let f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Aa.full=this._canvas.width,Aa.left=e,Aa.center=t,Aa.right=e,this._refreshDrawHeightConstants(),pu.full=1,pu.left=1,pu.center=1+Aa.left,pu.right=1+Aa.left+Aa.center}_refreshDrawHeightConstants(){or.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);or.left=t,or.center=t,or.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*or.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(pu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-or[e.position||"full"]/2),Aa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+or[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ep=Ln([Ie(2,Hi),Ie(3,wh),Ie(4,Qr),Ie(5,Fi),Ie(6,hc),Ie(7,Jr)],ep);var ve;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
90
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ve||={});var Rf;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Rf||={});var fA;(e=>e.ST=`${ve.ESC}\\`)(fA||={});var wy=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ve.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wy=Ln([Ie(2,Hi),Ie(3,Fi),Ie(4,Uo),Ie(5,Qr)],wy);var li=0,ci=0,ui=0,Nn=0,fk={css:"#00000000",rgba:0},qn;(e=>{function t(r,o,c,d){return d!==void 0?`#${vo(r)}${vo(o)}${vo(c)}${vo(d)}`:`#${vo(r)}${vo(o)}${vo(c)}`}e.toCss=t;function n(r,o,c,d=255){return(r<<24|o<<16|c<<8|d)>>>0}e.toRgba=n;function i(r,o,c,d){return{css:e.toCss(r,o,c,d),rgba:e.toRgba(r,o,c,d)}}e.toColor=i})(qn||={});var hn;(e=>{function t(f,p){if(Nn=(p.rgba&255)/255,Nn===1)return{css:p.css,rgba:p.rgba};let _=p.rgba>>24&255,g=p.rgba>>16&255,b=p.rgba>>8&255,S=f.rgba>>24&255,w=f.rgba>>16&255,x=f.rgba>>8&255;li=S+Math.round((_-S)*Nn),ci=w+Math.round((g-w)*Nn),ui=x+Math.round((b-x)*Nn);let E=qn.toCss(li,ci,ui),D=qn.toRgba(li,ci,ui);return{css:E,rgba:D}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,_){let g=Nf.ensureContrastRatio(f.rgba,p.rgba,_);if(g)return qn.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=i;function r(f){let p=(f.rgba|255)>>>0;return[li,ci,ui]=Nf.toChannels(p),{css:qn.toCss(li,ci,ui),rgba:p}}e.opaque=r;function o(f,p){return Nn=Math.round(p*255),[li,ci,ui]=Nf.toChannels(f.rgba),{css:qn.toCss(li,ci,ui,Nn),rgba:qn.toRgba(li,ci,ui,Nn)}}e.opacity=o;function c(f,p){return Nn=f.rgba&255,o(f,Nn*p/255)}e.multiplyOpacity=c;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(hn||={});var wn;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return li=parseInt(r.slice(1,2).repeat(2),16),ci=parseInt(r.slice(2,3).repeat(2),16),ui=parseInt(r.slice(3,4).repeat(2),16),qn.toColor(li,ci,ui);case 5:return li=parseInt(r.slice(1,2).repeat(2),16),ci=parseInt(r.slice(2,3).repeat(2),16),ui=parseInt(r.slice(3,4).repeat(2),16),Nn=parseInt(r.slice(4,5).repeat(2),16),qn.toColor(li,ci,ui,Nn);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return li=parseInt(o[1]),ci=parseInt(o[2]),ui=parseInt(o[3]),Nn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),qn.toColor(li,ci,ui,Nn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[li,ci,ui,Nn]=t.getImageData(0,0,1,1).data,Nn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qn.toRgba(li,ci,ui,Nn),css:r}}e.toColor=i})(wn||={});var Di;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let c=i/255,d=r/255,f=o/255,p=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),_=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+_*.7152+g*.0722}e.relativeLuminance2=n})(Di||={});var Nf;(e=>{function t(c,d){if(Nn=(d&255)/255,Nn===1)return d;let f=d>>24&255,p=d>>16&255,_=d>>8&255,g=c>>24&255,b=c>>16&255,S=c>>8&255;return li=g+Math.round((f-g)*Nn),ci=b+Math.round((p-b)*Nn),ui=S+Math.round((_-S)*Nn),qn.toRgba(li,ci,ui)}e.blend=t;function n(c,d,f){let p=Di.relativeLuminance(c>>8),_=Di.relativeLuminance(d>>8);if(Fr(p,_)<f){if(_<p){let S=i(c,d,f),w=Fr(p,Di.relativeLuminance(S>>8));if(w<f){let x=r(c,d,f),E=Fr(p,Di.relativeLuminance(x>>8));return w>E?S:x}return S}let g=r(c,d,f),b=Fr(p,Di.relativeLuminance(g>>8));if(b<f){let S=i(c,d,f),w=Fr(p,Di.relativeLuminance(S>>8));return b>w?g:S}return g}}e.ensureContrastRatio=n;function i(c,d,f){let p=c>>24&255,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Fr(Di.relativeLuminance2(b,S,w),Di.relativeLuminance2(p,_,g));for(;x<f&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Fr(Di.relativeLuminance2(b,S,w),Di.relativeLuminance2(p,_,g));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(c,d,f){let p=c>>24&255,_=c>>16&255,g=c>>8&255,b=d>>24&255,S=d>>16&255,w=d>>8&255,x=Fr(Di.relativeLuminance2(b,S,w),Di.relativeLuminance2(p,_,g));for(;x<f&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Fr(Di.relativeLuminance2(b,S,w),Di.relativeLuminance2(p,_,g));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(Nf||={});function vo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Fr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var TB=class extends Sh{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},tp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Bs}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],i=t.translateToString(!0),r=0,o=0,c=0,d=t.getFg(0),f=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==f){if(p-r>1){let _=this._getJoinedRanges(i,c,o,t,r);for(let g=0;g<_.length;g++)n.push(_[g])}r=p,c=o,d=this._workCell.fg,f=this._workCell.bg}o+=this._workCell.getChars().length||$a.length}if(this._bufferService.cols-r>1){let p=this._getJoinedRanges(i,c,o,t,r);for(let _=0;_<p.length;_++)n.push(p[_])}return n}_getJoinedRanges(e,t,n,i,r){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let f=this._characterJoiners[d].handler(o);for(let p=0;p<f.length;p++)tp._mergeRanges(c,f[p])}catch(f){console.error(f)}return this._stringRangesToCellRanges(c,i,r),c}_stringRangesToCellRanges(e,t,n){let i=0,r=!1,o=0,c=e[i];if(c){for(let d=n;d<this._bufferService.cols;d++){let f=t.getWidth(d),p=t.getString(d).length||$a.length;if(f!==0){if(!r&&c[0]<=o&&(c[0]=d,r=!0),c[1]<=o){if(c[1]=d,c=e[++i],!c)break;c[0]<=o?(c[0]=d,r=!0):r=!1}o+=p}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let r=e[i];if(n){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};tp=Ln([Ie(0,Hi)],tp);function AB(e){return 57508<=e&&e<=57558}function RB(e){return 9472<=e&&e<=9631}function NB(e){return AB(e)||RB(e)}function LB(){return{css:{canvas:Vd(),cell:Vd()},device:{canvas:Vd(),cell:Vd(),char:{width:0,height:0,left:0,top:0}}}}function Vd(){return{width:0,height:0}}var xy=class{constructor(e,t,n,i,r,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=c,this._workCell=new Bs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,r,o,c,d,f,p,_){let g=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let x,E=0,D="",j=0,z=0,T=0,N=0,L=!1,H=0,F=!1,J=0,pe=0,G=[],P=p!==-1&&_!==-1;for(let A=0;A<w;A++){e.loadCell(A,this._workCell);let $=this._workCell.getWidth();if($===0)continue;let M=!1,k=A>=pe,B=A,O=this._workCell;if(b.length>0&&A===b[0][0]&&k){let xe=b.shift(),Me=this._isCellInSelection(xe[0],t);for(j=xe[0]+1;j<xe[1];j++)k&&=Me===this._isCellInSelection(j,t);k&&=!n||o<xe[0]||o>=xe[1],k?(M=!0,O=new TB(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),B=xe[1]-1,$=O.getWidth()):pe=xe[1]}let W=this._isCellInSelection(A,t),U=n&&A===o,R=P&&A>=p&&A<=_,Y=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,xe=>{Y=!0});let Z=O.getChars()||$a;if(Z===" "&&(O.isUnderline()||O.isOverline())&&(Z=" "),J=$*d-f.get(Z,O.isBold(),O.isItalic()),!x)x=this._document.createElement("span");else if(E&&(W&&F||!W&&!F&&O.bg===z)&&(W&&F&&S.selectionForeground||O.fg===T)&&O.extended.ext===N&&R===L&&J===H&&!U&&!M&&!Y&&k){O.isInvisible()?D+=$a:D+=Z,E++;continue}else E&&(x.textContent=D),x=this._document.createElement("span"),E=0,D="";if(z=O.bg,T=O.fg,N=O.extended.ext,L=R,H=J,F=W,M&&o>=A&&o<=B&&(o=A),!this._coreService.isCursorHidden&&U&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&G.push("xterm-cursor-blink"),G.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(O.isBold()&&G.push("xterm-bold"),O.isItalic()&&G.push("xterm-italic"),O.isDim()&&G.push("xterm-dim"),O.isInvisible()?D=$a:D=O.getChars()||$a,O.isUnderline()&&(G.push(`xterm-underline-${O.extended.underlineStyle}`),D===" "&&(D=" "),!O.isUnderlineColorDefault()))if(O.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Sh.toColorRGB(O.getUnderlineColor()).join(",")})`;else{let xe=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&xe<8&&(xe+=8),x.style.textDecorationColor=S.ansi[xe].css}O.isOverline()&&(G.push("xterm-overline"),D===" "&&(D=" ")),O.isStrikethrough()&&G.push("xterm-strikethrough"),R&&(x.style.textDecoration="underline");let me=O.getFgColor(),ue=O.getFgColorMode(),oe=O.getBgColor(),ke=O.getBgColorMode(),Ne=!!O.isInverse();if(Ne){let xe=me;me=oe,oe=xe;let Me=ue;ue=ke,ke=Me}let Re,ot,Le=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,xe=>{xe.options.layer!=="top"&&Le||(xe.backgroundColorRGB&&(ke=50331648,oe=xe.backgroundColorRGB.rgba>>8&16777215,Re=xe.backgroundColorRGB),xe.foregroundColorRGB&&(ue=50331648,me=xe.foregroundColorRGB.rgba>>8&16777215,ot=xe.foregroundColorRGB),Le=xe.options.layer==="top")}),!Le&&W&&(Re=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,oe=Re.rgba>>8&16777215,ke=50331648,Le=!0,S.selectionForeground&&(ue=50331648,me=S.selectionForeground.rgba>>8&16777215,ot=S.selectionForeground)),Le&&G.push("xterm-decoration-top");let Se;switch(ke){case 16777216:case 33554432:Se=S.ansi[oe],G.push(`xterm-bg-${oe}`);break;case 50331648:Se=qn.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(x,`background-color:#${pk((oe>>>0).toString(16),"0",6)}`);break;default:Ne?(Se=S.foreground,G.push("xterm-bg-257")):Se=S.background}switch(Re||O.isDim()&&(Re=hn.multiplyOpacity(Se,.5)),ue){case 16777216:case 33554432:O.isBold()&&me<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(me+=8),this._applyMinimumContrast(x,Se,S.ansi[me],O,Re,void 0)||G.push(`xterm-fg-${me}`);break;case 50331648:let xe=qn.toColor(me>>16&255,me>>8&255,me&255);this._applyMinimumContrast(x,Se,xe,O,Re,ot)||this._addStyle(x,`color:#${pk(me.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Se,S.foreground,O,Re,ot)||Ne&&G.push("xterm-fg-257")}G.length&&(x.className=G.join(" "),G.length=0),!U&&!M&&!Y&&k?E++:x.textContent=D,J!==this.defaultSpacing&&(x.style.letterSpacing=`${J}px`),g.push(x),A=B}return x&&E&&(x.textContent=D),g}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||NB(i.getCode()))return!1;let c=this._getContrastCache(i),d;if(!r&&!o&&(d=c.getColor(t.rgba,n.rgba)),d===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=hn.ensureContrastRatio(r||t,o||n,f),c.setColor((r||t).rgba,(o||n).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,i=this._selectionEnd;return!n||!i?!1:this._columnSelectMode?n[0]<=i[0]?e>=n[0]&&t>=n[1]&&e<i[0]&&t<=i[1]:e<n[0]&&t>=n[1]&&e>=i[0]&&t<=i[1]:t>n[1]&&t<i[1]||n[1]===i[1]&&t===n[1]&&e>=n[0]&&e<i[0]||n[1]<i[1]&&t===i[1]&&e<i[0]||n[1]<i[1]&&t===n[1]&&e>=n[0]}};xy=Ln([Ie(1,YT),Ie(2,Fi),Ie(3,Jr),Ie(4,Uo),Ie(5,wh),Ie(6,hc)],xy);function pk(e,t,n){for(;e.length<n;)e=t+e;return e}var MB=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,i,r,o],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,i){e===this._font&&t===this._fontSize&&n===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,n){let i=0;if(!t&&!n&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let r=e;t&&(r+="B"),n&&(r+="I");let o=this._holey.get(r);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},OB=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,i=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,c=n[1]-r,d=Math.max(o,0),f=Math.min(c,e.rows-1);if(d>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function DB(){return new OB}var D_="xterm-dom-renderer-owner-",As="xterm-rows",Yd="xterm-fg-",mk="xterm-bg-",mu="xterm-focus",Xd="xterm-selection",jB=1,Cy=class extends yt{constructor(e,t,n,i,r,o,c,d,f,p,_,g,b,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=c,this._charSizeService=f,this._optionsService=p,this._bufferService=_,this._coreService=g,this._coreBrowserService=b,this._themeService=S,this._terminalClass=jB++,this._rowElements=[],this._selectionRenderModel=DB(),this.onRequestRedraw=this._register(new Ce).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(As),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Xd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=LB(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(xy,document),this._element.classList.add(D_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(yn(()=>{this._element.classList.remove(D_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new MB(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${As} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${As} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${As} .xterm-dim { color: ${hn.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${As}.${mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${As}.${mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${As}.${mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Xd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Xd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Xd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Yd}${o} { color: ${c.css}; }${this._terminalSelector} .${Yd}${o}.xterm-dim { color: ${hn.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${mk}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Yd}257 { color: ${hn.opaque(e.background).css}; }${this._terminalSelector} .${Yd}257.xterm-dim { color: ${hn.multiplyOpacity(hn.opaque(e.background),.5).css}; }${this._terminalSelector} .${mk}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(mu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(mu),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(n){let f=e[0]>t[0];d.appendChild(this._createSelectionElement(o,f?t[0]:e[0],f?e[0]:t[0],c-o+1))}else{let f=i===o?e[0]:0,p=o===r?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,f,p));let _=c-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,_)),o!==c){let g=r===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,g))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,n,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${c}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,i=n.ybase+n.y,r=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let p=f+n.ydisp,_=this._rowElements[f],g=n.lines.get(p);if(!_||!g)break;_.replaceChildren(...this._rowFactory.createRow(g,p,p===i,c,d,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,i,r,o){n<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),i=Math.max(Math.min(i,c),0),r=Math.min(r,this._bufferService.cols);let d=this._bufferService.buffer,f=d.ybase+d.y,p=Math.min(d.x,r-1),_=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=i;++S){let w=S+d.ydisp,x=this._rowElements[S],E=d.lines.get(w);if(!x||!E)break;x.replaceChildren(...this._rowFactory.createRow(E,w,w===f,g,b,p,_,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};Cy=Ln([Ie(7,a0),Ie(8,Mp),Ie(9,Fi),Ie(10,Hi),Ie(11,Uo),Ie(12,Jr),Ie(13,hc)],Cy);var ky=class extends yt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Ce),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new BB(this._optionsService))}catch{this._measureStrategy=this._register(new IB(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};ky=Ln([Ie(2,Fi)],ky);var pA=class extends yt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},IB=class extends pA{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},BB=class extends pA{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},$B=class extends yt{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new PB(this._window)),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Ce),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(wi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(at(this._textarea,"focus",()=>this._isFocused=!0)),this._register(at(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},PB=class extends yt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ql),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(yn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=at(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},zB=class extends yt{constructor(){super(),this.linkProviders=[],this._register(yn(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function p0(e,t,n){let i=n.getBoundingClientRect(),r=e.getComputedStyle(n),o=parseInt(r.getPropertyValue("padding-left")),c=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-c]}function HB(e,t,n,i,r,o,c,d,f){if(!o)return;let p=p0(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(f?c/2:0))/c),p[1]=Math.ceil(p[1]/d),p[0]=Math.min(Math.max(p[0],1),i+(f?1:0)),p[1]=Math.min(Math.max(p[1],1),r),p}var Ey=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return HB(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=p0(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ey=Ln([Ie(0,Qr),Ie(1,Mp)],Ey);var FB=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},mA={};J8(mA,{getSafariVersion:()=>WB,isChromeOS:()=>yA,isFirefox:()=>gA,isIpad:()=>qB,isIphone:()=>GB,isLegacyEdge:()=>UB,isLinux:()=>m0,isMac:()=>np,isNode:()=>Op,isSafari:()=>_A,isWindows:()=>vA});var Op=typeof process<"u"&&"title"in process,xh=Op?"node":navigator.userAgent,Ch=Op?"node":navigator.platform,gA=xh.includes("Firefox"),UB=xh.includes("Edge"),_A=/^((?!chrome|android).)*safari/i.test(xh);function WB(){if(!_A)return 0;let e=xh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var np=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ch),qB=Ch==="iPad",GB=Ch==="iPhone",vA=["Windows","Win16","Win32","WinCE"].includes(Ch),m0=Ch.indexOf("Linux")>=0,yA=/\bCrOS\b/.test(xh),bA=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},KB=class extends bA{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},VB=class extends bA{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ip=!Op&&"requestIdleCallback"in window?VB:KB,YB=class{constructor(){this._queue=new ip}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ty=class extends yt{constructor(e,t,n,i,r,o,c,d,f){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new Ql),this._pausedResizeTask=new YB,this._observerDisposable=this._register(new Ql),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Ce),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Ce),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Ce),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new FB((p,_)=>this._renderRows(p,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new XB(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(yn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=yn(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Ty=Ln([Ie(2,Fi),Ie(3,Mp),Ie(4,Uo),Ie(5,wh),Ie(6,Hi),Ie(7,Jr),Ie(8,hc)],Ty);var XB=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ZB(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return e$(r,o,e,t,n,i)+Dp(o,t,n,i)+t$(r,o,e,t,n,i);let c;if(o===t)return c=r>e?"D":"C",ah(Math.abs(r-e),rh(c,i));c=o>t?"D":"C";let d=Math.abs(o-t),f=QB(o>t?e:r,n)+(d-1)*n.cols+1+JB(o>t?r:e);return ah(f,rh(c,i))}function JB(e,t){return e-1}function QB(e,t){return t.cols-e}function e$(e,t,n,i,r,o){return Dp(t,i,r,o).length===0?"":ah(wA(e,t,e,t-Po(t,r),!1,r).length,rh("D",o))}function Dp(e,t,n,i){let r=e-Po(e,n),o=t-Po(t,n),c=Math.abs(r-o)-n$(e,t,n);return ah(c,rh(SA(e,t),i))}function t$(e,t,n,i,r,o){let c;Dp(t,i,r,o).length>0?c=i-Po(i,r):c=t;let d=i,f=i$(e,t,n,i,r,o);return ah(wA(e,c,n,d,f==="C",r).length,rh(f,o))}function n$(e,t,n){let i=0,r=e-Po(e,n),o=t-Po(t,n);for(let c=0;c<Math.abs(r-o);c++){let d=SA(e,t)==="A"?-1:1;n.buffer.lines.get(r+d*c)?.isWrapped&&i++}return i}function Po(e,t){let n=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return n}function i$(e,t,n,i,r,o){let c;return Dp(n,i,r,o).length>0?c=i-Po(i,r):c=t,e<n&&c<=i||e>=n&&c<i?"C":"D"}function SA(e,t){return e>t?"A":"B"}function wA(e,t,n,i,r,o){let c=e,d=t,f="";for(;(c!==n||d!==i)&&d>=0&&d<o.buffer.lines.length;)c+=r?1:-1,r&&c>o.cols-1?(f+=o.buffer.translateBufferLineToString(d,!1,e,c),c=0,e=0,d++):!r&&c<0&&(f+=o.buffer.translateBufferLineToString(d,!1,0,e+1),c=o.cols-1,e=c,d--);return f+o.buffer.translateBufferLineToString(d,!1,e,c)}function rh(e,t){let n=t?"O":"[";return ve.ESC+n+e}function ah(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var s$=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function gk(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var j_=50,r$=15,a$=50,o$=500,l$=" ",c$=new RegExp(l$,"g"),Ay=class extends yt{constructor(e,t,n,i,r,o,c,d,f){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=c,this._renderService=d,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Bs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Ce),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Ce),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new s$(this._bufferService),this._activeSelectionMode=0,this._register(yn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let d=n.translateBufferLineToString(c,!0,r,o);i.push(d)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),d=n.translateBufferLineToString(o,!0);c?.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(r=>r.replace(c$," ")).join(vA?`\r
|
|
91
|
-
`:`
|
|
92
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),m0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i||!t?!1:this._areCoordsInSelection(t,n,i)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i?!1:this._areCoordsInSelection([e,t],n,i)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=gk(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=p0(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-j_),j_),t/=j_,t/Math.abs(t)+Math.round(t*(r$-1)))}shouldForceSelection(e){return np?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),a$)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(np&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let i=n.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<o$&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let i=ZB(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==i&&(n+=r-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let c=r.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),f=d,p=e[0]-d,_=0,g=0,b=0,S=0;if(c.charAt(d)===" "){for(;d>0&&c.charAt(d-1)===" ";)d--;for(;f<c.length&&c.charAt(f+1)===" ";)f++}else{let E=e[0],D=e[0];o.getWidth(E)===0&&(_++,E--),o.getWidth(D)===2&&(g++,D++);let j=o.getString(D).length;for(j>1&&(S+=j-1,f+=j-1);E>0&&d>0&&!this._isCharWordSeparator(o.loadCell(E-1,this._workCell));){o.loadCell(E-1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,E--):z>1&&(b+=z-1,d-=z-1),d--,E--}for(;D<o.length&&f+1<c.length&&!this._isCharWordSeparator(o.loadCell(D+1,this._workCell));){o.loadCell(D+1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,D++):z>1&&(S+=z-1,f+=z-1),f++,D++}}f++;let w=d+p-_+b,x=Math.min(this._bufferService.cols,f-d+_+g-b-S);if(!(!t&&c.slice(d,f).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let E=r.lines.get(e[1]-1);if(E&&o.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let j=this._bufferService.cols-D.start;w-=j,x+=j}}}if(i&&w+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let E=r.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(x+=D.length)}}return{start:w,length:x}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=gk(n,this._bufferService.cols)}};Ay=Ln([Ie(3,Hi),Ie(4,Uo),Ie(5,o0),Ie(6,Fi),Ie(7,Qr),Ie(8,Jr)],Ay);var _k=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},vk=class{constructor(){this._color=new _k,this._css=new _k}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Qn=Object.freeze((()=>{let e=[wn.toColor("#2e3436"),wn.toColor("#cc0000"),wn.toColor("#4e9a06"),wn.toColor("#c4a000"),wn.toColor("#3465a4"),wn.toColor("#75507b"),wn.toColor("#06989a"),wn.toColor("#d3d7cf"),wn.toColor("#555753"),wn.toColor("#ef2929"),wn.toColor("#8ae234"),wn.toColor("#fce94f"),wn.toColor("#729fcf"),wn.toColor("#ad7fa8"),wn.toColor("#34e2e2"),wn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],r=t[n/6%6|0],o=t[n%6];e.push({css:qn.toCss(i,r,o),rgba:qn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:qn.toCss(i,i,i),rgba:qn.toRgba(i,i,i)})}return e})()),xo=wn.toColor("#ffffff"),Bu=wn.toColor("#000000"),yk=wn.toColor("#ffffff"),bk=Bu,gu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},u$=xo,Ry=class extends yt{constructor(e){super(),this._optionsService=e,this._contrastCache=new vk,this._halfContrastCache=new vk,this._onChangeColors=this._register(new Ce),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xo,background:Bu,cursor:yk,cursorAccent:bk,selectionForeground:void 0,selectionBackgroundTransparent:gu,selectionBackgroundOpaque:hn.blend(Bu,gu),selectionInactiveBackgroundTransparent:gu,selectionInactiveBackgroundOpaque:hn.blend(Bu,gu),scrollbarSliderBackground:hn.opacity(xo,.2),scrollbarSliderHoverBackground:hn.opacity(xo,.4),scrollbarSliderActiveBackground:hn.opacity(xo,.5),overviewRulerBorder:xo,ansi:Qn.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Qt(e.foreground,xo),t.background=Qt(e.background,Bu),t.cursor=hn.blend(t.background,Qt(e.cursor,yk)),t.cursorAccent=hn.blend(t.background,Qt(e.cursorAccent,bk)),t.selectionBackgroundTransparent=Qt(e.selectionBackground,gu),t.selectionBackgroundOpaque=hn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Qt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=hn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Qt(e.selectionForeground,fk):void 0,t.selectionForeground===fk&&(t.selectionForeground=void 0),hn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=hn.opacity(t.selectionBackgroundTransparent,.3)),hn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=hn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Qt(e.scrollbarSliderBackground,hn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Qt(e.scrollbarSliderHoverBackground,hn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Qt(e.scrollbarSliderActiveBackground,hn.opacity(t.foreground,.5)),t.overviewRulerBorder=Qt(e.overviewRulerBorder,u$),t.ansi=Qn.slice(),t.ansi[0]=Qt(e.black,Qn[0]),t.ansi[1]=Qt(e.red,Qn[1]),t.ansi[2]=Qt(e.green,Qn[2]),t.ansi[3]=Qt(e.yellow,Qn[3]),t.ansi[4]=Qt(e.blue,Qn[4]),t.ansi[5]=Qt(e.magenta,Qn[5]),t.ansi[6]=Qt(e.cyan,Qn[6]),t.ansi[7]=Qt(e.white,Qn[7]),t.ansi[8]=Qt(e.brightBlack,Qn[8]),t.ansi[9]=Qt(e.brightRed,Qn[9]),t.ansi[10]=Qt(e.brightGreen,Qn[10]),t.ansi[11]=Qt(e.brightYellow,Qn[11]),t.ansi[12]=Qt(e.brightBlue,Qn[12]),t.ansi[13]=Qt(e.brightMagenta,Qn[13]),t.ansi[14]=Qt(e.brightCyan,Qn[14]),t.ansi[15]=Qt(e.brightWhite,Qn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)t.ansi[i+16]=Qt(e.extendedAnsi[i],Qn[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Ry=Ln([Ie(0,Fi)],Ry);function Qt(e,t){if(e!==void 0)try{return wn.toColor(e)}catch{}return t}var h$=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},d$=class{constructor(){this._services=new h$,this._services.set(a0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=r7(e).sort((o,c)=>o.index-c.index),i=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(c)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},f$={trace:0,debug:1,info:2,warn:3,error:4,off:5},p$="xterm.js: ",Ny=class extends yt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=f$[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":p$)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Ny=Ln([Ie(0,Fi)],Ny);var Sk=class extends yt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Ce),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Ce),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Ce),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let i=this._length+n.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},vt=3,Un=Object.freeze(new Sh),Zd=0,I_=2,$u=class xA{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*vt);let r=n||Bs.fromCharData([0,FT,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*vt+0],i=n&2097151;return[this._data[t*vt+1],n&2097152?this._combined[t]:i?ja(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*vt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*vt+0]=t|2097152|n[2]<<22):this._data[t*vt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*vt+0]>>22}hasWidth(t){return this._data[t*vt+0]&12582912}getFg(t){return this._data[t*vt+1]}getBg(t){return this._data[t*vt+2]}hasContent(t){return this._data[t*vt+0]&4194303}getCodePoint(t){let n=this._data[t*vt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*vt+0]&2097152}getString(t){let n=this._data[t*vt+0];return n&2097152?this._combined[t]:n&2097151?ja(n&2097151):""}isProtected(t){return this._data[t*vt+2]&536870912}loadCell(t,n){return Zd=t*vt,n.content=this._data[Zd+0],n.fg=this._data[Zd+1],n.bg=this._data[Zd+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*vt+0]=n.content,this._data[t*vt+1]=n.fg,this._data[t*vt+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*vt+0]=n|i<<22,this._data[t*vt+1]=r.fg,this._data[t*vt+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*vt+0];r&2097152?this._combined[t]+=ja(n):r&2097151?(this._combined[t]=ja(r&2097151)+ja(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*vt+0]=r}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let r=new Bs;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,r));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let r=new Bs;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,r));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*I_<this._data.buffer.byteLength;let i=t*vt;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let c=0;c<r.length;c++){let d=parseInt(r[c],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let d=parseInt(o[c],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*I_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*I_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new xA(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*vt+0]&4194303)return t+(this._data[t*vt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*vt+0]&4194303||this._data[t*vt+2]&50331648)return t+(this._data[t*vt+0]>>22);return 0}copyCellsFrom(t,n,i,r,o){let c=t._data;if(o)for(let f=r-1;f>=0;f--){for(let p=0;p<vt;p++)this._data[(i+f)*vt+p]=c[(n+f)*vt+p];c[(n+f)*vt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}else for(let f=0;f<r;f++){for(let p=0;p<vt;p++)this._data[(i+f)*vt+p]=c[(n+f)*vt+p];c[(n+f)*vt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}let d=Object.keys(t._combined);for(let f=0;f<d.length;f++){let p=parseInt(d[f],10);p>=n&&(this._combined[p-n+i]=t._combined[p])}}translateToString(t,n,i,r){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;n<i;){let c=this._data[n*vt+0],d=c&2097151,f=c&2097152?this._combined[n]:d?ja(d):$a;if(o+=f,r)for(let p=0;p<f.length;++p)r.push(n);n+=c>>22||1}return r&&r.push(n),o}};function m$(e,t,n,i,r,o){let c=[];for(let d=0;d<e.length-1;d++){let f=d,p=e.get(++f);if(!p.isWrapped)continue;let _=[e.get(d)];for(;f<e.length&&p.isWrapped;)_.push(p),p=e.get(++f);if(!o&&i>=d&&i<f){d+=_.length-1;continue}let g=0,b=oh(_,g,t),S=1,w=0;for(;S<_.length;){let E=oh(_,S,t),D=E-w,j=n-b,z=Math.min(D,j);_[g].copyCellsFrom(_[S],w,b,z,!1),b+=z,b===n&&(g++,b=0),w+=z,w===E&&(S++,w=0),b===0&&g!==0&&_[g-1].getWidth(n-1)===2&&(_[g].copyCellsFrom(_[g-1],n-1,b++,1,!1),_[g-1].setCell(n-1,r))}_[g].replaceCells(b,n,r);let x=0;for(let E=_.length-1;E>0&&(E>g||_[E].getTrimmedLength()===0);E--)x++;x>0&&(c.push(d+_.length-x),c.push(x)),d+=_.length-1}return c}function g$(e,t){let n=[],i=0,r=t[i],o=0;for(let c=0;c<e.length;c++)if(r===c){let d=t[++i];e.onDeleteEmitter.fire({index:c-o,amount:d}),c+=d-1,o+=d,r=t[++i]}else n.push(c);return{layout:n,countRemoved:o}}function _$(e,t){let n=[];for(let i=0;i<t.length;i++)n.push(e.get(t[i]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=t.length}function v$(e,t,n){let i=[],r=e.map((f,p)=>oh(e,p,t)).reduce((f,p)=>f+p),o=0,c=0,d=0;for(;d<r;){if(r-d<n){i.push(r-d);break}o+=n;let f=oh(e,c,t);o>f&&(o-=f,c++);let p=e[c].getWidth(o-1)===2;p&&o--;let _=p?n-1:n;i.push(_),d+=_}return i}function oh(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?n-1:n}var CA=class kA{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=kA._nextId++,this._onDispose=this.register(new Ce),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),$o(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};CA._nextId=1;var y$=CA,ti={},Co=ti.B;ti[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};ti.A={"#":"£"};ti.B=void 0;ti[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ti.C=ti[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ti.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ti.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ti.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ti.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ti.E=ti[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ti.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ti.H=ti[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ti["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var wk=4294967295,xk=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Un.clone(),this.savedCharset=Co,this.markers=[],this._nullCell=Bs.fromCharData([0,FT,1,0]),this._whitespaceCell=Bs.fromCharData([0,$a,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ip,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Sk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Qf),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Qf),this._whitespaceCell}getBlankLine(e,t){return new $u(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>wk?wk:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Un);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Sk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Un),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new $u(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new $u(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let c=this.lines.length-r;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=m$(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Un),n);if(i.length>0){let r=g$(this.lines,i);_$(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(Un),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new $u(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Un),r=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let d=this.lines.get(c);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let f=[d];for(;d.isWrapped&&c>0;)d=this.lines.get(--c),f.unshift(d);if(!n){let z=this.ybase+this.y;if(z>=c&&z<c+f.length)continue}let p=f[f.length-1].getTrimmedLength(),_=v$(f,this._cols,e),g=_.length-f.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+g):b=Math.max(0,this.lines.length-this.lines.maxLength+g);let S=[];for(let z=0;z<g;z++){let T=this.getBlankLine(Un,!0);S.push(T)}S.length>0&&(r.push({start:c+f.length+o,newLines:S}),o+=S.length),f.push(...S);let w=_.length-1,x=_[w];x===0&&(w--,x=_[w]);let E=f.length-g-1,D=p;for(;E>=0;){let z=Math.min(D,x);if(f[w]===void 0)break;if(f[w].copyCellsFrom(f[E],D-z,x-z,z,!0),x-=z,x===0&&(w--,x=_[w]),D-=z,D===0){E--;let T=Math.max(E,0);D=oh(f,T,this._cols)}}for(let z=0;z<f.length;z++)_[z]<e&&f[z].setCell(_[z],i);let j=g-b;for(;j-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(r.length>0){let c=[],d=[];for(let x=0;x<this.lines.length;x++)d.push(this.lines.get(x));let f=this.lines.length,p=f-1,_=0,g=r[_];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let x=Math.min(this.lines.maxLength-1,f+o-1);x>=0;x--)if(g&&g.start>p+b){for(let E=g.newLines.length-1;E>=0;E--)this.lines.set(x--,g.newLines[E]);x++,c.push({index:p+1,amount:g.newLines.length}),b+=g.newLines.length,g=r[++_]}else this.lines.set(x,d[p--]);let S=0;for(let x=c.length-1;x>=0;x--)c[x].index+=S,this.lines.onInsertEmitter.fire(c[x]),S+=c[x].amount;let w=Math.max(0,f+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,i){let r=this.lines.get(e);return r?r.translateToString(t,n,i):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new y$(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},b$=class extends yt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Ce),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new xk(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new xk(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},EA=2,TA=1,Ly=class extends yt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,EA),this.rows=Math.max(e.rawOptions.rows||0,TA),this.buffers=this._register(new b$(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-r+1;n.lines.shiftElements(r+1,c-1,-1),n.lines.set(o,i.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Ly=Ln([Ie(0,Fi)],Ly);var Tl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:np,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},S$=["normal","bold","100","200","300","400","500","600","700","800","900"],w$=class extends yt{constructor(e){super(),this._onOptionChange=this._register(new Ce),this.onOptionChange=this._onOptionChange.event;let t={...Tl};for(let n in e)if(n in t)try{let i=e[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(yn(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Tl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in Tl))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let i={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Tl[e]),!x$(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Tl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=S$.includes(t)?t:Tl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function x$(e){return e==="block"||e==="underline"||e==="bar"}function Pu(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let i in e)n[i]=t<=1?e[i]:e[i]&&Pu(e[i],t-1);return n}var Ck=Object.freeze({insertMode:!1}),kk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),My=class extends yt{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Ce),this.onData=this._onData.event,this._onUserInput=this._register(new Ce),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Ce),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Pu(Ck),this.decPrivateModes=Pu(kk)}reset(){this.modes=Pu(Ck),this.decPrivateModes=Pu(kk)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};My=Ln([Ie(0,Hi),Ie(1,KT),Ie(2,Fi)],My);var Ek={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function B_(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var $_=String.fromCharCode,Tk={DEFAULT:e=>{let t=[B_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${$_(t[0])}${$_(t[1])}${$_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${B_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${B_(e,!0)};${e.x};${e.y}${t}`}},Oy=class extends yt{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Ce),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(Ek))this.addProtocol(i,Ek[i]);for(let i of Object.keys(Tk))this.addEncoding(i,Tk[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let i=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Oy=Ln([Ie(0,Hi),Ie(1,Uo),Ie(2,Fi)],Oy);var P_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],C$=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ei;function k$(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var E$=class{constructor(){if(this.version="6",!ei){ei=new Uint8Array(65536),ei.fill(1),ei[0]=0,ei.fill(0,1,32),ei.fill(0,127,160),ei.fill(2,4352,4448),ei[9001]=2,ei[9002]=2,ei.fill(2,11904,42192),ei[12351]=1,ei.fill(2,44032,55204),ei.fill(2,63744,64256),ei.fill(2,65040,65050),ei.fill(2,65072,65136),ei.fill(2,65280,65377),ei.fill(2,65504,65511);for(let e=0;e<P_.length;++e)ei.fill(0,P_[e][0],P_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ei[e]:k$(e,C$)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let r=Eo.extractWidth(t);r===0?i=!1:r>n&&(n=r)}return Eo.createPropertyValue(0,n,i)}},Eo=class Lf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ce,this.onChange=this._onChange.event;let t=new E$;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=r)return n+this.wcwidth(c);let p=t.charCodeAt(o);56320<=p&&p<=57343?c=(c-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(c,i),f=Lf.extractWidth(d);Lf.extractShouldJoin(d)&&(f-=Lf.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},T$=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Ak(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var _u=2147483647,A$=256,AA=class Dy{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>A$)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Dy;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)n.addSubParam(r[o]);else n.addParam(r)}return n}clone(){let t=new Dy(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>_u?_u:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>_u?_u:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-n>0?this._subParams.subarray(n,i):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&(t[n]=this._subParams.slice(i,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[n-1];i[n-1]=~r?Math.min(r*10+t,_u):t}},vu=[],R$=class{constructor(){this._state=0,this._active=vu,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=vu}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=vu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||vu,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Lp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].end(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=vu,this._id=-1,this._state=0}}},ds=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,i){this._hitLimit||(this._data+=Lp(t,n,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,n}},yu=[],N$=class{constructor(){this._handlers=Object.create(null),this._active=yu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=yu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=yu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||yu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Lp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].unhook(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=yu,this._ident=0}},zu=new AA;zu.addParam(0);var Rk=class{constructor(e){this._handler=e,this._data="",this._params=zu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():zu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Lp(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=zu,this._data="",this._hitLimit=!1,n));return this._params=zu,this._data="",this._hitLimit=!1,t}},L$=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|i}},Ds=160,M$=(function(){let e=new L$(4095),t=Array.apply(null,Array(256)).map((d,f)=>f),n=(d,f)=>t.slice(d,f),i=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ds,0,2,0),e.add(Ds,8,5,8),e.add(Ds,6,0,6),e.add(Ds,11,0,11),e.add(Ds,13,13,13),e})(),O$=class extends yt{constructor(e=M$){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new AA,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(yn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new R$),this._dcsParser=this._register(new N$),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=i,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let i=this._escHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let i=this._csiHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,n){let i=0,r=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&f>-1){for(;f>=0&&(c=d[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._parseStack.handlerPos=f,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&f>-1){for(;f>=0&&(c=d[f](),c!==!0);f--)if(c instanceof Promise)return this._parseStack.handlerPos=f,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,n),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,n),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],r=this._transitions.table[this.currentState<<8|(i<160?i:Ds)],r>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,d,b),d=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|i],p=f?f.length-1:-1;for(;p>=0&&(c=f[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._preserveStack(3,f,p,r,d),c;p<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let _=this._escHandlers[this._collect<<8|i],g=_?_.length-1:-1;for(;g>=0&&(c=_[g](),c!==!0);g--)if(c instanceof Promise)return this._preserveStack(4,_,g,r,d),c;g<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=d+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<Ds){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,r,d),c;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=d+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<Ds){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,r,d),c;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},D$=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,j$=/^[\da-f]+$/;function Nk(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=D$.exec(t);if(n){let i=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/i*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/i*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),j$.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(n*r,n*r+n),16);i[r]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return i}}function z_(e,t){let n=e.toString(16),i=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function I$(e,t=16){let[n,i,r]=e;return`rgb:${z_(n,t)}/${z_(i,t)}/${z_(r,t)}`}var B$={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ra=131072,Lk=10;function Mk(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Ok=5e3,Dk=0,$$=class extends yt{constructor(e,t,n,i,r,o,c,d,f=new O$){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=d,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new i7,this._utf8Decoder=new s7,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Un.clone(),this._eraseAttrDataInternal=Un.clone(),this._onRequestBell=this._register(new Ce),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ce),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ce),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ce),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ce),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ce),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ce),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ce),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ce),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new jy(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,_)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:_.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,_,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:_,data:g})}),this._parser.setDcsHandlerFallback((p,_,g)=>{_==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:_,payload:g})}),this._parser.setPrintHandler((p,_,g)=>this.print(p,_,g)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Rf.IND,()=>this.index()),this._parser.setExecuteHandler(Rf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ds(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new ds(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new ds(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new ds(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new ds(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new ds(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new ds(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new ds(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new ds(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new ds(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new ds(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new ds(p=>this.restoreCursorColor(p))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let p in ti)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Rk((p,_)=>this.requestStatusString(p,_)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),Ok))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Ok} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ra&&(o=this._parseStack.position+Ra)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ra&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ra))),c||this._dirtyRowTracker.clearRange(),e.length>Ra)for(let p=o;p<e.length;p+=Ra){let _=p+Ra<e.length?p+Ra:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(p,_),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,_),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,g))return this._preserveStack(i,r,g,p),this._logSlowResolvingAsync(n),n}else if(!c){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,r,p,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,n){let i,r,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,_=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let D=o[String.fromCharCode(i)];D&&(i=D.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=Eo.extractWidth(w);let x=Eo.extractShouldJoin(w),E=x?Eo.extractWidth(b):0;if(b=w,c&&this._onA11yChar.fire(ja(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-E>d){if(f){let D=g,j=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&g instanceof $u&&g.copyCellsFrom(D,j,0,E,!1);j<d;)D.setCellFromCodepoint(j++,0,1,_)}else if(this._activeBuffer.x=d-1,r===2)continue}if(x&&this._activeBuffer.x){let D=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-D,i,r);for(let j=r-E;--j>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(p&&(g.insertCells(this._activeBuffer.x,r-E,this._activeBuffer.getNullCell(_)),g.getWidth(d-1)===2&&g.setCellFromCodepoint(d-1,0,1,_)),g.setCellFromCodepoint(this._activeBuffer.x++,i,r,_),r>0)for(;--r;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&n-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Mk(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Rk(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ds(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Un));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,i=Eo.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),c=new Uint32Array(o.length*n),d=0;for(let p=0;p<o.length;){let _=o.codePointAt(p)||0;c[d++]=_,p+=_>65535?2:1}let f=d;for(let p=1;p<n;++p)c.copyWithin(f,0,d),f+=d;return this.print(c,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Co),this._charsetService.setgCharset(1,Co),this._charsetService.setgCharset(2,Co),this._charsetService.setgCharset(3,Co);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:d,cols:f}=this._bufferService,{active:p,alt:_}=d,g=this._optionsService.rawOptions,b=(x,E)=>(c.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${x};${E}$y`),!0),S=x=>x?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,S(c.modes.insertMode)):w===12?b(w,3):w===20?b(w,S(g.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,g.windowOptions.setWinLines?f===80?2:f===132?1:0:0):w===6?b(w,S(i.origin)):w===7?b(w,S(i.wraparound)):w===8?b(w,3):w===9?b(w,S(r==="X10")):w===12?b(w,S(g.cursorBlink)):w===25?b(w,S(!c.isCursorHidden)):w===45?b(w,S(i.reverseWraparound)):w===66?b(w,S(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,S(r==="VT200")):w===1002?b(w,S(r==="DRAG")):w===1003?b(w,S(r==="ANY")):w===1004?b(w,S(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,S(o==="SGR")):w===1015?b(w,4):w===1016?b(w,S(o==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,S(p===_)):w===2004?b(w,S(i.bracketedPasteMode)):w===2026?b(w,S(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,n,i,r){return t===2?(e|=50331648,e&=-16777216,e|=Sh.fromColorRGB([n,i,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),d=0;do i[1]===5&&(r=1),i[o+d+1+r]=c[d];while(++d<c.length&&d+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:n.fg=this._updateAttrColor(n.fg,i[1],i[3],i[4],i[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,i[1],i[3],i[4],i[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Un.fg,e.bg=Un.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,i=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(i.fg&=-50331904,i.fg|=16777216|n-30):n>=40&&n<=47?(i.bg&=-50331904,i.bg|=16777216|n-40):n>=90&&n<=97?(i.fg&=-50331904,i.fg|=16777216|n-90|8):n>=100&&n<=107?(i.bg&=-50331904,i.bg|=16777216|n-100|8):n===0?this._processSGR0(i):n===1?i.fg|=134217728:n===3?i.bg|=67108864:n===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):n===5?i.fg|=536870912:n===7?i.fg|=67108864:n===8?i.fg|=1073741824:n===9?i.fg|=2147483648:n===2?i.bg|=134217728:n===21?this._processUnderline(2,i):n===22?(i.fg&=-134217729,i.bg&=-134217729):n===23?i.bg&=-67108865:n===24?(i.fg&=-268435457,this._processUnderline(0,i)):n===25?i.fg&=-536870913:n===27?i.fg&=-67108865:n===28?i.fg&=-1073741825:n===29?i.fg&=2147483647:n===39?(i.fg&=-67108864,i.fg|=Un.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=Un.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,i):n===53?i.bg|=1073741824:n===55?i.bg&=-1073741825:n===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):n===100?(i.fg&=-67108864,i.fg|=Un.fg&16777215,i.bg&=-67108864,i.bg|=Un.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Un.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Mk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Lk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Lk&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let i=n.shift(),r=n.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(jk(o))if(r==="?")t.push({type:0,index:o});else{let c=Nk(r);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(n,i):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),i,r=n.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let i=0;i<n.length&&!(t>=this._specialColors.length);++i,++t)if(n[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Nk(n[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let i=0;i<n.length;++i)if(/^\d+$/.exec(n[i])){let r=parseInt(n[i]);jk(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Co),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(B$[e[0]],ti[e[1]]||Co),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Un.clone(),this._eraseAttrDataInternal=Un.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Bs;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${ve.ESC}${c}${ve.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},jy=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Dk=e,e=t,t=Dk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};jy=Ln([Ie(0,Hi)],jy);function jk(e){return 0<=e&&e<256}var P$=5e7,Ik=12,z$=50,H$=class extends yt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Ce),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>P$)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let c=d=>performance.now()-n>=Ik?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(n,d);r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=Ik)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>z$&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Iy=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(f,d)),this._dataByLinkId.set(f.id,f),f.id}let n=e,i=this._getEntryIdKey(n),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Iy=Ln([Ie(0,Hi)],Iy);var Bk=!1,F$=class extends yt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ql),this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onData=this._register(new Ce),this.onData=this._onData.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ce),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ce),this._instantiationService=new d$,this.optionsService=this._register(new w$(e)),this._instantiationService.setService(Fi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Ly)),this._instantiationService.setService(Hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ny)),this._instantiationService.setService(KT,this._logService),this.coreService=this._register(this._instantiationService.createInstance(My)),this._instantiationService.setService(Uo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Oy)),this._instantiationService.setService(GT,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Eo)),this._instantiationService.setService(l7,this.unicodeService),this._charsetService=this._instantiationService.createInstance(T$),this._instantiationService.setService(o7,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Iy),this._instantiationService.setService(VT,this._oscLinkService),this._inputHandler=this._register(new $$(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(wi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(wi.forward(this._bufferService.onResize,this._onResize)),this._register(wi.forward(this.coreService.onData,this._onData)),this._register(wi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new H$((t,n)=>this._inputHandler.parse(t,n))),this._register(wi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ce),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Bk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Bk=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,EA),t=Math.max(t,TA),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Ak.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Ak(this._bufferService),!1))),this._windowsWrappingHeuristics.value=yn(()=>{for(let t of e)t.dispose()})}}},U$={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function W$(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(r.key=ve.ESC+r.key);break;case 9:if(e.shiftKey){r.key=ve.ESC+"[Z";break}r.key=ve.HT,r.cancel=!0;break;case 13:r.key=e.altKey?ve.ESC+ve.CR:ve.CR,r.cancel=!0;break;case 27:r.key=ve.ESC,e.altKey&&(r.key=ve.ESC+ve.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"D":t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"C":t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"A":t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"B":t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=ve.ESC+"[2~");break;case 46:o?r.key=ve.ESC+"[3;"+(o+1)+"~":r.key=ve.ESC+"[3~";break;case 36:o?r.key=ve.ESC+"[1;"+(o+1)+"H":t?r.key=ve.ESC+"OH":r.key=ve.ESC+"[H";break;case 35:o?r.key=ve.ESC+"[1;"+(o+1)+"F":t?r.key=ve.ESC+"OF":r.key=ve.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=ve.ESC+"[5;"+(o+1)+"~":r.key=ve.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=ve.ESC+"[6;"+(o+1)+"~":r.key=ve.ESC+"[6~";break;case 112:o?r.key=ve.ESC+"[1;"+(o+1)+"P":r.key=ve.ESC+"OP";break;case 113:o?r.key=ve.ESC+"[1;"+(o+1)+"Q":r.key=ve.ESC+"OQ";break;case 114:o?r.key=ve.ESC+"[1;"+(o+1)+"R":r.key=ve.ESC+"OR";break;case 115:o?r.key=ve.ESC+"[1;"+(o+1)+"S":r.key=ve.ESC+"OS";break;case 116:o?r.key=ve.ESC+"[15;"+(o+1)+"~":r.key=ve.ESC+"[15~";break;case 117:o?r.key=ve.ESC+"[17;"+(o+1)+"~":r.key=ve.ESC+"[17~";break;case 118:o?r.key=ve.ESC+"[18;"+(o+1)+"~":r.key=ve.ESC+"[18~";break;case 119:o?r.key=ve.ESC+"[19;"+(o+1)+"~":r.key=ve.ESC+"[19~";break;case 120:o?r.key=ve.ESC+"[20;"+(o+1)+"~":r.key=ve.ESC+"[20~";break;case 121:o?r.key=ve.ESC+"[21;"+(o+1)+"~":r.key=ve.ESC+"[21~";break;case 122:o?r.key=ve.ESC+"[23;"+(o+1)+"~":r.key=ve.ESC+"[23~";break;case 123:o?r.key=ve.ESC+"[24;"+(o+1)+"~":r.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=ve.DEL:e.keyCode===219?r.key=ve.ESC:e.keyCode===220?r.key=ve.FS:e.keyCode===221&&(r.key=ve.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let c=U$[e.keyCode]?.[e.shiftKey?1:0];if(c)r.key=ve.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(d);e.shiftKey&&(f=f.toUpperCase()),r.key=ve.ESC+f}else if(e.keyCode===32)r.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),r.key=ve.ESC+d,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=ve.US),e.key==="@"&&(r.key=ve.NUL));break}return r}var jn=0,q$=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ip,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ip,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,o)=>this._getKey(r)-this._getKey(o)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[r]=e[t],t++):i[r]=this._array[n++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(jn=this._search(t),jn===-1)||this._getKey(this._array[jn])!==t)return!1;do if(this._array[jn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(jn),!0;while(++jn<this._array.length&&this._getKey(this._array[jn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,n=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[i++]=this._array[r];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(jn=this._search(e),!(jn<0||jn>=this._array.length)&&this._getKey(this._array[jn])===e))do yield this._array[jn];while(++jn<this._array.length&&this._getKey(this._array[jn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(jn=this._search(e),!(jn<0||jn>=this._array.length)&&this._getKey(this._array[jn])===e))do t(this._array[jn]);while(++jn<this._array.length&&this._getKey(this._array[jn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let i=t+n>>1,r=this._getKey(this._array[i]);if(r>e)n=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},H_=0,$k=0,G$=class extends yt{constructor(){super(),this._decorations=new q$(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Ce),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Ce),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(yn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new K$(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,r=>{H_=r.options.x??0,$k=H_+(r.options.width??1),e>=H_&&e<$k&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},K$=class extends Ha{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Ce),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Ce),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=wn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=wn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},V$=1e3,Y$=class{constructor(e,t=V$){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Pk=20,sp=class extends yt{constructor(e,t,n,i){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Y$(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
93
|
-
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(at(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(yn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Pk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
94
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Pk+1&&(this._liveRegion.textContent+=ny.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,i=n.lines.length.toString();for(let r=e;r<=t;r++){let o=n.lines.get(n.ydisp+r),c=[],d=o?.translateToString(!0,void 0,void 0,c)||"",f=(n.ydisp+r+1).toString(),p=this._rowElements[r];p&&(d.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=d,this._rowColumns.set(p,c)),p.setAttribute("aria-posinset",f),p.setAttribute("aria-setsize",i),this._alignRowWidth(p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let c,d;if(t===0?(c=n,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let r=({node:d,offset:f})=>{let p=d instanceof Text?d.parentNode:d,_=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(p);if(!g)return console.warn("columns is null. Race condition?"),null;let b=f<g.length?g[f]:g.slice(-1)[0]+1;return b>=this._terminal.cols&&(++_,b=0),{row:_,column:b}},o=r(t),c=r(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let i=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};sp=Ln([Ie(1,a0),Ie(2,Jr),Ie(3,Qr)],sp);var By=class extends yt{constructor(e,t,n,i,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Ce),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Ce),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(yn(()=>{$o(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(at(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(at(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(at(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(at(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let i=0;i<n.length;i++){let r=n[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let c=o?.map(d=>({link:d}));this._activeProviderReplies?.set(i,c),n=this._checkLinkProviderResult(i,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let c=r[o],d=c.link.range.start.y<e?0:c.link.range.start.x,f=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let p=d;p<=f;p++){if(n.has(p)){r.splice(o--,1);break}n.add(p)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(c=>this._linkAtPosition(c.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let c=this._activeProviderReplies.get(o)?.find(d=>this._linkAtPosition(d.link,t));if(c){n=!0,this._handleNewLink(c);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&X$(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,$o(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let i=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-i-1,n.end.x,n.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=i}_positionFromMouseEvent(e,t,n){let i=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,i,r){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:r}}};By=Ln([Ie(1,o0),Ie(2,Qr),Ie(3,Hi),Ie(4,XT)],By);function X$(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Z$=class extends F${constructor(e={}){super(e),this._linkifier=this._register(new Ql),this.browser=mA,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ql),this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Ce),this.onKey=this._onKey.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Ce),this.onBell=this._onBell.event,this._onFocus=this._register(new Ce),this._onBlur=this._register(new Ce),this._onA11yCharEmitter=this._register(new Ce),this._onA11yTabEmitter=this._register(new Ce),this._onWillOpen=this._register(new Ce),this._setup(),this._decorationService=this._instantiationService.createInstance(G$),this._instantiationService.setService(wh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(zB),this._instantiationService.setService(XT,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(sy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(wi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(wi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(wi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(wi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(yn(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,i="";switch(t.index){case 256:n="foreground",i="10";break;case 257:n="background",i="11";break;case 258:n="cursor",i="12";break;default:n="ansi",i="4;"+t.index}switch(t.type){case 0:let r=hn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ve.ESC}]${i};${I$(r)}${fA.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=qn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=qn.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(sp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(at(this.element,"copy",t=>{this.hasSelection()&&t7(t,this._selectionService)}));let e=t=>n7(t,this.textarea,this.coreService,this.optionsService);this._register(at(this.textarea,"paste",e)),this._register(at(this.element,"paste",e)),gA?this._register(at(this.element,"mousedown",t=>{t.button===2&&YC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(at(this.element,"contextmenu",t=>{YC(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),m0&&this._register(at(this.element,"auxclick",t=>{t.button===1&&HT(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(at(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(at(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(at(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(at(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(at(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(at(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(at(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(at(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ty.get()),yA||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance($B,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Jr,this._coreBrowserService),this._register(at(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(at(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ky,this._document,this._helperContainer),this._instantiationService.setService(Mp,this._charSizeService),this._themeService=this._instantiationService.createInstance(Ry),this._instantiationService.setService(hc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(tp),this._instantiationService.setService(YT,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ty,this.rows,this.screenElement)),this._instantiationService.setService(Qr,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(wy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ey),this._instantiationService.setService(o0,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(By,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(by,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ay,this.element,this.screenElement,i)),this._instantiationService.setService(u7,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(wi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Sy,this.screenElement)),this._register(at(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(sp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ep,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ep,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Cy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let d,f;switch(o.overrideType||o.type){case"mousemove":f=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":f=0,d=o.button<3?o.button:3;break;case"mousedown":f=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let p=o.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;f=p<0?0:1,d=4;break;default:return!1}return f===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:d,action:f,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(at(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(at(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let c=ve.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){zT(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=W$(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ve.ETX||n.key===ve.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(J$(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Un));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function J$(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Q$=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},eP=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Bs)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},zk=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new eP(t)}getNullCell(){return new Bs}},tP=class extends yt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Ce),this.onBufferChange=this._onBufferChange.event,this._normal=new zk(this._core.buffers.normal,"normal"),this._alternate=new zk(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},nP=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,i)=>t(n,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},iP=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},sP=["cols","rows"],lr=0,rP=class extends yt{constructor(e){super(),this._core=this._register(new Z$(e)),this._addonManager=this._register(new Q$),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(sP.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new nP(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new iP(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new tP(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
95
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return ty.get()},set promptLabel(e){ty.set(e)},get tooMuchOutput(){return ny.get()},set tooMuchOutput(e){ny.set(e)}}}_verifyIntegers(...e){for(lr of e)if(lr===1/0||isNaN(lr)||lr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(lr of e)if(lr&&(lr===1/0||isNaN(lr)||lr%1!==0||lr<0))throw new Error("This API only accepts positive integers")}};function aP(e){let t=!1,n=!1,i=!1,r=!1,o=null,c=null;const d=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},f=()=>{c!==null&&(clearTimeout(c),c=null),n=!1},p=()=>{f(),n=!0,c=setTimeout(()=>{c=null,n=!1},0)},_=()=>{i=!1,o!==null&&clearTimeout(o),c!==null&&(clearTimeout(c),c=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},g=()=>{t=!1,o===null&&(f(),i=!1)},b=()=>{t=!1,r=!1,f(),d()},S=w=>{if(o===null){if(t||n||lP(w)){i=!0,n&&!t?_():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,p(),i&&_()},onCompositionCancel:g,handleKeyEvent(w){return oP(w)&&w.shiftKey?(w.preventDefault?.(),w.type==="keydown"?(r=!0,S(w)):w.type==="keypress"?(r||S(w),r=!1):w.type==="keyup"&&(r=!1),!1):!0},dispose:b}}function oP(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function lP(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function cP({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,c=!1;const d=()=>{o=!1,c=!1},f=b=>{Hk(b)&&(o=!0,c=!1)},p=()=>{o&&(c=!0)},_=b=>{const S=o&&c&&Hk(b);if(d(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},g=e.onSelectionChange(p);return t.addEventListener("mousedown",f,!0),n.addEventListener("mouseup",_),n.addEventListener("blur",d),{dispose:()=>{r||(r=!0,d(),g.dispose(),t.removeEventListener("mousedown",f,!0),n.removeEventListener("mouseup",_),n.removeEventListener("blur",d))}}}function Hk(e){return e.button===0}function uP(e,t){return{activate(n,i){try{const r=new URL(i);if(r.protocol!=="http:"&&r.protocol!=="https:"||!t(r.href))return;e(r.href,"_blank","noopener,noreferrer")}catch{}}}}const hP={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:uP((e,t,n)=>window.open(e,t,n),e=>window.confirm(`Do you want to navigate to ${e}?
|
|
96
|
-
|
|
97
|
-
WARNING: This link could potentially be dangerous`)),lineHeight:1},dP="Symbols Nerd Font Mono",Jd=`ui-monospace, "SF Mono", Menlo, "${dP}", monospace`,g0=14,RA=10,NA=22,fP={min:RA,max:NA},pP="cascadia",lh=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Jd}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Jd}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Jd}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Jd}`,meta:"Variable · Adobe mono"}],Kl=lh[0];function mP(e){return lh.find(t=>t.id===e)??Kl}function ch(){return{source:"curated",id:pP,customName:"",family:Kl.family,size:g0}}function _0(e,t){const n=mP(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:b0(t)}}function v0(e,t){const n=vP(e);return{source:"custom",id:null,customName:n,family:qf(n,Kl.family),size:b0(t)}}function LA(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=b0(typeof t.size=="number"?t.size:g0);return t.source==="custom"&&typeof t.customName=="string"?v0(t.customName,n):typeof t.id=="string"&&_P(t.id)?_0(t.id,n):null}function y0(e){if(!e)return ch();try{const t=LA(JSON.parse(e));if(t!==null)return t}catch{}return ch()}function gP(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function b0(e){return Number.isFinite(e)?Math.min(NA,Math.max(RA,Math.round(e))):g0}function _P(e){return lh.some(t=>t.id===e)}function vP(e){return Tp(e)}const rp="fleet-plugin.terminal.renderer",Vl="fleet-plugin.terminal.font",Fk="fleet-console.terminalRenderer",Uk="fleet-console.terminalFont",$y=new Set;let Fa=LP(),uh=null,Mo=0;function yP(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(rp)!==null||window.localStorage.getItem(Vl)!==null)return;const e=window.localStorage.getItem(Fk),t=window.localStorage.getItem(Uk),n=e==="webgl"||e==="dom"?e:"webgl",i=y0(t);window.localStorage.setItem(rp,n),window.localStorage.setItem(Vl,gP(i)),window.localStorage.removeItem(Fk),window.localStorage.removeItem(Uk)}catch{}}function bP(e){Mo+=1,uh=e,kP()}function MA(){return y.useSyncExternalStore(NP,Wk,Wk)}function SP(e){AP(e),ec({renderer:e})}function wP(e){const t=_0(e,Fa.font.size);Mo+=1,ec({font:t}),jp(t)}function xP(e){const t=v0(e,Fa.font.size);Mo+=1,ec({font:t}),jp(t)}function CP(e){const t=Fa.font.source==="custom"?v0(Fa.font.customName,e):_0(Fa.font.id,e);Mo+=1,ec({font:t}),jp(t)}async function kP(){if(!uh)return;const e=Mo;try{const t=await uh.read("terminal");if(t!==null){const n=LA(t.font);if(n!==null){if(e!==Mo)return;ec({font:n});try{window.localStorage.removeItem(Vl)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Vl)}catch{}if(n!==null){const i=y0(n);if(e!==Mo)return;ec({font:i}),jp(i);try{window.localStorage.removeItem(Vl)}catch{}}}}catch{}}async function jp(e){if(uh)try{await uh.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function EP(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(rp);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function TP(){if(typeof window>"u")return ch();try{return y0(window.localStorage.getItem(Vl))}catch{return ch()}}function AP(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rp,e)}catch{}}function RP(){for(const e of $y)e()}function ec(e){Fa={...Fa,...e},RP()}function NP(e){return $y.add(e),()=>{$y.delete(e)}}function Wk(){return Fa}function LP(){return typeof window>"u"?{renderer:"webgl",font:ch()}:(yP(),{renderer:EP(),font:TP()})}function qk({baseY:e,viewportY:t}){return t>=e}function MP(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:p,viewportY:_}=e.getViewport();n=Math.max(0,p-_)},o=()=>{if(n===null)return;const{baseY:p}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(p,p-n)))},c=()=>{if(t){e.scrollToBottom();return}o()},d=()=>{i===null&&(i=e.requestFrame(()=>{i=null,c()}))},f=()=>{t&&(c(),d())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=qk(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,f()},preserveAfterGeometryChange:p=>{p(),c(),d()},restoreAfterOutputParsing:()=>{if(t){f();return}qk(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function OP({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!DP(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function DP(e,t){return e.type==="keydown"&&/^win/i.test(t)&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey&&(e.code==="KeyC"||e.key.toLowerCase()==="c")}const jP="Symbols Nerd Font Mono",IP=`1em "${jP}"`,BP=650;let Qd=null;function OA(){return Qd||(Qd=PP(),Qd)}async function $P(){await zP(OA(),BP)}async function PP(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(IP)}catch{}}async function zP(e,t){await new Promise(n=>{let i=!1;const r=setTimeout(o,t);e.then(o,o);function o(){i||(i=!0,clearTimeout(r),n())}})}const HP=80,FP=16,UP=250,WP=1024*1024,qP=120,GP={background:"oklch(16.5% 0.016 245)",foreground:"oklch(94% 0.008 90)",cursor:"oklch(77% 0.085 200)",selectionBackground:"oklch(80% 0.085 78 / 13%)",black:"oklch(13% 0.014 245)",brightBlack:"oklch(29% 0.018 245)",red:"oklch(68% 0.13 25)",green:"oklch(76% 0.11 160)",yellow:"oklch(75% 0.08 90)",blue:"oklch(77% 0.085 200)",magenta:"oklch(70% 0.012 245)",cyan:"oklch(77% 0.085 200)",white:"oklch(94% 0.008 90)",brightRed:"oklch(68% 0.13 25)",brightGreen:"oklch(76% 0.11 160)",brightYellow:"oklch(80% 0.085 78)",brightBlue:"oklch(77% 0.085 200)",brightMagenta:"oklch(70% 0.012 245)",brightCyan:"oklch(77% 0.085 200)",brightWhite:"oklch(94% 0.008 90)"},KP={background:"oklch(23% 0.03 248)",foreground:"oklch(86% 0.018 90)",cursor:"oklch(82% 0.13 195)",selectionBackground:"oklch(78% 0.13 75 / 28%)",black:"oklch(18% 0.045 248)",brightBlack:"oklch(48% 0.03 248)",red:"oklch(72% 0.17 25)",green:"oklch(82% 0.13 195)",yellow:"oklch(86% 0.16 78)",blue:"oklch(70% 0.08 248)",magenta:"oklch(75% 0.11 320)",cyan:"oklch(82% 0.13 195)",white:"oklch(82% 0.018 90)",brightRed:"oklch(78% 0.18 25)",brightGreen:"oklch(88% 0.14 195)",brightYellow:"oklch(90% 0.16 78)",brightBlue:"oklch(78% 0.09 248)",brightMagenta:"oklch(82% 0.12 320)",brightCyan:"oklch(88% 0.14 195)",brightWhite:"oklch(96% 0.012 88)"},VP={background:"oklch(19% 0.008 252)",foreground:"oklch(85% 0.005 250)",cursor:"oklch(80% 0.105 205)",selectionBackground:"oklch(76% 0.115 62 / 28%)",black:"oklch(16% 0.008 252)",brightBlack:"oklch(46% 0.006 250)",red:"oklch(72% 0.17 25)",green:"oklch(80% 0.11 205)",yellow:"oklch(84% 0.14 64)",blue:"oklch(68% 0.05 250)",magenta:"oklch(75% 0.11 320)",cyan:"oklch(80% 0.11 205)",white:"oklch(81% 0.005 250)",brightRed:"oklch(78% 0.18 25)",brightGreen:"oklch(86% 0.13 205)",brightYellow:"oklch(88% 0.15 66)",brightBlue:"oklch(74% 0.06 250)",brightMagenta:"oklch(82% 0.12 320)",brightCyan:"oklch(86% 0.13 205)",brightWhite:"oklch(95% 0.003 250)"};function S0({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,keyboardFocusRequestId:c,zoom:d=1}){const f=i,{renderer:p,font:_}=MA(),g=y.useRef(null),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(null),E=y.useRef(null),D=y.useRef(null),[j,z]=y.useState(d),T=y.useRef(r);T.current=r;const N=y.useRef(o);N.current=o;const[L,H]=y.useState("connecting"),[F,J]=y.useState(0),[pe,G]=y.useState(0);y.useEffect(()=>{const $=g.current;if(!$)return;let M=!1,k=null,B=null,O=null;return(async()=>{if(await $P(),M)return;const U=Gk(f),R=new rP({...hP,fontFamily:_.family,fontSize:_.size*j,theme:U});b.current=R;const Y=new Fj;D.current=Y,R.loadAddon(Y),R.open($),Kk($,U);const Z=cP({terminal:R,selectionTarget:$,windowTarget:window,clipboard:navigator.clipboard});R.loadAddon(new mI),R.unicode.activeVersion="11";const me=aP(()=>R.input(`
|
|
98
|
-
`)),ue=$.querySelector("textarea.xterm-helper-textarea, textarea")??$;ue.addEventListener("compositionstart",me.onCompositionStart),ue.addEventListener("compositionend",me.onCompositionEnd),ue.addEventListener("focusout",me.onCompositionCancel);const oe=OP({getPlatform:()=>navigator.platform,getSelection:()=>R.getSelection(),writeText:Me=>navigator.clipboard.writeText(Me)});R.attachCustomKeyEventHandler(Me=>oe.handleKeyEvent(Me)&&me.handleKeyEvent(Me));const ke=MP({getViewport:()=>R.buffer.active,scrollToBottom:()=>YP(R),scrollToLine:Me=>XP(R,Me),requestFrame:Me=>window.requestAnimationFrame(Me),cancelFrame:Me=>window.cancelAnimationFrame(Me)});E.current=ke;const Ne=ZP($,ue,ke.recordUserViewportChange),Re=e9(R,N.current!==!1,ke.restoreAfterOutputParsing);x.current=Re;const ot=jj({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:Me=>R.onData(Ke=>{ke.resumeFollowing(),Me(Ke)}),write:Re.write},onExit:()=>T.current?.(),onStatus:(Me,Ke)=>{H(Ke?`${Me}: ${Ke}`:Me)}});S.current=ot;const Le=()=>{ke.preserveAfterGeometryChange(()=>{Y.fit(),ot.resize(R.cols,R.rows),R.refresh(0,R.rows-1)})},Se=()=>{B&&clearTimeout(B),B=setTimeout(()=>{B=null,M||Le()},HP)},xe=async()=>{await document.fonts?.ready,!M&&(Le(),ot.start(),G(Me=>Me+1),N.current!==!1&&R.focus())};k=new ResizeObserver(Se),k.observe($),xe(),O=()=>{B&&clearTimeout(B),ue.removeEventListener("compositionstart",me.onCompositionStart),ue.removeEventListener("compositionend",me.onCompositionEnd),ue.removeEventListener("focusout",me.onCompositionCancel),me.dispose(),ot.dispose(),Z.dispose(),Ne.dispose(),Re.dispose(),ke.dispose(),b.current=null,S.current=null,x.current=null,E.current=null,D.current=null;try{R.dispose()}catch{}},J(Me=>Me+1)})(),()=>{M=!0,k?.disconnect(),O?.()}},[e,t,n]),y.useEffect(()=>{x.current?.setActive(o!==!1),o&&(b.current?.focus(),E.current?.resumeFollowing())},[o,c,pe]),y.useEffect(()=>{const $=b.current;if(!$)return;let M=!1;if(p==="webgl")try{const k=new X8;w.current=k,k.onContextLoss(()=>{if(!M){try{k.dispose()}catch{}w.current===k&&(w.current=null)}}),$.loadAddon(k)}catch{try{w.current?.dispose()}catch{}w.current=null}return()=>{M=!0;const k=w.current;if(k){w.current=null;try{k.dispose()}catch{}}}},[p,e,F]),y.useEffect(()=>{const $=b.current,M=g.current;if(!$||!M)return;const k=Gk(f);$.options.theme=k,Kk(M,k)},[f,F]),y.useEffect(()=>{const $=b.current;$&&($.options.fontFamily=_.family,Vk($,D.current,S.current,E.current))},[_.family,F]),y.useEffect(()=>{if(d===j)return;const $=setTimeout(()=>z(d),qP);return()=>clearTimeout($)},[d,j]),y.useEffect(()=>{const $=b.current;$&&($.options.fontSize=_.size*j,Vk($,D.current,S.current,E.current))},[j,_.size,F]);const P=L.startsWith("live"),A=j===1?void 0:{width:`${j*100}%`,height:`${j*100}%`,transform:`scale(${1/j})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[P?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),L]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:g,style:A})})]})})}function Gk(e){return e==="carbon"?VP:e==="maritime"?KP:GP}function Kk(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function YP(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function XP(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function ZP(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let r=!1,o=null;const c=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},d=()=>c(),f=()=>{r=!0},p=S=>{r=JP(S,i)},_=()=>{r&&c()},g=()=>{const S=r;r=!1,S&&c()},b=S=>{QP(S)&&c()};return i.addEventListener("wheel",d,{capture:!0,passive:!0}),i.addEventListener("touchstart",f,{capture:!0,passive:!0}),i.addEventListener("touchend",g),i.addEventListener("touchcancel",g),i.addEventListener("pointerdown",p,!0),i.addEventListener("scroll",_),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",d,!0),i.removeEventListener("touchstart",f,!0),i.removeEventListener("touchend",g),i.removeEventListener("touchcancel",g),i.removeEventListener("pointerdown",p,!0),i.removeEventListener("scroll",_),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function JP(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function QP(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function e9(e,t,n){let i=t,r=!1,o=null,c=0,d=[];const f=()=>{o&&(clearTimeout(o),o=null)},p=()=>{if(f(),r||c===0)return;const g=t9(d,c);d=[],c=0,e.write(g,()=>{r||n()})},_=()=>{r||o||c===0||(o=setTimeout(p,i?FP:UP))};return{write:g=>{if(!(r||g.byteLength===0)){if(d.push(g),c+=g.byteLength,c>=WP){p();return}_()}},setActive:g=>{if(i!==g){if(i=g,f(),i){p();return}_()}},dispose:()=>{p(),r=!0,d=[],c=0,f()}}}function t9(e,t){if(e.length===1)return e[0]??new Uint8Array;const n=new Uint8Array(t);let i=0;for(const r of e)n.set(r,i),i+=r.byteLength;return n}function Vk(e,t,n,i){const r=()=>{t?.fit(),n?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(i){i.preserveAfterGeometryChange(r);return}r()}const n9=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),i9=50*1024;function hh(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(hh):Object.entries(e).some(([t,n])=>n9.has(t.toLowerCase())||hh(n))}function s9(e){if(hh(e)||!zo(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(o9);return t.every(n=>n!==null)?{clis:t}:null}function r9(e){return hh(e)||!zo(e)||typeof e.type!="string"?null:e.type==="connected"?{type:"connected"}:(e.type==="chunk"||e.type==="thought")&&typeof e.text=="string"?{type:e.type,text:e.text}:e.type==="tool"&&typeof e.title=="string"&&typeof e.status=="string"?{type:"tool",title:e.title,status:e.status}:e.type==="complete"?{type:"complete"}:e.type==="error"&&DA(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&zo(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&l9(e.artifact.html)<=i9?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function a9(e){return!hh(e)&&zo(e)&&DA(e.error)?e.error:null}function o9(e){if(!zo(e)||typeof e.cliId!="string"||typeof e.label!="string"||typeof e.available!="boolean"||!Array.isArray(e.models))return null;const t=e.models.map(n=>zo(n)&&typeof n.id=="string"&&typeof n.label=="string"&&Array.isArray(n.effortLevels)&&n.effortLevels.every(i=>typeof i=="string")?{id:n.id,label:n.label,effortLevels:n.effortLevels,defaultEffort:typeof n.defaultEffort=="string"?n.defaultEffort:void 0}:null);return t.every(n=>n!==null)?{cliId:e.cliId,label:e.label,available:e.available,defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0,models:t}:null}function DA(e){return zo(e)&&typeof e.code=="string"&&typeof e.message=="string"}function zo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function l9(e){return new TextEncoder().encode(e).byteLength}class Py extends Error{constructor(t,n){super(n),this.code=t}code}const fc=e=>`analysis/${encodeURIComponent(e)}`;function c9(e,t,n,i){const r=new URLSearchParams({theme:t,canvas:n,foreground:i});return`/plugins/terminal/analysis/artifacts/${encodeURIComponent(e)}?${r.toString()}`}async function u9(e){const t=await Ip(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=s9(n);if(i)return i;throw Bp(t.status,n)}async function jA(e,t){try{const n=await Ip(e,`${fc(t)}/ready`);if(!n.ok)return!1;const i=await n.json().catch(()=>null);return!!i&&typeof i=="object"&&!Array.isArray(i)&&i.ready===!0}catch{return!1}}async function h9(e,t,n,i){await w0(e,`${fc(t)}/start`,n,i)}async function d9(e,t,n){await w0(e,`${fc(t)}/message`,{text:n})}async function F_(e,t){await w0(e,`${fc(t)}/stop`,{})}async function IA(e,t){const n=await Ip(e,`${fc(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw Bp(n.status,await n.json().catch(()=>null))}function f9(e,t,n){return e.subscribe("terminal",`${fc(t)}/stream`,i=>{try{const r=r9(JSON.parse(i.data));r&&n(r)}catch{}})}async function w0(e,t,n,i){const r=await Ip(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),...i?{signal:i}:{}});if(!r.ok)throw Bp(r.status,await r.json().catch(()=>null))}async function Ip(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Ai?Bp(i.status,i.body):i}}function Bp(e,t){const n=a9(t);return new Py(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const p9=32,zy={catalog:null,cliId:"",model:"",effort:"",started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],artifactsAutoOpenArmed:!0,error:null};function m9(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...Yk(t.catalog)};if(t.type==="select-cli"&&!e.started){const i=e.catalog?.clis.find(o=>o.cliId===t.cliId),r=i?.models.find(o=>o.id===i.defaultModel)??i?.models[0];return{...e,cliId:t.cliId,model:r?.id??"",effort:r?.defaultEffort??r?.effortLevels[0]??""}}if(t.type==="select-model"&&!e.started){const i=e.catalog?.clis.find(r=>r.cliId===e.cliId)?.models.find(r=>r.id===t.model);return{...e,model:t.model,effort:i?.defaultEffort??i?.effortLevels[0]??""}}if(t.type==="select-effort"&&!e.started)return{...e,effort:t.effort};if(t.type==="sending")return{...e,started:e.started||t.started,busy:!0,phase:"starting",latestActivity:{kind:"starting",connected:!t.started},runStartedAt:t.now,runEndedAt:null,error:null,tools:[],entries:[...e.entries,{role:"user",text:t.text}]};if(t.type==="error")return bu(e,t.message,t.now);if(t.type==="session-lost")return{...bu(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...bu(e,t.message,t.now),started:!1};if(t.type==="stopped")return{...e,started:!1,busy:!1,phase:"stopped",runEndedAt:t.now,error:null};if(t.type==="stop-failed")return{...bu(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...zy,catalog:i,...Yk(i)}:zy}if(t.type==="clear-artifacts")return{...e,artifacts:[],artifactsAutoOpenArmed:!0};if(t.type==="artifacts-chip-disarm")return e.artifactsAutoOpenArmed?{...e,artifactsAutoOpenArmed:!1}:e;if(t.type==="artifacts-chip-rearm")return e.artifactsAutoOpenArmed?e:{...e,artifactsAutoOpenArmed:!0};if(t.type!=="event")return e;const n=t.event;return n.type==="connected"?e.phase==="starting"?{...e,latestActivity:{kind:"starting",connected:!0}}:e:n.type==="chunk"?{...e,phase:"writing",latestActivity:{kind:"writing"},entries:g9(e.entries,n.text)}:n.type==="thought"?{...e,phase:"reasoning",latestActivity:{kind:"reasoning"}}:n.type==="tool"?{...e,phase:"tool",latestActivity:{kind:"tool",title:n.title,status:n.status},tools:[...e.tools.filter(i=>i.title!==n.title),{title:n.title,status:n.status}]}:n.type==="artifact"?{...e,artifacts:[n.artifact,...e.artifacts.filter(i=>i.id!==n.artifact.id)].slice(0,p9)}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,error:null}:bu(e,n.error.message,t.now)}function Yk(e){const t=e.clis.find(r=>r.cliId==="claude"&&r.available)??e.clis.find(r=>r.available)??e.clis[0],n=t?.models.find(r=>t.cliId==="claude"&&r.id==="sonnet")??t?.models.find(r=>r.id===t.defaultModel)??t?.models[0],i=n?.effortLevels.includes("medium")?"medium":n?.defaultEffort??n?.effortLevels[0]??"";return{cliId:t?.cliId??"",model:n?.id??"",effort:i}}function bu(e,t,n){return{...e,busy:!1,phase:"error",runEndedAt:n,error:t}}function g9(e,t){const n=e.at(-1);return n?.role==="analyst"?[...e.slice(0,-1),{role:"analyst",text:n.text+t}]:[...e,{role:"analyst",text:t}]}const dh=new Map,Su=new Map;function BA(e){const t=_9(e.operationId,e.api);return{state:y.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function _9(e,t){const n=dh.get(e);if(n)return n;const i=w9(e,t);return dh.set(e,i),i}function v9(e){dh.get(e)?.dispose()}function y9(e){dh.get(e)?.dispatch({type:"artifacts-chip-rearm"})}const b9=2e3,S9=12e4;function w9(e,t){let n=zy,i=!1,r=null,o=null,c=null,d=null,f=null,p=null,_=0,g=0;const b=new Set,S=N=>{if(i)return;const L=m9(n,N);if(L!==n){n=L;for(const H of b)H()}},w=()=>{o!==null&&(clearTimeout(o),o=null)},x=()=>{w(),o=setTimeout(()=>{o=null,S({type:"error",message:"Analysis response timed out.",now:Date.now()})},S9)},E=()=>{w(),_+=1,g+=1;const N=r;r=null,N?.()},D=()=>{E(),S({type:"session-lost",now:Date.now()})},j=async()=>{if(r)return;const N=++_;let L=null;const H=new Promise(F=>{L=F});r=f9(t,e,F=>{if(!(N!==_||i)){if(F.type==="connected"){S({type:"event",event:F,now:Date.now()}),L?.(),L=null;return}if(F.type==="error"&&Xk(F.error.code)){L?.(),L=null,D();return}(F.type==="complete"||F.type==="error")&&w(),S({type:"event",event:F,now:Date.now()})}}),await Promise.race([H,new Promise(F=>setTimeout(F,b9))])},T={getSnapshot:()=>n,subscribe:N=>(b.add(N),()=>b.delete(N)),dispatch:S,send:async N=>{const L=Su.get(e);if(L&&await L,p)try{await p}catch{return}f&&await f;const H=N.trim();if(!H||n.busy||i)return;const F=!n.started,J=++g,pe={cliId:n.cliId,model:n.model,effort:n.effort};if(S({type:"sending",started:F,text:H,now:Date.now()}),F){const G=new AbortController,P=h9(t,e,pe,G.signal);d=G,c=P;try{await P}catch(A){if(i||J!==g)return;if(!(A instanceof Py&&A.code==="analysis_session_exists")){S({type:"start-failed",message:wu(A),now:Date.now()});return}}finally{d===G&&(d=null),c===P&&(c=null)}if(i||J!==g||!n.started||(await j(),J!==g||!n.started))return}try{if(await d9(t,e,H),J!==g||!n.busy||!n.started)return;x()}catch(G){if(i||J!==g)return;G instanceof Py&&Xk(G.code)?D():S({type:"error",message:wu(G),now:Date.now()})}},stop:async()=>{if(p){await p.catch(()=>{});return}if(f)return f;if(i||!n.started)return;E(),S({type:"stopped",now:Date.now()});const N=F_(t,e).catch(L=>{S({type:"stop-failed",message:wu(L),now:Date.now()})});f=N,await N,f===N&&(f=null)},reset:async()=>{if(p)return p;if(i)return;const N=n.started||n.phase!=="idle"||n.entries.length>0||n.artifacts.length>0;E();const L=(async()=>{f&&await f,c&&await c.catch(()=>{}),N&&await F_(t,e),await IA(t,e).catch(()=>{}),S({type:"reset"})})().catch(H=>{throw S({type:"error",message:`Reset failed: ${wu(H)}`,now:Date.now()}),H});p=L;try{await L}finally{p===L&&(p=null)}},dispose:()=>{if(i)return;const N=Su.get(e),L=p,H=f,F=c,J=d;i=!0,dh.delete(e),E(),b.clear(),J?.abort();const pe=(async()=>{N&&await N,F&&await F.catch(()=>{}),L&&await L.catch(()=>{}),H&&await H.catch(()=>{}),await F_(t,e)})().catch(()=>{});Su.set(e,pe),pe.finally(()=>{Su.get(e)===pe&&Su.delete(e)})}};return u9(t).then(N=>S({type:"catalog",catalog:N})).catch(N=>S({type:"error",message:wu(N),now:Date.now()})),T}function wu(e){return e instanceof Error?e.message:"Analysis is unavailable."}function Xk(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function x9({context:e}){const{state:t,dispatch:n}=BA(e),i=y.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),r=t.artifacts[0]?.id??null,[o,c]=y.useState(null),[d,f]=y.useState(!1),p=y.useId(),_=y.useRef(null);y.useEffect(()=>{r&&c(r)},[r]);const g=i.find(S=>S.id===o)??i.at(-1)??null,b=i.length;return y.useEffect(()=>{if(!d)return;const S=x=>{x.target instanceof Node&&!_.current?.contains(x.target)&&f(!1)},w=x=>{x.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",w)}},[d]),y.useEffect(()=>{b||f(!1)},[b]),u.jsxs("section",{className:"session-analyst__artifacts","aria-label":"Artifacts",children:[u.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[u.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:"Artifacts"}),u.jsx("small",{children:"Visual outputs from this analysis"})]}),u.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:_,children:[u.jsxs("button",{type:"button",className:"session-analyst__artifact-count","aria-expanded":d,"aria-controls":p,"aria-haspopup":"listbox","aria-label":`${d?"Hide":"Show"} artifacts (${b} ${b===1?"item":"items"})`,onClick:()=>f(S=>!S),disabled:!b,children:[u.jsx("strong",{children:b})," ",u.jsx("span",{children:b===1?"item":"items"}),u.jsx("i",{"aria-hidden":"true"})]}),d?u.jsx("div",{className:"session-analyst__artifact-menu",id:p,role:"listbox","aria-label":"Published artifacts",children:i.map(S=>{const w=S.id===g?.id;return u.jsxs("button",{type:"button",role:"option","aria-selected":w,className:w?"is-active":void 0,title:S.title,onClick:()=>{c(S.id),f(!1)},children:[u.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),u.jsx("strong",{children:S.title}),u.jsx($A,{createdAt:S.createdAt})]},S.id)})}):null]}),u.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{f(!1),n({type:"clear-artifacts"}),IA(e.api,e.operationId).catch(()=>{})},disabled:!b,children:"Clear"})]}),b===0?u.jsxs("div",{className:"session-analyst__artifacts-empty",children:[u.jsx("strong",{children:"No artifacts yet"}),"Artifacts the analyst publishes will appear here."]}):u.jsx("div",{className:"session-analyst__artifact-content",children:g?u.jsx(C9,{artifact:g,theme:e.theme},g.id):null})]})}function C9({artifact:e,theme:t}){if(!e.id)return null;const n=getComputedStyle(document.documentElement),i=n.getPropertyValue("--ink-veil").trim()||"Canvas",r=n.getPropertyValue("--ink-pearl").trim()||"CanvasText";return u.jsxs("article",{"aria-label":"Selected artifact preview",children:[u.jsxs("header",{children:[u.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),u.jsx($A,{createdAt:e.createdAt})]}),u.jsx("iframe",{title:e.title,src:c9(e.id,t,i,r),sandbox:"allow-scripts"})]})}function $A({createdAt:e}){const t=new Date(e),n=Number.isFinite(t.getTime());return u.jsx("time",{dateTime:n?t.toISOString():void 0,children:n?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Unknown time"})}function x0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Wo=x0();function PA(e){Wo=e}var Xu={exec:()=>null};function $t(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,o)=>{let c=typeof o=="string"?o:o.source;return c=c.replace(Pi.caret,"$1"),n=n.replace(r,c),i},getRegex:()=>new RegExp(n,t)};return i}var k9=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Pi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},E9=/^(?:[ \t]*(?:\n|$))+/,T9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,A9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,kh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,R9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,C0=/(?:[*+-]|\d{1,9}[.)])/,zA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,HA=$t(zA).replace(/bull/g,C0).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),N9=$t(zA).replace(/bull/g,C0).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),k0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,L9=/^[^\n]+/,E0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,M9=$t(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",E0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),O9=$t(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,C0).getRegex(),$p="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",T0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,D9=$t("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",T0).replace("tag",$p).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),FA=$t(k0).replace("hr",kh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$p).getRegex(),j9=$t(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",FA).getRegex(),A0={blockquote:j9,code:T9,def:M9,fences:A9,heading:R9,hr:kh,html:D9,lheading:HA,list:O9,newline:E9,paragraph:FA,table:Xu,text:L9},Zk=$t("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$p).getRegex(),I9={...A0,lheading:N9,table:Zk,paragraph:$t(k0).replace("hr",kh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zk).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$p).getRegex()},B9={...A0,html:$t(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",T0).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Xu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$t(k0).replace("hr",kh).replace("heading",` *#{1,6} *[^
|
|
99
|
-
]`).replace("lheading",HA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},$9=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,P9=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,UA=/^( {2,}|\\)\n(?!\s*$)/,z9=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pp=/[\p{P}\p{S}]/u,R0=/[\s\p{P}\p{S}]/u,WA=/[^\s\p{P}\p{S}]/u,H9=$t(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,R0).getRegex(),qA=/(?!~)[\p{P}\p{S}]/u,F9=/(?!~)[\s\p{P}\p{S}]/u,U9=/(?:[^\s\p{P}\p{S}]|~)/u,W9=$t(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",k9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),GA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,q9=$t(GA,"u").replace(/punct/g,Pp).getRegex(),G9=$t(GA,"u").replace(/punct/g,qA).getRegex(),KA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",K9=$t(KA,"gu").replace(/notPunctSpace/g,WA).replace(/punctSpace/g,R0).replace(/punct/g,Pp).getRegex(),V9=$t(KA,"gu").replace(/notPunctSpace/g,U9).replace(/punctSpace/g,F9).replace(/punct/g,qA).getRegex(),Y9=$t("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,WA).replace(/punctSpace/g,R0).replace(/punct/g,Pp).getRegex(),X9=$t(/\\(punct)/,"gu").replace(/punct/g,Pp).getRegex(),Z9=$t(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),J9=$t(T0).replace("(?:-->|$)","-->").getRegex(),Q9=$t("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",J9).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ap=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ez=$t(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ap).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),VA=$t(/^!?\[(label)\]\[(ref)\]/).replace("label",ap).replace("ref",E0).getRegex(),YA=$t(/^!?\[(ref)\](?:\[\])?/).replace("ref",E0).getRegex(),tz=$t("reflink|nolink(?!\\()","g").replace("reflink",VA).replace("nolink",YA).getRegex(),Jk=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,N0={_backpedal:Xu,anyPunctuation:X9,autolink:Z9,blockSkip:W9,br:UA,code:P9,del:Xu,emStrongLDelim:q9,emStrongRDelimAst:K9,emStrongRDelimUnd:Y9,escape:$9,link:ez,nolink:YA,punctuation:H9,reflink:VA,reflinkSearch:tz,tag:Q9,text:z9,url:Xu},nz={...N0,link:$t(/^!?\[(label)\]\((.*?)\)/).replace("label",ap).getRegex(),reflink:$t(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ap).getRegex()},Hy={...N0,emStrongRDelimAst:V9,emStrongLDelim:G9,url:$t(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Jk).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$t(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Jk).getRegex()},iz={...Hy,br:$t(UA).replace("{2,}","*").getRegex(),text:$t(Hy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ef={normal:A0,gfm:I9,pedantic:B9},xu={normal:N0,gfm:Hy,breaks:iz,pedantic:nz},sz={"&":"&","<":"<",">":">",'"':""","'":"'"},Qk=e=>sz[e];function ur(e,t){if(t){if(Pi.escapeTest.test(e))return e.replace(Pi.escapeReplace,Qk)}else if(Pi.escapeTestNoEncode.test(e))return e.replace(Pi.escapeReplaceNoEncode,Qk);return e}function e2(e){try{e=encodeURI(e).replace(Pi.percentDecode,"%")}catch{return null}return e}function t2(e,t){let n=e.replace(Pi.findPipe,(o,c,d)=>{let f=!1,p=c;for(;--p>=0&&d[p]==="\\";)f=!f;return f?"|":" |"}),i=n.split(Pi.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(Pi.slashPipe,"|");return i}function Cu(e,t,n){let i=e.length;if(i===0)return"";let r=0;for(;r<i&&e.charAt(i-r-1)===t;)r++;return e.slice(0,i-r)}function rz(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function n2(e,t,n,i,r){let o=t.href,c=t.title||null,d=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let f={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:c,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,f}function az(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
|
|
100
|
-
`).map(o=>{let c=o.match(n.other.beginningSpace);if(c===null)return o;let[d]=c;return d.length>=r.length?o.slice(r.length):o}).join(`
|
|
101
|
-
`)}var op=class{options;rules;lexer;constructor(e){this.options=e||Wo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Cu(n,`
|
|
102
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=az(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=Cu(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Cu(t[0],`
|
|
103
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Cu(t[0],`
|
|
104
|
-
`).split(`
|
|
105
|
-
`),i="",r="",o=[];for(;n.length>0;){let c=!1,d=[],f;for(f=0;f<n.length;f++)if(this.rules.other.blockquoteStart.test(n[f]))d.push(n[f]),c=!0;else if(!c)d.push(n[f]);else break;n=n.slice(f);let p=d.join(`
|
|
106
|
-
`),_=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
107
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
108
|
-
${p}`:p,r=r?`${r}
|
|
109
|
-
${_}`:_;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(_,o,!0),this.lexer.state.top=g,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
|
|
110
|
-
`+n.join(`
|
|
111
|
-
`),x=this.blockquote(w);o[o.length-1]=x,i=i.substring(0,i.length-S.raw.length)+x.raw,r=r.substring(0,r.length-S.text.length)+x.text;break}else if(b?.type==="list"){let S=b,w=S.raw+`
|
|
112
|
-
`+n.join(`
|
|
113
|
-
`),x=this.list(w);o[o.length-1]=x,i=i.substring(0,i.length-b.raw.length)+x.raw,r=r.substring(0,r.length-S.raw.length)+x.raw,n=w.substring(o.at(-1).raw.length).split(`
|
|
114
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),c=!1;for(;e;){let f=!1,p="",_="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=t[2].split(`
|
|
115
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,D=>" ".repeat(3*D.length)),b=e.split(`
|
|
116
|
-
`,1)[0],S=!g.trim(),w=0;if(this.options.pedantic?(w=2,_=g.trimStart()):S?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,_=g.slice(w),w+=t[1].length),S&&this.rules.other.blankLine.test(b)&&(p+=b+`
|
|
117
|
-
`,e=e.substring(b.length+1),f=!0),!f){let D=this.rules.other.nextBulletRegex(w),j=this.rules.other.hrRegex(w),z=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),N=this.rules.other.htmlBeginRegex(w);for(;e;){let L=e.split(`
|
|
118
|
-
`,1)[0],H;if(b=L,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),H=b):H=b.replace(this.rules.other.tabCharGlobal," "),z.test(b)||T.test(b)||N.test(b)||D.test(b)||j.test(b))break;if(H.search(this.rules.other.nonSpaceChar)>=w||!b.trim())_+=`
|
|
119
|
-
`+H.slice(w);else{if(S||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(g)||T.test(g)||j.test(g))break;_+=`
|
|
120
|
-
`+b}!S&&!b.trim()&&(S=!0),p+=L+`
|
|
121
|
-
`,e=e.substring(L.length+1),g=H.slice(w)}}r.loose||(c?r.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0));let x=null,E;this.options.gfm&&(x=this.rules.other.listIsTask.exec(_),x&&(E=x[0]!=="[ ] ",_=_.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:p,task:!!x,checked:E,loose:!1,text:_,tokens:[]}),r.raw+=p}let d=r.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let f=0;f<r.items.length;f++)if(this.lexer.state.top=!1,r.items[f].tokens=this.lexer.blockTokens(r.items[f].text,[]),!r.loose){let p=r.items[f].tokens.filter(g=>g.type==="space"),_=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));r.loose=_}if(r.loose)for(let f=0;f<r.items.length;f++)r.items[f].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=t2(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
122
|
-
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let c of i)this.rules.other.tableAlignRight.test(c)?o.align.push("right"):this.rules.other.tableAlignCenter.test(c)?o.align.push("center"):this.rules.other.tableAlignLeft.test(c)?o.align.push("left"):o.align.push(null);for(let c=0;c<n.length;c++)o.header.push({text:n[c],tokens:this.lexer.inline(n[c]),header:!0,align:o.align[c]});for(let c of r)o.rows.push(t2(c,o.header.length).map((d,f)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[f]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
123
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Cu(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=rz(t[2],"()");if(o===-2)return;if(o>-1){let c=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],r=o[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),n2(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return n2(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,o,c,d=r,f=0,p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+r);(i=p.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(c=[...o].length,i[3]||i[4]){d+=c;continue}else if((i[5]||i[6])&&r%3&&!((r+c)%3)){f+=c;continue}if(d-=c,d>0)continue;c=Math.min(c,c+d+f);let _=[...i[0]][0].length,g=e.slice(0,r+i.index+_+c);if(Math.min(r,c)%2){let S=g.slice(1,-1);return{type:"em",raw:g,text:S,tokens:this.lexer.inlineTokens(S)}}let b=g.slice(2,-2);return{type:"strong",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Gs=class Fy{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Wo,this.options.tokenizer=this.options.tokenizer||new op,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Pi,block:ef.normal,inline:xu.normal};this.options.pedantic?(n.block=ef.pedantic,n.inline=xu.pedantic):this.options.gfm&&(n.block=ef.gfm,this.options.breaks?n.inline=xu.breaks:n.inline=xu.gfm),this.tokenizer.rules=n}static get rules(){return{block:ef,inline:xu}}static lex(t,n){return new Fy(n).lex(t)}static lexInline(t,n){return new Fy(n).inlineTokens(t)}lex(t){t=t.replace(Pi.carriageReturn,`
|
|
124
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){for(this.options.pedantic&&(t=t.replace(Pi.tabCharGlobal," ").replace(Pi.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let c=n.at(-1);r.raw.length===1&&c!==void 0?c.raw+=`
|
|
125
|
-
`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
126
|
-
`)?"":`
|
|
127
|
-
`)+r.raw,c.text+=`
|
|
128
|
-
`+r.text,this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
129
|
-
`)?"":`
|
|
130
|
-
`)+r.raw,c.text+=`
|
|
131
|
-
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let o=t;if(this.options.extensions?.startBlock){let c=1/0,d=t.slice(1),f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(o=t.substring(0,c+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let c=n.at(-1);i&&c?.type==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
132
|
-
`)?"":`
|
|
133
|
-
`)+r.raw,c.text+=`
|
|
134
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r),i=o.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let c=n.at(-1);c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
135
|
-
`)?"":`
|
|
136
|
-
`)+r.raw,c.text+=`
|
|
137
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let i=t,r=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)f.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=r[2]?r[2].length:0,i=i.slice(0,r.index+o)+"["+"a".repeat(r[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let c=!1,d="";for(;t;){c||(d=""),c=!1;let f;if(this.options.extensions?.inline?.some(_=>(f=_.call({lexer:this},t,n))?(t=t.substring(f.raw.length),n.push(f),!0):!1))continue;if(f=this.tokenizer.escape(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.tag(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.link(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(f.raw.length);let _=n.at(-1);f.type==="text"&&_?.type==="text"?(_.raw+=f.raw,_.text+=f.text):n.push(f);continue}if(f=this.tokenizer.emStrong(t,i,d)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.codespan(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.br(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.del(t)){t=t.substring(f.raw.length),n.push(f);continue}if(f=this.tokenizer.autolink(t)){t=t.substring(f.raw.length),n.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(t))){t=t.substring(f.raw.length),n.push(f);continue}let p=t;if(this.options.extensions?.startInline){let _=1/0,g=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},g),typeof b=="number"&&b>=0&&(_=Math.min(_,b))}),_<1/0&&_>=0&&(p=t.substring(0,_+1))}if(f=this.tokenizer.inlineText(p)){t=t.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(d=f.raw.slice(-1)),c=!0;let _=n.at(-1);_?.type==="text"?(_.raw+=f.raw,_.text+=f.text):n.push(f);continue}if(t){let _="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return n}},lp=class{options;parser;constructor(e){this.options=e||Wo}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(Pi.notSpaceStart)?.[0],r=e.replace(Pi.endingNewline,"")+`
|
|
138
|
-
`;return i?'<pre><code class="language-'+ur(i)+'">'+(n?r:ur(r,!0))+`</code></pre>
|
|
139
|
-
`:"<pre><code>"+(n?r:ur(r,!0))+`</code></pre>
|
|
140
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
141
|
-
${this.parser.parse(e)}</blockquote>
|
|
142
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
143
|
-
`}hr(e){return`<hr>
|
|
144
|
-
`}list(e){let t=e.ordered,n=e.start,i="";for(let c=0;c<e.items.length;c++){let d=e.items[c];i+=this.listitem(d)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
|
|
145
|
-
`+i+"</"+r+`>
|
|
146
|
-
`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+ur(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
147
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
148
|
-
`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let i="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let c=0;c<o.length;c++)n+=this.tablecell(o[c]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
149
|
-
<thead>
|
|
150
|
-
`+t+`</thead>
|
|
151
|
-
`+i+`</table>
|
|
152
|
-
`}tablerow({text:e}){return`<tr>
|
|
153
|
-
${e}</tr>
|
|
154
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
155
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ur(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=e2(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+ur(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=e2(e);if(r===null)return ur(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${ur(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ur(e.text)}},L0=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Ks=class Uy{options;renderer;textRenderer;constructor(t){this.options=t||Wo,this.options.renderer=this.options.renderer||new lp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new L0}static parse(t,n){return new Uy(n).parse(t)}static parseInline(t,n){return new Uy(n).parseInline(t)}parse(t,n=!0){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let d=o,f=this.options.extensions.renderers[d.type].call({parser:this},d);if(f!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){i+=f||"";continue}}let c=o;switch(c.type){case"space":{i+=this.renderer.space(c);continue}case"hr":{i+=this.renderer.hr(c);continue}case"heading":{i+=this.renderer.heading(c);continue}case"code":{i+=this.renderer.code(c);continue}case"table":{i+=this.renderer.table(c);continue}case"blockquote":{i+=this.renderer.blockquote(c);continue}case"list":{i+=this.renderer.list(c);continue}case"html":{i+=this.renderer.html(c);continue}case"def":{i+=this.renderer.def(c);continue}case"paragraph":{i+=this.renderer.paragraph(c);continue}case"text":{let d=c,f=this.renderer.text(d);for(;r+1<t.length&&t[r+1].type==="text";)d=t[++r],f+=`
|
|
156
|
-
`+this.renderer.text(d);n?i+=this.renderer.paragraph({type:"paragraph",raw:f,text:f,tokens:[{type:"text",raw:f,text:f,escaped:!0}]}):i+=f;continue}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}parseInline(t,n=this.renderer){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let d=this.options.extensions.renderers[o.type].call({parser:this},o);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=d||"";continue}}let c=o;switch(c.type){case"escape":{i+=n.text(c);break}case"html":{i+=n.html(c);break}case"link":{i+=n.link(c);break}case"image":{i+=n.image(c);break}case"strong":{i+=n.strong(c);break}case"em":{i+=n.em(c);break}case"codespan":{i+=n.codespan(c);break}case"br":{i+=n.br(c);break}case"del":{i+=n.del(c);break}case"text":{i+=n.text(c);break}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},Hu=class{options;block;constructor(e){this.options=e||Wo}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Gs.lex:Gs.lexInline}provideParser(){return this.block?Ks.parse:Ks.parseInline}},XA=class{defaults=x0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ks;Renderer=lp;TextRenderer=L0;Lexer=Gs;Tokenizer=op;Hooks=Hu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let r=i;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let c of o)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let r=i;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let c=r[o].flat(1/0);n=n.concat(this.walkTokens(c,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...c){let d=r.renderer.apply(this,c);return d===!1&&(d=o.apply(this,c)),d}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new lp(this.defaults);for(let o in n.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let c=o,d=n.renderer[c],f=r[c];r[c]=(...p)=>{let _=d.apply(r,p);return _===!1&&(_=f.apply(r,p)),_||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new op(this.defaults);for(let o in n.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let c=o,d=n.tokenizer[c],f=r[c];r[c]=(...p)=>{let _=d.apply(r,p);return _===!1&&(_=f.apply(r,p)),_}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Hu;for(let o in n.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let c=o,d=n.hooks[c],f=r[c];Hu.passThroughHooks.has(o)?r[c]=p=>{if(this.defaults.async&&Hu.passThroughHooksRespectAsync.has(o))return(async()=>{let g=await d.call(r,p);return f.call(r,g)})();let _=d.call(r,p);return f.call(r,_)}:r[c]=(...p)=>{if(this.defaults.async)return(async()=>{let g=await d.apply(r,p);return g===!1&&(g=await f.apply(r,p)),g})();let _=d.apply(r,p);return _===!1&&(_=f.apply(r,p)),_}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(c){let d=[];return d.push(o.call(this,c)),r&&(d=d.concat(r.call(this,c))),d}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Gs.lex(e,t??this.defaults)}parser(e,t){return Ks.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let c=r.hooks?await r.hooks.preprocess(t):t,d=await(r.hooks?await r.hooks.provideLexer():e?Gs.lex:Gs.lexInline)(c,r),f=r.hooks?await r.hooks.processAllTokens(d):d;r.walkTokens&&await Promise.all(this.walkTokens(f,r.walkTokens));let p=await(r.hooks?await r.hooks.provideParser():e?Ks.parse:Ks.parseInline)(f,r);return r.hooks?await r.hooks.postprocess(p):p})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let c=(r.hooks?r.hooks.provideLexer():e?Gs.lex:Gs.lexInline)(t,r);r.hooks&&(c=r.hooks.processAllTokens(c)),r.walkTokens&&this.walkTokens(c,r.walkTokens);let d=(r.hooks?r.hooks.provideParser():e?Ks.parse:Ks.parseInline)(c,r);return r.hooks&&(d=r.hooks.postprocess(d)),d}catch(c){return o(c)}}}onError(e,t){return n=>{if(n.message+=`
|
|
157
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+ur(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Ho=new XA;function en(e,t){return Ho.parse(e,t)}en.options=en.setOptions=function(e){return Ho.setOptions(e),en.defaults=Ho.defaults,PA(en.defaults),en};en.getDefaults=x0;en.defaults=Wo;en.use=function(...e){return Ho.use(...e),en.defaults=Ho.defaults,PA(en.defaults),en};en.walkTokens=function(e,t){return Ho.walkTokens(e,t)};en.parseInline=Ho.parseInline;en.Parser=Ks;en.parser=Ks.parse;en.Renderer=lp;en.TextRenderer=L0;en.Lexer=Gs;en.lexer=Gs.lex;en.Tokenizer=op;en.Hooks=Hu;en.parse=en;en.options;en.setOptions;en.use;en.walkTokens;en.parseInline;Ks.parse;Gs.lex;const{entries:ZA,setPrototypeOf:i2,isFrozen:oz,getPrototypeOf:lz,getOwnPropertyDescriptor:cz}=Object;let{freeze:zi,seal:Ps,create:Dl}=Object,{apply:Wy,construct:qy}=typeof Reflect<"u"&&Reflect;zi||(zi=function(t){return t});Ps||(Ps=function(t){return t});Wy||(Wy=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];return t.apply(n,r)});qy||(qy=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return new t(...i)});const ku=Gn(Array.prototype.forEach),uz=Gn(Array.prototype.lastIndexOf),s2=Gn(Array.prototype.pop),Eu=Gn(Array.prototype.push),hz=Gn(Array.prototype.splice),ji=Array.isArray,Fu=Gn(String.prototype.toLowerCase),U_=Gn(String.prototype.toString),r2=Gn(String.prototype.match),Al=Gn(String.prototype.replace),a2=Gn(String.prototype.indexOf),dz=Gn(String.prototype.trim),fz=Gn(Number.prototype.toString),pz=Gn(Boolean.prototype.toString),o2=typeof BigInt>"u"?null:Gn(BigInt.prototype.toString),l2=typeof Symbol>"u"?null:Gn(Symbol.prototype.toString),Tn=Gn(Object.prototype.hasOwnProperty),Tu=Gn(Object.prototype.toString),Si=Gn(RegExp.prototype.test),tf=mz(TypeError);function Gn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Wy(e,t,i)}}function mz(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return qy(e,n)}}function gt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fu;if(i2&&i2(e,null),!ji(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&(oz(t)||(t[i]=o),r=o)}e[r]=!0}return e}function gz(e){for(let t=0;t<e.length;t++)Tn(e,t)||(e[t]=null);return e}function Ji(e){const t=Dl(null);for(const[n,i]of ZA(e))Tn(e,n)&&(ji(i)?t[n]=gz(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ji(i):t[n]=i);return t}function _z(e){switch(typeof e){case"string":return e;case"number":return fz(e);case"boolean":return pz(e);case"bigint":return o2?o2(e):"0";case"symbol":return l2?l2(e):"Symbol()";case"undefined":return Tu(e);case"function":case"object":{if(e===null)return Tu(e);const t=e,n=jl(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:Tu(i)}return Tu(e)}default:return Tu(e)}}function jl(e,t){for(;e!==null;){const i=cz(e,t);if(i){if(i.get)return Gn(i.get);if(typeof i.value=="function")return Gn(i.value)}e=lz(e)}function n(){return null}return n}function vz(e){try{return Si(e,""),!0}catch{return!1}}const c2=zi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),W_=zi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),q_=zi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),yz=zi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G_=zi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),bz=zi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),u2=zi(["#text"]),h2=zi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),K_=zi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),d2=zi(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),nf=zi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sz=Ps(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wz=Ps(/<%[\w\W]*|[\w\W]*%>/gm),xz=Ps(/\$\{[\w\W]*/gm),Cz=Ps(/^data-[\-\w.\u00B7-\uFFFF]+$/),kz=Ps(/^aria-[\-\w]+$/),JA=Ps(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ez=Ps(/^(?:\w+script|data):/i),Tz=Ps(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),QA=Ps(/^html$/i),Az=Ps(/^[a-z][.\w]*(-[.\w]+)+$/i);var f2=Object.freeze({__proto__:null,ARIA_ATTR:kz,ATTR_WHITESPACE:Tz,CUSTOM_ELEMENT:Az,DATA_ATTR:Cz,DOCTYPE_NAME:QA,ERB_EXPR:wz,IS_ALLOWED_URI:JA,IS_SCRIPT_OR_DATA:Ez,MUSTACHE_EXPR:Sz,TMPLIT_EXPR:xz});const Au={element:1,text:3,progressingInstruction:7,comment:8,document:9},Rz=function(){return typeof window>"u"?null:window},Nz=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},p2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function eR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rz();const t=je=>eR(je);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Au.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:d,Element:f,NodeFilter:p,NamedNodeMap:_=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:b,trustedTypes:S}=e,w=f.prototype,x=jl(w,"cloneNode"),E=jl(w,"remove"),D=jl(w,"nextSibling"),j=jl(w,"childNodes"),z=jl(w,"parentNode");if(typeof c=="function"){const je=n.createElement("template");je.content&&je.content.ownerDocument&&(n=je.content.ownerDocument)}let T,N="";const{implementation:L,createNodeIterator:H,createDocumentFragment:F,getElementsByTagName:J}=n,{importNode:pe}=i;let G=p2();t.isSupported=typeof ZA=="function"&&typeof z=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:P,ERB_EXPR:A,TMPLIT_EXPR:$,DATA_ATTR:M,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:O,CUSTOM_ELEMENT:W}=f2;let{IS_ALLOWED_URI:U}=f2,R=null;const Y=gt({},[...c2,...W_,...q_,...G_,...u2]);let Z=null;const me=gt({},[...h2,...K_,...d2,...nf]);let ue=Object.seal(Dl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,ke=null;const Ne=Object.seal(Dl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,ot=!0,Le=!1,Se=!0,xe=!1,Me=!0,Ke=!1,it=!1,Ge=!1,he=!1,Qe=!1,Ye=!1,Ht=!0,we=!1;const Je="user-content-";let st=!0,Vn=!1,bt={},Ee=null;const ft=gt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pn=null;const Ci=gt({},["audio","video","img","source","image","track"]);let In=null;const Mn=gt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),mn="http://www.w3.org/1998/Math/MathML",ie="http://www.w3.org/2000/svg",le="http://www.w3.org/1999/xhtml";let Pe=le,De=!1,Ue=null;const Mt=gt({},[mn,ie,le],U_);let Ni=gt({},["mi","mo","mn","ms","mtext"]),Ot=gt({},["annotation-xml"]);const Bn=gt({},["title","style","font","a","script"]);let Gt=null;const K=["application/xhtml+xml","text/html"],de="text/html";let ye=null,He=null;const Ft=n.createElement("form"),Dt=function(q){return q instanceof RegExp||q instanceof Function},$e=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===q)return;(!q||typeof q!="object")&&(q={}),q=Ji(q),Gt=K.indexOf(q.PARSER_MEDIA_TYPE)===-1?de:q.PARSER_MEDIA_TYPE,ye=Gt==="application/xhtml+xml"?U_:Fu,R=Tn(q,"ALLOWED_TAGS")&&ji(q.ALLOWED_TAGS)?gt({},q.ALLOWED_TAGS,ye):Y,Z=Tn(q,"ALLOWED_ATTR")&&ji(q.ALLOWED_ATTR)?gt({},q.ALLOWED_ATTR,ye):me,Ue=Tn(q,"ALLOWED_NAMESPACES")&&ji(q.ALLOWED_NAMESPACES)?gt({},q.ALLOWED_NAMESPACES,U_):Mt,In=Tn(q,"ADD_URI_SAFE_ATTR")&&ji(q.ADD_URI_SAFE_ATTR)?gt(Ji(Mn),q.ADD_URI_SAFE_ATTR,ye):Mn,pn=Tn(q,"ADD_DATA_URI_TAGS")&&ji(q.ADD_DATA_URI_TAGS)?gt(Ji(Ci),q.ADD_DATA_URI_TAGS,ye):Ci,Ee=Tn(q,"FORBID_CONTENTS")&&ji(q.FORBID_CONTENTS)?gt({},q.FORBID_CONTENTS,ye):ft,oe=Tn(q,"FORBID_TAGS")&&ji(q.FORBID_TAGS)?gt({},q.FORBID_TAGS,ye):Ji({}),ke=Tn(q,"FORBID_ATTR")&&ji(q.FORBID_ATTR)?gt({},q.FORBID_ATTR,ye):Ji({}),bt=Tn(q,"USE_PROFILES")?q.USE_PROFILES&&typeof q.USE_PROFILES=="object"?Ji(q.USE_PROFILES):q.USE_PROFILES:!1,Re=q.ALLOW_ARIA_ATTR!==!1,ot=q.ALLOW_DATA_ATTR!==!1,Le=q.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=q.SAFE_FOR_TEMPLATES||!1,Me=q.SAFE_FOR_XML!==!1,Ke=q.WHOLE_DOCUMENT||!1,he=q.RETURN_DOM||!1,Qe=q.RETURN_DOM_FRAGMENT||!1,Ye=q.RETURN_TRUSTED_TYPE||!1,Ge=q.FORCE_BODY||!1,Ht=q.SANITIZE_DOM!==!1,we=q.SANITIZE_NAMED_PROPS||!1,st=q.KEEP_CONTENT!==!1,Vn=q.IN_PLACE||!1,U=vz(q.ALLOWED_URI_REGEXP)?q.ALLOWED_URI_REGEXP:JA,Pe=typeof q.NAMESPACE=="string"?q.NAMESPACE:le,Ni=Tn(q,"MATHML_TEXT_INTEGRATION_POINTS")&&q.MATHML_TEXT_INTEGRATION_POINTS&&typeof q.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ji(q.MATHML_TEXT_INTEGRATION_POINTS):gt({},["mi","mo","mn","ms","mtext"]),Ot=Tn(q,"HTML_INTEGRATION_POINTS")&&q.HTML_INTEGRATION_POINTS&&typeof q.HTML_INTEGRATION_POINTS=="object"?Ji(q.HTML_INTEGRATION_POINTS):gt({},["annotation-xml"]);const se=Tn(q,"CUSTOM_ELEMENT_HANDLING")&&q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING=="object"?Ji(q.CUSTOM_ELEMENT_HANDLING):Dl(null);if(ue=Dl(null),Tn(se,"tagNameCheck")&&Dt(se.tagNameCheck)&&(ue.tagNameCheck=se.tagNameCheck),Tn(se,"attributeNameCheck")&&Dt(se.attributeNameCheck)&&(ue.attributeNameCheck=se.attributeNameCheck),Tn(se,"allowCustomizedBuiltInElements")&&typeof se.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=se.allowCustomizedBuiltInElements),xe&&(ot=!1),Qe&&(he=!0),bt&&(R=gt({},u2),Z=Dl(null),bt.html===!0&&(gt(R,c2),gt(Z,h2)),bt.svg===!0&&(gt(R,W_),gt(Z,K_),gt(Z,nf)),bt.svgFilters===!0&&(gt(R,q_),gt(Z,K_),gt(Z,nf)),bt.mathMl===!0&&(gt(R,G_),gt(Z,d2),gt(Z,nf))),Ne.tagCheck=null,Ne.attributeCheck=null,Tn(q,"ADD_TAGS")&&(typeof q.ADD_TAGS=="function"?Ne.tagCheck=q.ADD_TAGS:ji(q.ADD_TAGS)&&(R===Y&&(R=Ji(R)),gt(R,q.ADD_TAGS,ye))),Tn(q,"ADD_ATTR")&&(typeof q.ADD_ATTR=="function"?Ne.attributeCheck=q.ADD_ATTR:ji(q.ADD_ATTR)&&(Z===me&&(Z=Ji(Z)),gt(Z,q.ADD_ATTR,ye))),Tn(q,"ADD_URI_SAFE_ATTR")&&ji(q.ADD_URI_SAFE_ATTR)&>(In,q.ADD_URI_SAFE_ATTR,ye),Tn(q,"FORBID_CONTENTS")&&ji(q.FORBID_CONTENTS)&&(Ee===ft&&(Ee=Ji(Ee)),gt(Ee,q.FORBID_CONTENTS,ye)),Tn(q,"ADD_FORBID_CONTENTS")&&ji(q.ADD_FORBID_CONTENTS)&&(Ee===ft&&(Ee=Ji(Ee)),gt(Ee,q.ADD_FORBID_CONTENTS,ye)),st&&(R["#text"]=!0),Ke&>(R,["html","head","body"]),R.table&&(gt(R,["tbody"]),delete oe.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw tf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw tf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=q.TRUSTED_TYPES_POLICY,N=T.createHTML("")}else T===void 0&&(T=Nz(S,r)),T!==null&&typeof N=="string"&&(N=T.createHTML(""));zi&&zi(q),He=q},Oe=gt({},[...W_,...q_,...yz]),Xe=gt({},[...G_,...bz]),on=function(q){let se=z(q);(!se||!se.tagName)&&(se={namespaceURI:Pe,tagName:"template"});const Ae=Fu(q.tagName),lt=Fu(se.tagName);return Ue[q.namespaceURI]?q.namespaceURI===ie?se.namespaceURI===le?Ae==="svg":se.namespaceURI===mn?Ae==="svg"&&(lt==="annotation-xml"||Ni[lt]):!!Oe[Ae]:q.namespaceURI===mn?se.namespaceURI===le?Ae==="math":se.namespaceURI===ie?Ae==="math"&&Ot[lt]:!!Xe[Ae]:q.namespaceURI===le?se.namespaceURI===ie&&!Ot[lt]||se.namespaceURI===mn&&!Ni[lt]?!1:!Xe[Ae]&&(Bn[Ae]||!Oe[Ae]):!!(Gt==="application/xhtml+xml"&&Ue[q.namespaceURI]):!1},St=function(q){Eu(t.removed,{element:q});try{z(q).removeChild(q)}catch{E(q)}},Yn=function(q,se){try{Eu(t.removed,{attribute:se.getAttributeNode(q),from:se})}catch{Eu(t.removed,{attribute:null,from:se})}if(se.removeAttribute(q),q==="is")if(he||Qe)try{St(se)}catch{}else try{se.setAttribute(q,"")}catch{}},Hs=function(q){let se=null,Ae=null;if(Ge)q="<remove></remove>"+q;else{const Pt=r2(q,/^[\r\n\t ]+/);Ae=Pt&&Pt[0]}Gt==="application/xhtml+xml"&&Pe===le&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const lt=T?T.createHTML(q):q;if(Pe===le)try{se=new b().parseFromString(lt,Gt)}catch{}if(!se||!se.documentElement){se=L.createDocument(Pe,"template",null);try{se.documentElement.innerHTML=De?N:lt}catch{}}const ct=se.body||se.documentElement;return q&&Ae&&ct.insertBefore(n.createTextNode(Ae),ct.childNodes[0]||null),Pe===le?J.call(se,Ke?"html":"body")[0]:Ke?se.documentElement:ct},ns=function(q){return H.call(q.ownerDocument||q,q,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},pi=function(q){return q instanceof g&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof _)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},Kt=function(q){return typeof d=="function"&&q instanceof d};function re(je,q,se){ku(je,Ae=>{Ae.call(t,q,se,He)})}const ht=function(q){let se=null;if(re(G.beforeSanitizeElements,q,null),pi(q))return St(q),!0;const Ae=ye(q.nodeName);if(re(G.uponSanitizeElement,q,{tagName:Ae,allowedTags:R}),Me&&q.hasChildNodes()&&!Kt(q.firstElementChild)&&Si(/<[/\w!]/g,q.innerHTML)&&Si(/<[/\w!]/g,q.textContent)||Me&&q.namespaceURI===le&&Ae==="style"&&Kt(q.firstElementChild)||q.nodeType===Au.progressingInstruction||Me&&q.nodeType===Au.comment&&Si(/<[/\w]/g,q.data))return St(q),!0;if(oe[Ae]||!(Ne.tagCheck instanceof Function&&Ne.tagCheck(Ae))&&!R[Ae]){if(!oe[Ae]&&rt(Ae)&&(ue.tagNameCheck instanceof RegExp&&Si(ue.tagNameCheck,Ae)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(Ae)))return!1;if(st&&!Ee[Ae]){const lt=z(q)||q.parentNode,ct=j(q)||q.childNodes;if(ct&<){const Pt=ct.length;for(let tn=Pt-1;tn>=0;--tn){const Lt=x(ct[tn],!0);lt.insertBefore(Lt,D(q))}}}return St(q),!0}return q instanceof f&&!on(q)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&Si(/<\/no(script|embed|frames)/i,q.innerHTML)?(St(q),!0):(xe&&q.nodeType===Au.text&&(se=q.textContent,ku([P,A,$],lt=>{se=Al(se,lt," ")}),q.textContent!==se&&(Eu(t.removed,{element:q.cloneNode()}),q.textContent=se)),re(G.afterSanitizeElements,q,null),!1)},Vt=function(q,se,Ae){if(ke[se]||Ht&&(se==="id"||se==="name")&&(Ae in n||Ae in Ft))return!1;const lt=Z[se]||Ne.attributeCheck instanceof Function&&Ne.attributeCheck(se,q);if(!(ot&&!ke[se]&&Si(M,se))){if(!(Re&&Si(k,se))){if(!lt||ke[se]){if(!(rt(q)&&(ue.tagNameCheck instanceof RegExp&&Si(ue.tagNameCheck,q)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(q))&&(ue.attributeNameCheck instanceof RegExp&&Si(ue.attributeNameCheck,se)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(se,q))||se==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&Si(ue.tagNameCheck,Ae)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(Ae))))return!1}else if(!In[se]){if(!Si(U,Al(Ae,O,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&q!=="script"&&a2(Ae,"data:")===0&&pn[q])){if(!(Le&&!Si(B,Al(Ae,O,"")))){if(Ae)return!1}}}}}}return!0},xt=gt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),rt=function(q){return!xt[Fu(q)]&&Si(W,q)},xn=function(q){re(G.beforeSanitizeAttributes,q,null);const{attributes:se}=q;if(!se||pi(q))return;const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let lt=se.length;for(;lt--;){const ct=se[lt],{name:Pt,namespaceURI:tn,value:Lt}=ct,be=ye(Pt),Fe=Lt;let Be=Pt==="value"?Fe:dz(Fe);if(Ae.attrName=be,Ae.attrValue=Be,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,re(G.uponSanitizeAttribute,q,Ae),Be=Ae.attrValue,we&&(be==="id"||be==="name")&&a2(Be,Je)!==0&&(Yn(Pt,q),Be=Je+Be),Me&&Si(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Be)){Yn(Pt,q);continue}if(be==="attributename"&&r2(Be,"href")){Yn(Pt,q);continue}if(Ae.forceKeepAttr)continue;if(!Ae.keepAttr){Yn(Pt,q);continue}if(!Se&&Si(/\/>/i,Be)){Yn(Pt,q);continue}xe&&ku([P,A,$],rn=>{Be=Al(Be,rn," ")});const Et=ye(q.nodeName);if(!Vt(Et,be,Be)){Yn(Pt,q);continue}if(T&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!tn)switch(S.getAttributeType(Et,be)){case"TrustedHTML":{Be=T.createHTML(Be);break}case"TrustedScriptURL":{Be=T.createScriptURL(Be);break}}if(Be!==Fe)try{tn?q.setAttributeNS(tn,Pt,Be):q.setAttribute(Pt,Be),pi(q)?St(q):s2(t.removed)}catch{Yn(Pt,q)}}re(G.afterSanitizeAttributes,q,null)},gn=function(q){let se=null;const Ae=ns(q);for(re(G.beforeSanitizeShadowDOM,q,null);se=Ae.nextNode();)re(G.uponSanitizeShadowNode,se,null),ht(se),xn(se),se.content instanceof o&&gn(se.content);re(G.afterSanitizeShadowDOM,q,null)};return t.sanitize=function(je){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,Ae=null,lt=null,ct=null;if(De=!je,De&&(je="<!-->"),typeof je!="string"&&!Kt(je)&&(je=_z(je),typeof je!="string"))throw tf("dirty is not a string, aborting");if(!t.isSupported)return je;if(it||$e(q),t.removed=[],typeof je=="string"&&(Vn=!1),Vn){const Lt=je.nodeName;if(typeof Lt=="string"){const be=ye(Lt);if(!R[be]||oe[be])throw tf("root node is forbidden and cannot be sanitized in-place")}}else if(je instanceof d)se=Hs("<!---->"),Ae=se.ownerDocument.importNode(je,!0),Ae.nodeType===Au.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?se=Ae:se.appendChild(Ae);else{if(!he&&!xe&&!Ke&&je.indexOf("<")===-1)return T&&Ye?T.createHTML(je):je;if(se=Hs(je),!se)return he?null:Ye?N:""}se&&Ge&&St(se.firstChild);const Pt=ns(Vn?je:se);for(;lt=Pt.nextNode();)ht(lt),xn(lt),lt.content instanceof o&&gn(lt.content);if(Vn)return je;if(he){if(xe){se.normalize();let Lt=se.innerHTML;ku([P,A,$],be=>{Lt=Al(Lt,be," ")}),se.innerHTML=Lt}if(Qe)for(ct=F.call(se.ownerDocument);se.firstChild;)ct.appendChild(se.firstChild);else ct=se;return(Z.shadowroot||Z.shadowrootmode)&&(ct=pe.call(i,ct,!0)),ct}let tn=Ke?se.outerHTML:se.innerHTML;return Ke&&R["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&Si(QA,se.ownerDocument.doctype.name)&&(tn="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
|
|
158
|
-
`+tn),xe&&ku([P,A,$],Lt=>{tn=Al(tn,Lt," ")}),T&&Ye?T.createHTML(tn):tn},t.setConfig=function(){let je=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$e(je),it=!0},t.clearConfig=function(){He=null,it=!1},t.isValidAttribute=function(je,q,se){He||$e({});const Ae=ye(je),lt=ye(q);return Vt(Ae,lt,se)},t.addHook=function(je,q){typeof q=="function"&&Eu(G[je],q)},t.removeHook=function(je,q){if(q!==void 0){const se=uz(G[je],q);return se===-1?void 0:hz(G[je],se,1)[0]}return s2(G[je])},t.removeHooks=function(je){G[je]=[]},t.removeAllHooks=function(){G=p2()},t}var Zu=eR(),V_,m2;function Lz(){if(m2)return V_;m2=1;function e(K){return K instanceof Map?K.clear=K.delete=K.set=function(){throw new Error("map is read-only")}:K instanceof Set&&(K.add=K.clear=K.delete=function(){throw new Error("set is read-only")}),Object.freeze(K),Object.getOwnPropertyNames(K).forEach(de=>{const ye=K[de],He=typeof ye;(He==="object"||He==="function")&&!Object.isFrozen(ye)&&e(ye)}),K}class t{constructor(de){de.data===void 0&&(de.data={}),this.data=de.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(K){return K.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(K,...de){const ye=Object.create(null);for(const He in K)ye[He]=K[He];return de.forEach(function(He){for(const Ft in He)ye[Ft]=He[Ft]}),ye}const r="</span>",o=K=>!!K.scope,c=(K,{prefix:de})=>{if(K.startsWith("language:"))return K.replace("language:","language-");if(K.includes(".")){const ye=K.split(".");return[`${de}${ye.shift()}`,...ye.map((He,Ft)=>`${He}${"_".repeat(Ft+1)}`)].join(" ")}return`${de}${K}`};class d{constructor(de,ye){this.buffer="",this.classPrefix=ye.classPrefix,de.walk(this)}addText(de){this.buffer+=n(de)}openNode(de){if(!o(de))return;const ye=c(de.scope,{prefix:this.classPrefix});this.span(ye)}closeNode(de){o(de)&&(this.buffer+=r)}value(){return this.buffer}span(de){this.buffer+=`<span class="${de}">`}}const f=(K={})=>{const de={children:[]};return Object.assign(de,K),de};class p{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(de){this.top.children.push(de)}openNode(de){const ye=f({scope:de});this.add(ye),this.stack.push(ye)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(de){return this.constructor._walk(de,this.rootNode)}static _walk(de,ye){return typeof ye=="string"?de.addText(ye):ye.children&&(de.openNode(ye),ye.children.forEach(He=>this._walk(de,He)),de.closeNode(ye)),de}static _collapse(de){typeof de!="string"&&de.children&&(de.children.every(ye=>typeof ye=="string")?de.children=[de.children.join("")]:de.children.forEach(ye=>{p._collapse(ye)}))}}class _ extends p{constructor(de){super(),this.options=de}addText(de){de!==""&&this.add(de)}startScope(de){this.openNode(de)}endScope(){this.closeNode()}__addSublanguage(de,ye){const He=de.root;ye&&(He.scope=`language:${ye}`),this.add(He)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(K){return K?typeof K=="string"?K:K.source:null}function b(K){return x("(?=",K,")")}function S(K){return x("(?:",K,")*")}function w(K){return x("(?:",K,")?")}function x(...K){return K.map(ye=>g(ye)).join("")}function E(K){const de=K[K.length-1];return typeof de=="object"&&de.constructor===Object?(K.splice(K.length-1,1),de):{}}function D(...K){return"("+(E(K).capture?"":"?:")+K.map(He=>g(He)).join("|")+")"}function j(K){return new RegExp(K.toString()+"|").exec("").length-1}function z(K,de){const ye=K&&K.exec(de);return ye&&ye.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function N(K,{joinWith:de}){let ye=0;return K.map(He=>{ye+=1;const Ft=ye;let Dt=g(He),$e="";for(;Dt.length>0;){const Oe=T.exec(Dt);if(!Oe){$e+=Dt;break}$e+=Dt.substring(0,Oe.index),Dt=Dt.substring(Oe.index+Oe[0].length),Oe[0][0]==="\\"&&Oe[1]?$e+="\\"+String(Number(Oe[1])+Ft):($e+=Oe[0],Oe[0]==="("&&ye++)}return $e}).map(He=>`(${He})`).join(de)}const L=/\b\B/,H="[a-zA-Z]\\w*",F="[a-zA-Z_]\\w*",J="\\b\\d+(\\.\\d+)?",pe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",P="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",A=(K={})=>{const de=/^#![ ]*\//;return K.binary&&(K.begin=x(de,/.*\b/,K.binary,/\b.*/)),i({scope:"meta",begin:de,end:/$/,relevance:0,"on:begin":(ye,He)=>{ye.index!==0&&He.ignoreMatch()}},K)},$={begin:"\\\\[\\s\\S]",relevance:0},M={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[$]},k={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[$]},B={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},O=function(K,de,ye={}){const He=i({scope:"comment",begin:K,end:de,contains:[]},ye);He.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Ft=D("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return He.contains.push({begin:x(/[ ]+/,"(",Ft,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),He},W=O("//","$"),U=O("/\\*","\\*/"),R=O("#","$"),Y={scope:"number",begin:J,relevance:0},Z={scope:"number",begin:pe,relevance:0},me={scope:"number",begin:G,relevance:0},ue={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[$,{begin:/\[/,end:/\]/,relevance:0,contains:[$]}]},oe={scope:"title",begin:H,relevance:0},ke={scope:"title",begin:F,relevance:0},Ne={begin:"\\.\\s*"+F,relevance:0};var ot=Object.freeze({__proto__:null,APOS_STRING_MODE:M,BACKSLASH_ESCAPE:$,BINARY_NUMBER_MODE:me,BINARY_NUMBER_RE:G,COMMENT:O,C_BLOCK_COMMENT_MODE:U,C_LINE_COMMENT_MODE:W,C_NUMBER_MODE:Z,C_NUMBER_RE:pe,END_SAME_AS_BEGIN:function(K){return Object.assign(K,{"on:begin":(de,ye)=>{ye.data._beginMatch=de[1]},"on:end":(de,ye)=>{ye.data._beginMatch!==de[1]&&ye.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:H,MATCH_NOTHING_RE:L,METHOD_GUARD:Ne,NUMBER_MODE:Y,NUMBER_RE:J,PHRASAL_WORDS_MODE:B,QUOTE_STRING_MODE:k,REGEXP_MODE:ue,RE_STARTERS_RE:P,SHEBANG:A,TITLE_MODE:oe,UNDERSCORE_IDENT_RE:F,UNDERSCORE_TITLE_MODE:ke});function Le(K,de){K.input[K.index-1]==="."&&de.ignoreMatch()}function Se(K,de){K.className!==void 0&&(K.scope=K.className,delete K.className)}function xe(K,de){de&&K.beginKeywords&&(K.begin="\\b("+K.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",K.__beforeBegin=Le,K.keywords=K.keywords||K.beginKeywords,delete K.beginKeywords,K.relevance===void 0&&(K.relevance=0))}function Me(K,de){Array.isArray(K.illegal)&&(K.illegal=D(...K.illegal))}function Ke(K,de){if(K.match){if(K.begin||K.end)throw new Error("begin & end are not supported with match");K.begin=K.match,delete K.match}}function it(K,de){K.relevance===void 0&&(K.relevance=1)}const Ge=(K,de)=>{if(!K.beforeMatch)return;if(K.starts)throw new Error("beforeMatch cannot be used with starts");const ye=Object.assign({},K);Object.keys(K).forEach(He=>{delete K[He]}),K.keywords=ye.keywords,K.begin=x(ye.beforeMatch,b(ye.begin)),K.starts={relevance:0,contains:[Object.assign(ye,{endsParent:!0})]},K.relevance=0,delete ye.beforeMatch},he=["of","and","for","in","not","or","if","then","parent","list","value"],Qe="keyword";function Ye(K,de,ye=Qe){const He=Object.create(null);return typeof K=="string"?Ft(ye,K.split(" ")):Array.isArray(K)?Ft(ye,K):Object.keys(K).forEach(function(Dt){Object.assign(He,Ye(K[Dt],de,Dt))}),He;function Ft(Dt,$e){de&&($e=$e.map(Oe=>Oe.toLowerCase())),$e.forEach(function(Oe){const Xe=Oe.split("|");He[Xe[0]]=[Dt,Ht(Xe[0],Xe[1])]})}}function Ht(K,de){return de?Number(de):we(K)?0:1}function we(K){return he.includes(K.toLowerCase())}const Je={},st=K=>{console.error(K)},Vn=(K,...de)=>{console.log(`WARN: ${K}`,...de)},bt=(K,de)=>{Je[`${K}/${de}`]||(console.log(`Deprecated as of ${K}. ${de}`),Je[`${K}/${de}`]=!0)},Ee=new Error;function ft(K,de,{key:ye}){let He=0;const Ft=K[ye],Dt={},$e={};for(let Oe=1;Oe<=de.length;Oe++)$e[Oe+He]=Ft[Oe],Dt[Oe+He]=!0,He+=j(de[Oe-1]);K[ye]=$e,K[ye]._emit=Dt,K[ye]._multi=!0}function pn(K){if(Array.isArray(K.begin)){if(K.skip||K.excludeBegin||K.returnBegin)throw st("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ee;if(typeof K.beginScope!="object"||K.beginScope===null)throw st("beginScope must be object"),Ee;ft(K,K.begin,{key:"beginScope"}),K.begin=N(K.begin,{joinWith:""})}}function Ci(K){if(Array.isArray(K.end)){if(K.skip||K.excludeEnd||K.returnEnd)throw st("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ee;if(typeof K.endScope!="object"||K.endScope===null)throw st("endScope must be object"),Ee;ft(K,K.end,{key:"endScope"}),K.end=N(K.end,{joinWith:""})}}function In(K){K.scope&&typeof K.scope=="object"&&K.scope!==null&&(K.beginScope=K.scope,delete K.scope)}function Mn(K){In(K),typeof K.beginScope=="string"&&(K.beginScope={_wrap:K.beginScope}),typeof K.endScope=="string"&&(K.endScope={_wrap:K.endScope}),pn(K),Ci(K)}function mn(K){function de($e,Oe){return new RegExp(g($e),"m"+(K.case_insensitive?"i":"")+(K.unicodeRegex?"u":"")+(Oe?"g":""))}class ye{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Oe,Xe){Xe.position=this.position++,this.matchIndexes[this.matchAt]=Xe,this.regexes.push([Xe,Oe]),this.matchAt+=j(Oe)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Oe=this.regexes.map(Xe=>Xe[1]);this.matcherRe=de(N(Oe,{joinWith:"|"}),!0),this.lastIndex=0}exec(Oe){this.matcherRe.lastIndex=this.lastIndex;const Xe=this.matcherRe.exec(Oe);if(!Xe)return null;const on=Xe.findIndex((Yn,Hs)=>Hs>0&&Yn!==void 0),St=this.matchIndexes[on];return Xe.splice(0,on),Object.assign(Xe,St)}}class He{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Oe){if(this.multiRegexes[Oe])return this.multiRegexes[Oe];const Xe=new ye;return this.rules.slice(Oe).forEach(([on,St])=>Xe.addRule(on,St)),Xe.compile(),this.multiRegexes[Oe]=Xe,Xe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Oe,Xe){this.rules.push([Oe,Xe]),Xe.type==="begin"&&this.count++}exec(Oe){const Xe=this.getMatcher(this.regexIndex);Xe.lastIndex=this.lastIndex;let on=Xe.exec(Oe);if(this.resumingScanAtSamePosition()&&!(on&&on.index===this.lastIndex)){const St=this.getMatcher(0);St.lastIndex=this.lastIndex+1,on=St.exec(Oe)}return on&&(this.regexIndex+=on.position+1,this.regexIndex===this.count&&this.considerAll()),on}}function Ft($e){const Oe=new He;return $e.contains.forEach(Xe=>Oe.addRule(Xe.begin,{rule:Xe,type:"begin"})),$e.terminatorEnd&&Oe.addRule($e.terminatorEnd,{type:"end"}),$e.illegal&&Oe.addRule($e.illegal,{type:"illegal"}),Oe}function Dt($e,Oe){const Xe=$e;if($e.isCompiled)return Xe;[Se,Ke,Mn,Ge].forEach(St=>St($e,Oe)),K.compilerExtensions.forEach(St=>St($e,Oe)),$e.__beforeBegin=null,[xe,Me,it].forEach(St=>St($e,Oe)),$e.isCompiled=!0;let on=null;return typeof $e.keywords=="object"&&$e.keywords.$pattern&&($e.keywords=Object.assign({},$e.keywords),on=$e.keywords.$pattern,delete $e.keywords.$pattern),on=on||/\w+/,$e.keywords&&($e.keywords=Ye($e.keywords,K.case_insensitive)),Xe.keywordPatternRe=de(on,!0),Oe&&($e.begin||($e.begin=/\B|\b/),Xe.beginRe=de(Xe.begin),!$e.end&&!$e.endsWithParent&&($e.end=/\B|\b/),$e.end&&(Xe.endRe=de(Xe.end)),Xe.terminatorEnd=g(Xe.end)||"",$e.endsWithParent&&Oe.terminatorEnd&&(Xe.terminatorEnd+=($e.end?"|":"")+Oe.terminatorEnd)),$e.illegal&&(Xe.illegalRe=de($e.illegal)),$e.contains||($e.contains=[]),$e.contains=[].concat(...$e.contains.map(function(St){return le(St==="self"?$e:St)})),$e.contains.forEach(function(St){Dt(St,Xe)}),$e.starts&&Dt($e.starts,Oe),Xe.matcher=Ft(Xe),Xe}if(K.compilerExtensions||(K.compilerExtensions=[]),K.contains&&K.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return K.classNameAliases=i(K.classNameAliases||{}),Dt(K)}function ie(K){return K?K.endsWithParent||ie(K.starts):!1}function le(K){return K.variants&&!K.cachedVariants&&(K.cachedVariants=K.variants.map(function(de){return i(K,{variants:null},de)})),K.cachedVariants?K.cachedVariants:ie(K)?i(K,{starts:K.starts?i(K.starts):null}):Object.isFrozen(K)?i(K):K}var Pe="11.11.1";class De extends Error{constructor(de,ye){super(de),this.name="HTMLInjectionError",this.html=ye}}const Ue=n,Mt=i,Ni=Symbol("nomatch"),Ot=7,Bn=function(K){const de=Object.create(null),ye=Object.create(null),He=[];let Ft=!0;const Dt="Could not find the language '{}', did you forget to load/include a language module?",$e={disableAutodetect:!0,name:"Plain text",contains:[]};let Oe={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:_};function Xe(be){return Oe.noHighlightRe.test(be)}function on(be){let Fe=be.className+" ";Fe+=be.parentNode?be.parentNode.className:"";const Be=Oe.languageDetectRe.exec(Fe);if(Be){const Et=q(Be[1]);return Et||(Vn(Dt.replace("{}",Be[1])),Vn("Falling back to no-highlight mode for this block.",be)),Et?Be[1]:"no-highlight"}return Fe.split(/\s+/).find(Et=>Xe(Et)||q(Et))}function St(be,Fe,Be){let Et="",rn="";typeof Fe=="object"?(Et=be,Be=Fe.ignoreIllegals,rn=Fe.language):(bt("10.7.0","highlight(lang, code, ...args) has been deprecated."),bt("10.7.0",`Please use highlight(code, options) instead.
|
|
159
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),rn=be,Et=Fe),Be===void 0&&(Be=!0);const Xn={code:Et,language:rn};tn("before:highlight",Xn);const Li=Xn.result?Xn.result:Yn(Xn.language,Xn.code,Be);return Li.code=Xn.code,tn("after:highlight",Li),Li}function Yn(be,Fe,Be,Et){const rn=Object.create(null);function Xn(Te,We){return Te.keywords[We]}function Li(){if(!nt.keywords){$n.addText(Ut);return}let Te=0;nt.keywordPatternRe.lastIndex=0;let We=nt.keywordPatternRe.exec(Ut),dt="";for(;We;){dt+=Ut.substring(Te,We.index);const Tt=mi.case_insensitive?We[0].toLowerCase():We[0],bn=Xn(nt,Tt);if(bn){const[ys,vc]=bn;if($n.addText(dt),dt="",rn[Tt]=(rn[Tt]||0)+1,rn[Tt]<=Ot&&(ta+=vc),ys.startsWith("_"))dt+=We[0];else{const Nh=mi.classNameAliases[ys]||ys;is(We[0],Nh)}}else dt+=We[0];Te=nt.keywordPatternRe.lastIndex,We=nt.keywordPatternRe.exec(Ut)}dt+=Ut.substring(Te),$n.addText(dt)}function ki(){if(Ut==="")return;let Te=null;if(typeof nt.subLanguage=="string"){if(!de[nt.subLanguage]){$n.addText(Ut);return}Te=Yn(nt.subLanguage,Ut,!0,Rh[nt.subLanguage]),Rh[nt.subLanguage]=Te._top}else Te=ns(Ut,nt.subLanguage.length?nt.subLanguage:null);nt.relevance>0&&(ta+=Te.relevance),$n.__addSublanguage(Te._emitter,Te.language)}function Yt(){nt.subLanguage!=null?ki():Li(),Ut=""}function is(Te,We){Te!==""&&($n.startScope(We),$n.addText(Te),$n.endScope())}function Th(Te,We){let dt=1;const Tt=We.length-1;for(;dt<=Tt;){if(!Te._emit[dt]){dt++;continue}const bn=mi.classNameAliases[Te[dt]]||Te[dt],ys=We[dt];bn?is(ys,bn):(Ut=ys,Li(),Ut=""),dt++}}function qo(Te,We){return Te.scope&&typeof Te.scope=="string"&&$n.openNode(mi.classNameAliases[Te.scope]||Te.scope),Te.beginScope&&(Te.beginScope._wrap?(is(Ut,mi.classNameAliases[Te.beginScope._wrap]||Te.beginScope._wrap),Ut=""):Te.beginScope._multi&&(Th(Te.beginScope,We),Ut="")),nt=Object.create(Te,{parent:{value:nt}}),nt}function mc(Te,We,dt){let Tt=z(Te.endRe,dt);if(Tt){if(Te["on:end"]){const bn=new t(Te);Te["on:end"](We,bn),bn.isMatchIgnored&&(Tt=!1)}if(Tt){for(;Te.endsParent&&Te.parent;)Te=Te.parent;return Te}}if(Te.endsWithParent)return mc(Te.parent,We,dt)}function Go(Te){return nt.matcher.regexIndex===0?(Ut+=Te[0],1):(na=!0,0)}function Zp(Te){const We=Te[0],dt=Te.rule,Tt=new t(dt),bn=[dt.__beforeBegin,dt["on:begin"]];for(const ys of bn)if(ys&&(ys(Te,Tt),Tt.isMatchIgnored))return Go(We);return dt.skip?Ut+=We:(dt.excludeBegin&&(Ut+=We),Yt(),!dt.returnBegin&&!dt.excludeBegin&&(Ut=We)),qo(dt,Te),dt.returnBegin?0:We.length}function Ui(Te){const We=Te[0],dt=Fe.substring(Te.index),Tt=mc(nt,Te,dt);if(!Tt)return Ni;const bn=nt;nt.endScope&&nt.endScope._wrap?(Yt(),is(We,nt.endScope._wrap)):nt.endScope&&nt.endScope._multi?(Yt(),Th(nt.endScope,Te)):bn.skip?Ut+=We:(bn.returnEnd||bn.excludeEnd||(Ut+=We),Yt(),bn.excludeEnd&&(Ut=We));do nt.scope&&$n.closeNode(),!nt.skip&&!nt.subLanguage&&(ta+=nt.relevance),nt=nt.parent;while(nt!==Tt.parent);return Tt.starts&&qo(Tt.starts,Te),bn.returnEnd?0:We.length}function gc(){const Te=[];for(let We=nt;We!==mi;We=We.parent)We.scope&&Te.unshift(We.scope);Te.forEach(We=>$n.openNode(We))}let Ja={};function Ko(Te,We){const dt=We&&We[0];if(Ut+=Te,dt==null)return Yt(),0;if(Ja.type==="begin"&&We.type==="end"&&Ja.index===We.index&&dt===""){if(Ut+=Fe.slice(We.index,We.index+1),!Ft){const Tt=new Error(`0 width match regex (${be})`);throw Tt.languageName=be,Tt.badRule=Ja.rule,Tt}return 1}if(Ja=We,We.type==="begin")return Zp(We);if(We.type==="illegal"&&!Be){const Tt=new Error('Illegal lexeme "'+dt+'" for mode "'+(nt.scope||"<unnamed>")+'"');throw Tt.mode=nt,Tt}else if(We.type==="end"){const Tt=Ui(We);if(Tt!==Ni)return Tt}if(We.type==="illegal"&&dt==="")return Ut+=`
|
|
160
|
-
`,1;if(_c>1e5&&_c>We.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ut+=dt,dt.length}const mi=q(be);if(!mi)throw st(Dt.replace("{}",be)),new Error('Unknown language: "'+be+'"');const Ah=mn(mi);let Vo="",nt=Et||Ah;const Rh={},$n=new Oe.__emitter(Oe);gc();let Ut="",ta=0,Sr=0,_c=0,na=!1;try{if(mi.__emitTokens)mi.__emitTokens(Fe,$n);else{for(nt.matcher.considerAll();;){_c++,na?na=!1:nt.matcher.considerAll(),nt.matcher.lastIndex=Sr;const Te=nt.matcher.exec(Fe);if(!Te)break;const We=Fe.substring(Sr,Te.index),dt=Ko(We,Te);Sr=Te.index+dt}Ko(Fe.substring(Sr))}return $n.finalize(),Vo=$n.toHTML(),{language:be,value:Vo,relevance:ta,illegal:!1,_emitter:$n,_top:nt}}catch(Te){if(Te.message&&Te.message.includes("Illegal"))return{language:be,value:Ue(Fe),illegal:!0,relevance:0,_illegalBy:{message:Te.message,index:Sr,context:Fe.slice(Sr-100,Sr+100),mode:Te.mode,resultSoFar:Vo},_emitter:$n};if(Ft)return{language:be,value:Ue(Fe),illegal:!1,relevance:0,errorRaised:Te,_emitter:$n,_top:nt};throw Te}}function Hs(be){const Fe={value:Ue(be),illegal:!1,relevance:0,_top:$e,_emitter:new Oe.__emitter(Oe)};return Fe._emitter.addText(be),Fe}function ns(be,Fe){Fe=Fe||Oe.languages||Object.keys(de);const Be=Hs(be),Et=Fe.filter(q).filter(Ae).map(Yt=>Yn(Yt,be,!1));Et.unshift(Be);const rn=Et.sort((Yt,is)=>{if(Yt.relevance!==is.relevance)return is.relevance-Yt.relevance;if(Yt.language&&is.language){if(q(Yt.language).supersetOf===is.language)return 1;if(q(is.language).supersetOf===Yt.language)return-1}return 0}),[Xn,Li]=rn,ki=Xn;return ki.secondBest=Li,ki}function pi(be,Fe,Be){const Et=Fe&&ye[Fe]||Be;be.classList.add("hljs"),be.classList.add(`language-${Et}`)}function Kt(be){let Fe=null;const Be=on(be);if(Xe(Be))return;if(tn("before:highlightElement",{el:be,language:Be}),be.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",be);return}if(be.children.length>0&&(Oe.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(be)),Oe.throwUnescapedHTML))throw new De("One of your code blocks includes unescaped HTML.",be.innerHTML);Fe=be;const Et=Fe.textContent,rn=Be?St(Et,{language:Be,ignoreIllegals:!0}):ns(Et);be.innerHTML=rn.value,be.dataset.highlighted="yes",pi(be,Be,rn.language),be.result={language:rn.language,re:rn.relevance,relevance:rn.relevance},rn.secondBest&&(be.secondBest={language:rn.secondBest.language,relevance:rn.secondBest.relevance}),tn("after:highlightElement",{el:be,result:rn,text:Et})}function re(be){Oe=Mt(Oe,be)}const ht=()=>{rt(),bt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Vt(){rt(),bt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let xt=!1;function rt(){function be(){rt()}if(document.readyState==="loading"){xt||window.addEventListener("DOMContentLoaded",be,!1),xt=!0;return}document.querySelectorAll(Oe.cssSelector).forEach(Kt)}function xn(be,Fe){let Be=null;try{Be=Fe(K)}catch(Et){if(st("Language definition for '{}' could not be registered.".replace("{}",be)),Ft)st(Et);else throw Et;Be=$e}Be.name||(Be.name=be),de[be]=Be,Be.rawDefinition=Fe.bind(null,K),Be.aliases&&se(Be.aliases,{languageName:be})}function gn(be){delete de[be];for(const Fe of Object.keys(ye))ye[Fe]===be&&delete ye[Fe]}function je(){return Object.keys(de)}function q(be){return be=(be||"").toLowerCase(),de[be]||de[ye[be]]}function se(be,{languageName:Fe}){typeof be=="string"&&(be=[be]),be.forEach(Be=>{ye[Be.toLowerCase()]=Fe})}function Ae(be){const Fe=q(be);return Fe&&!Fe.disableAutodetect}function lt(be){be["before:highlightBlock"]&&!be["before:highlightElement"]&&(be["before:highlightElement"]=Fe=>{be["before:highlightBlock"](Object.assign({block:Fe.el},Fe))}),be["after:highlightBlock"]&&!be["after:highlightElement"]&&(be["after:highlightElement"]=Fe=>{be["after:highlightBlock"](Object.assign({block:Fe.el},Fe))})}function ct(be){lt(be),He.push(be)}function Pt(be){const Fe=He.indexOf(be);Fe!==-1&&He.splice(Fe,1)}function tn(be,Fe){const Be=be;He.forEach(function(Et){Et[Be]&&Et[Be](Fe)})}function Lt(be){return bt("10.7.0","highlightBlock will be removed entirely in v12.0"),bt("10.7.0","Please use highlightElement now."),Kt(be)}Object.assign(K,{highlight:St,highlightAuto:ns,highlightAll:rt,highlightElement:Kt,highlightBlock:Lt,configure:re,initHighlighting:ht,initHighlightingOnLoad:Vt,registerLanguage:xn,unregisterLanguage:gn,listLanguages:je,getLanguage:q,registerAliases:se,autoDetection:Ae,inherit:Mt,addPlugin:ct,removePlugin:Pt}),K.debugMode=function(){Ft=!1},K.safeMode=function(){Ft=!0},K.versionString=Pe,K.regex={concat:x,lookahead:b,either:D,optional:w,anyNumberOfTimes:S};for(const be in ot)typeof ot[be]=="object"&&e(ot[be]);return Object.assign(K,ot),K},Gt=Bn({});return Gt.newInstance=()=>Bn({}),V_=Gt,Gt.HighlightJS=Gt,Gt.default=Gt,V_}var Mz=Lz();const Rs=$b(Mz);function g2(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},d={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(d);const f={match:/\\"/},p={className:"string",begin:/'/,end:/'/},_={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],D={match:/(\/[a-z._-]+)+/},j=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],z=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],T=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],N=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:x,literal:E,built_in:[...j,...z,"set","shopt",...T,...N]},contains:[S,e.SHEBANG(),w,g,o,c,D,d,f,p,_,n]}}const _2="[A-Za-z$_][0-9A-Za-z$_]*",Oz=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Dz=["true","false","null","undefined","NaN","Infinity"],tR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],nR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],iR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],jz=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Iz=[].concat(iR,tR,nR);function v2(e){const t=e.regex,n=(O,{after:W})=>{const U="</"+O[0].slice(1);return O.input.indexOf(U,W)!==-1},i=_2,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,W)=>{const U=O[0].length+O.index,R=O.input[U];if(R==="<"||R===","){W.ignoreMatch();return}R===">"&&(n(O,{after:U})||W.ignoreMatch());let Y;const Z=O.input.substring(U);if(Y=Z.match(/^\s*=/)){W.ignoreMatch();return}if((Y=Z.match(/^\s+extends\s+/))&&Y.index===0){W.ignoreMatch();return}}},d={$pattern:_2,keyword:Oz,literal:Dz,built_in:Iz,"variable.language":jz},f="[0-9](_?[0-9])*",p=`\\.(${f})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${_})((${p})|\\.)?|(${p}))[eE][+-]?(${f})\\b`},{begin:`\\b(${_})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},j={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},z=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,{match:/\$\d+/},g];b.contains=z.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(z)});const T=[].concat(j,b.contains),N=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:N},H={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},F={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...tR,...nR]}},J={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},pe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[L],illegal:/%/},G={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function P(O){return t.concat("(?!",O.join("|"),")")}const A={match:t.concat(/\b/,P([...iR,"super","import"].map(O=>`${O}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},$={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},L]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:F},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),J,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,j,{match:/\$\d+/},g,F,{scope:"attr",match:i+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[j,e.REGEXP_MODE,{className:"function",begin:k,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},pe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[L,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},$,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[L]},A,G,H,M,{match:/\$[(.]/}]}}function Bz(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function y2(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,f={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},p={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},_={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(p,{contains:[]}),b=e.inherit(_,{contains:[]});p.contains.push(b),_.contains.push(g);let S=[n,f];return[p,_,g,b].forEach(D=>{D.contains=D.contains.concat(S)}),S=S.concat(p,_),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},n,o,p,_,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,i,f,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function b2(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},f={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},_={begin:/\{\{/,relevance:0},g={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,f],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,f],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,f,_,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,f,_,p]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,_,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,_,p]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b="[0-9](_?[0-9])*",S=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,w=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${S}))[eE][+-]?(${b})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${b})[jJ](?=${w})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},D={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",f,x,g,e.HASH_COMMENT_MODE]}]};return p.contains=[g,x,f],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[f,x,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},g,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[D]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[x,D,g]}]}}const cp="[A-Za-z$_][0-9A-Za-z$_]*",sR=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],rR=["true","false","null","undefined","NaN","Infinity"],aR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],oR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],lR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],cR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],uR=[].concat(lR,aR,oR);function $z(e){const t=e.regex,n=(O,{after:W})=>{const U="</"+O[0].slice(1);return O.input.indexOf(U,W)!==-1},i=cp,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,W)=>{const U=O[0].length+O.index,R=O.input[U];if(R==="<"||R===","){W.ignoreMatch();return}R===">"&&(n(O,{after:U})||W.ignoreMatch());let Y;const Z=O.input.substring(U);if(Y=Z.match(/^\s*=/)){W.ignoreMatch();return}if((Y=Z.match(/^\s+extends\s+/))&&Y.index===0){W.ignoreMatch();return}}},d={$pattern:cp,keyword:sR,literal:rR,built_in:uR,"variable.language":cR},f="[0-9](_?[0-9])*",p=`\\.(${f})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${_})((${p})|\\.)?|(${p}))[eE][+-]?(${f})\\b`},{begin:`\\b(${_})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},j={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},z=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,{match:/\$\d+/},g];b.contains=z.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(z)});const T=[].concat(j,b.contains),N=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:N},H={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},F={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...aR,...oR]}},J={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},pe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[L],illegal:/%/},G={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function P(O){return t.concat("(?!",O.join("|"),")")}const A={match:t.concat(/\b/,P([...lR,"super","import"].map(O=>`${O}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},$={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},L]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:F},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),J,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,E,j,{match:/\$\d+/},g,F,{scope:"attr",match:i+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[j,e.REGEXP_MODE,{className:"function",begin:k,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},pe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[L,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},$,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[L]},A,G,H,M,{match:/\$[(.]/}]}}function S2(e){const t=e.regex,n=$z(e),i=cp,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},c={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},f=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],p={$pattern:cp,keyword:sR.concat(f),literal:rR,built_in:uR.concat(r),"variable.language":cR},_={className:"meta",begin:"@"+i},g=(x,E,D)=>{const j=x.contains.findIndex(z=>z.label===E);if(j===-1)throw new Error("can not find mode to replace");x.contains.splice(j,1,D)};Object.assign(n.keywords,p),n.exports.PARAMS_CONTAINS.push(_);const b=n.contains.find(x=>x.scope==="attr"),S=Object.assign({},b,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,b,S]),n.contains=n.contains.concat([_,o,c,S]),g(n,"shebang",e.SHEBANG()),g(n,"use_strict",d);const w=n.contains.find(x=>x.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const Pz=/\[\[wiki:([^\]]+)\]\]/g,zz=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,Hz=/^(\S[^:]*?):[ \t]*(.*)$/,Fz=new XA({gfm:!0,breaks:!1}),w2={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},Y_=nH();function $s(e,t={}){const{entries:n,content:i}=qz(e),r=Vz(i,t.resolveWikiLink),o=Fz.parse(r,{async:!1}),c=Kz(n),d=Zu.sanitize(c+o,w2),f=new DOMParser().parseFromString(d,"text/html");return Xz(f,t.omitDuplicateTitle),Yz(f),Zz(f),Qz(f),{html:Zu.sanitize(f.body.innerHTML,w2),toc:eH(f)}}function Uz(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function Wz(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new TextDecoder().decode(n)}function qz(e){const t=zz.exec(e);return t?{entries:Gz(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function Gz(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=Hz.exec(i);if(r){const[,d="",f=""]=r;t.push({key:d.trim(),value:f.trim()});continue}const o=t[t.length-1];if(!o)continue;const c=i.trim();o.value=o.value?`${o.value} ${c}`:c}return t}function Kz(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${Ju(n.key)}</dt><dd>${Ju(n.value)}</dd>`).join("")}</dl>`}function Vz(e,t){return e.replace(Pz,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return Ju(`[[wiki:${r}]]`);const o=t(r);if(o===null)return Ju(`[[wiki:${r}]]`);const c=Ju(r),d=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${d}">${c}</a>`})}function Yz(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=rH(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function Xz(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||x2(n.textContent??"")===x2(t)&&n.remove()}function Zz(e){for(const t of e.querySelectorAll("pre > code")){const n=iH(t.className),i=t.textContent??"",r=t.parentElement;if(!r)continue;if(n==="mermaid"){const c=e.createElement("div");c.className="diagram-block",c.setAttribute("data-mermaid-source",Uz(i)),c.setAttribute("data-diagram-state","pending"),r.replaceWith(c);continue}const o=tH(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(Jz(e,n||"text"),r.firstChild)}}function Jz(e,t){const n=e.createElement("div");n.className="code-block-toolbar";const i=e.createElement("span");i.className="code-block-dots",i.setAttribute("aria-hidden","true");for(let c=0;c<3;c++)i.append(e.createElement("span"));const r=e.createElement("span");r.className="code-block-language",r.textContent=t;const o=e.createElement("button");return o.className="copy-code",o.type="button",o.dataset.action="copy-code",o.setAttribute("aria-label",`Copy ${t} code`),o.textContent="Copy",n.append(i,r,o),n}function Qz(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";sH(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function eH(e){return[...e.querySelectorAll("h2, h3")].map(t=>({id:t.id,text:t.textContent?.trim()??t.id,level:t.tagName.toLowerCase()==="h2"?2:3}))}function tH(e,t){return t&&Y_.getLanguage(t)?Y_.highlight(e,{language:t}).value:Y_.highlightAuto(e).value}function nH(){return Rs.registerLanguage("bash",g2),Rs.registerLanguage("sh",g2),Rs.registerLanguage("javascript",v2),Rs.registerLanguage("js",v2),Rs.registerLanguage("json",Bz),Rs.registerLanguage("markdown",y2),Rs.registerLanguage("md",y2),Rs.registerLanguage("python",b2),Rs.registerLanguage("py",b2),Rs.registerLanguage("typescript",S2),Rs.registerLanguage("ts",S2),Rs}function iH(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function sH(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function rH(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function x2(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Ju(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const aH="modulepreload",oH=function(e){return"/console/"+e},C2={},lH=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let f=function(p){return Promise.all(p.map(_=>Promise.resolve(_).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");r=f(n.map(p=>{if(p=oH(p),p in C2)return;C2[p]=!0;const _=p.endsWith(".css"),g=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const b=document.createElement("link");if(b.rel=_?"stylesheet":aH,_||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),_)return new Promise((S,w)=>{b.addEventListener("load",S),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return r.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},cH=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",uH=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),hH=/^on/i,dH={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},k2="diagramInteractionBound",fH=/^oklch\s*\(\s*([^)]+)\s*\)$/i,pH=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Os=[25,50,75,100,125,150,200],mH=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let X_=null;const E2=new WeakSet;let gH=0,_H=0,fh=null;function Ia(e){const t=e.trim();if(!t)return t;const n=PH(t);return n?zH(n):t}function zp(e){if(E2.has(e))return;E2.add(e),T2(e);const t=e instanceof Node?e:document.body;new MutationObserver(i=>{let r=!1;for(const o of i)if(o.type==="childList"){fh&&!fh.trigger.isConnected&&Uu(!1);for(const c of o.addedNodes)if(c instanceof Element&&(c.matches?.(".diagram-block[data-mermaid-source]")||c.querySelector?.(".diagram-block[data-mermaid-source]"))){r=!0;break}if(r)break}r&&T2(e)}).observe(t,{childList:!0,subtree:!0})}function T2(e){const t=e.querySelectorAll(cH);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",vH(n))}async function vH(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=Wz(t)}catch{Z_(e,"Invalid diagram source");return}if(!n.trim()){Z_(e,"Empty diagram source");return}try{const i=await bH(),r=`mermaid-diagram-${++gH}`,{svg:o}=await i.render(r,n);e.innerHTML=yH(o),xH(e,o),CH(e),kH(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);Z_(e,r)}}function Z_(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function yH(e){const t=(n,i)=>{hH.test(i.attrName)&&(i.keepAttr=!1)};Zu.addHook("uponSanitizeAttribute",t);try{return Zu.sanitize(e,dH)}finally{Zu.removeHook("uponSanitizeAttribute",t)}}async function bH(){return X_||(X_=(async()=>{const e=await lH(()=>import("./mermaid.core-kwH-UxKY.js").then(n=>n.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:SH(),themeCSS:wH(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),X_}function SH(){const e=getComputedStyle(document.documentElement),t=(x,E)=>{const D=e.getPropertyValue(x).trim();return Ia(D||E)},n=(x,E)=>e.getPropertyValue(x).trim()||E,i=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),c=t("--aurora","#8bd7e6"),d=t("--aurora-deep","#1f8aa8"),f=t("--coral","#ef7c63"),p=t("--ink-deep","#1d2734"),_=t("--ink-fog","#a6afbb"),g=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,c,f,Ia("oklch(70% 0.11 68)"),d,Ia("oklch(76% 0.09 205)"),o,Ia("oklch(68% 0.14 30)"),_,Ia("oklch(62% 0.08 228)"),Ia("oklch(52% 0.05 248)")],w=Object.fromEntries(mH.map((x,E)=>[x,S[E]??p]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:g,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:g,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:d,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:r,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:g,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:g,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function wH(){const e=getComputedStyle(document.documentElement),t=(p,_)=>{const g=e.getPropertyValue(p).trim();return Ia(g||_)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),c=Ia("oklch(15% 0.04 250 / 34%)"),d=t("--surface-glass","#1d2734"),f=t("--ink-pearl","#e6e9ef");return`
|
|
161
|
-
.node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
|
|
162
|
-
stroke: ${n};
|
|
163
|
-
fill: ${d};
|
|
164
|
-
}
|
|
165
|
-
.edgePath path, .messageLine0, .messageLine1, .relation {
|
|
166
|
-
stroke: ${r};
|
|
167
|
-
}
|
|
168
|
-
.nodeLabel, .edgeLabel, .actor text, .messageText {
|
|
169
|
-
fill: ${f};
|
|
170
|
-
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
171
|
-
}
|
|
172
|
-
.pieCircle {
|
|
173
|
-
stroke: ${n};
|
|
174
|
-
stroke-width: 1.35px;
|
|
175
|
-
opacity: 0.96;
|
|
176
|
-
filter: drop-shadow(0 0 1.5px ${c});
|
|
177
|
-
}
|
|
178
|
-
.pieOuterCircle {
|
|
179
|
-
stroke: ${i};
|
|
180
|
-
opacity: 0.7;
|
|
181
|
-
}
|
|
182
|
-
.slice, .legend text, .pieTitleText {
|
|
183
|
-
fill: ${f};
|
|
184
|
-
paint-order: stroke;
|
|
185
|
-
stroke: ${o};
|
|
186
|
-
stroke-width: 3px;
|
|
187
|
-
stroke-linejoin: round;
|
|
188
|
-
font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
|
|
189
|
-
}
|
|
190
|
-
.slice {
|
|
191
|
-
font-weight: 600;
|
|
192
|
-
letter-spacing: 0.04em;
|
|
193
|
-
font-style: italic;
|
|
194
|
-
}
|
|
195
|
-
.pieTitleText {
|
|
196
|
-
font-weight: 600;
|
|
197
|
-
letter-spacing: 0.12em;
|
|
198
|
-
font-style: italic;
|
|
199
|
-
}
|
|
200
|
-
.legend text {
|
|
201
|
-
font-weight: 500;
|
|
202
|
-
letter-spacing: 0.03em;
|
|
203
|
-
}
|
|
204
|
-
.legend rect {
|
|
205
|
-
rx: 999px;
|
|
206
|
-
ry: 999px;
|
|
207
|
-
opacity: 0.9;
|
|
208
|
-
stroke: ${o};
|
|
209
|
-
stroke-width: 1.5px;
|
|
210
|
-
paint-order: stroke;
|
|
211
|
-
filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
|
|
212
|
-
}
|
|
213
|
-
`}function xH(e,t){const n=new DOMParser().parseFromString(t,"image/svg+xml"),i=Array.from(n.querySelectorAll("a")),r=Array.from(e.querySelectorAll("a")),o=Math.min(i.length,r.length);for(let c=0;c<o;c++){const d=i[c],f=r[c];if(!d||!f)continue;const p=d.getAttribute("href")??d.getAttribute("xlink:href")??"",_=dR(p);_&&f.setAttribute("href",_)}}function CH(e){const t=e.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}const{x:i,y:r,width:o,height:c}=n;!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(c)||i<0||r<0||o<=0||c<=0||t.setAttribute("viewBox",`${Fl(i)} ${Fl(r)} ${Fl(o)} ${Fl(c)}`)}function kH(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),IH(e),e.dataset[k2]!=="true"&&(e.dataset[k2]="true",e.addEventListener("click",EH),e.addEventListener("keydown",TH))}function EH(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||up(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),hR(t))}function TH(e){if(e.key!=="Enter"&&e.key!==" "||up(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),hR(t))}function hR(e){const t=e.querySelector("svg");if(!t)return;Uu(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++_H,o=`diagram-lightbox-title-${r}`;i.className="diagram-lightbox",i.setAttribute("aria-labelledby",o),n||(i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1);const c=document.createElement("div");c.className="diagram-lightbox__frame";const d=document.createElement("div");d.className="diagram-lightbox__header";const f=document.createElement("h2");f.id=o,f.textContent="MANIFEST · DIAGRAM";const p=document.createElement("button");p.className="diagram-lightbox__close",p.type="button",p.setAttribute("aria-label","Close expanded diagram"),p.textContent="Close";const _=document.createElement("div");_.className="diagram-lightbox__controls",_.setAttribute("aria-label","Diagram zoom controls");const g=sf("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=sf("+","Zoom in","in"),w=sf("Fit","Fit diagram to viewport","fit"),x=sf("Reset","Reset diagram zoom","reset");_.append(g,b,S,w,x);const E=document.createElement("div");E.className="diagram-lightbox__viewport";const D=NH(t),j=t.cloneNode(!0);j.removeAttribute("style"),MH(j,`diagram-lightbox-svg-${r}`),E.append(j),d.append(f,_,p),c.append(d,E),i.append(c),document.body.append(i);const z=new AH(E,j,b,D);g.addEventListener("click",()=>z.zoomOut()),S.addEventListener("click",()=>z.zoomIn()),w.addEventListener("click",()=>z.fit()),x.addEventListener("click",()=>z.reset());const T=OH(i),N=F=>{(F.target===i||F.target===p)&&Uu(!0)},L=F=>{if(F.key==="Escape"){F.preventDefault(),Uu(!0);return}z.handleKeyboard(F)||F.key==="Tab"&&jH(F,i)},H={dialog:i,trigger:e,inertStates:T,onClick:N,onKeyDown:L,cleanupPanZoom:()=>z.destroy()};n&&(H.onCancel=F=>{F.preventDefault(),Uu(!0)},i.addEventListener("cancel",H.onCancel),i.showModal()),i.addEventListener("click",N),document.addEventListener("keydown",L,!0),fh=H,z.fit(),p.focus()}function sf(e,t,n){const i=document.createElement("button");return i.className="diagram-lightbox__zoom-button",i.type="button",i.dataset.zoomAction=n,i.setAttribute("aria-label",t),i.textContent=e,i}class AH{constructor(t,n,i,r){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=r,this.applyZoom(this.zoomIndex),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerEnd),t.addEventListener("pointercancel",this.onPointerEnd),t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("dblclick",this.onDoubleClick),window.addEventListener("resize",this.onResize)}viewport;svg;readout;baseSize;zoomIndex=Os.indexOf(100);dragStart=null;pinchStart=null;pointers=new Map;destroy(){this.viewport.removeEventListener("pointerdown",this.onPointerDown),this.viewport.removeEventListener("pointermove",this.onPointerMove),this.viewport.removeEventListener("pointerup",this.onPointerEnd),this.viewport.removeEventListener("pointercancel",this.onPointerEnd),this.viewport.removeEventListener("wheel",this.onWheel),this.viewport.removeEventListener("dblclick",this.onDoubleClick),window.removeEventListener("resize",this.onResize),this.pointers.clear()}zoomIn(){this.zoomAroundViewportCenter(Math.min(this.zoomIndex+1,Os.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Os.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,n=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,i=Math.min(t/this.baseSize.width,n/this.baseSize.height),r=Math.floor(i*100),o=Os.findIndex(d=>d>r),c=o===-1?Os.length-1:Math.max(0,o-1);this.applyZoom(c),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-n)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(rf(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(rf(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=rf(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Fl(this.baseSize.width*i)),this.svg.setAttribute("height",Fl(this.baseSize.height*i)),this.readout.textContent=`${n}%`}zoomAroundViewportCenter(t){const n=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,n.left+n.width/2,n.top+n.height/2)}zoomAroundPoint(t,n,i){if(t===this.zoomIndex)return;const r=this.svgWidth,o=this.svgHeight,c=this.viewport.getBoundingClientRect(),d=this.viewport.scrollLeft+n-c.left,f=this.viewport.scrollTop+i-c.top;this.applyZoom(t),this.viewport.scrollLeft=d/r*this.svgWidth-(n-c.left),this.viewport.scrollTop=f/o*this.svgHeight-(i-c.top)}onPointerDown=t=>{if(t.button!==0||up(t.target))return;const n=t.pointerId??1;if(this.pointers.set(n,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:n},this.viewport.setPointerCapture?.(n)};onPointerMove=t=>{const n=t.pointerId??1;if(this.pointers.has(n)&&this.pointers.set(n,t),this.pinchStart&&this.pointers.size>=2){const i=this.pointerDistance()/this.pinchStart.distance,r=rf(this.pinchStart.zoomIndex)*i;this.applyZoom(LH(r));return}!this.dragStart||this.dragStart.pointerId!==n||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const n=t.pointerId??1;this.pointers.delete(n),this.viewport.releasePointerCapture?.(n),this.dragStart?.pointerId===n&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=t.deltaY<0?Math.min(this.zoomIndex+1,Os.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{up(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Os.indexOf(200)?Os.indexOf(100):Os.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,n]=Array.from(this.pointers.values());return!t||!n?1:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}}function RH(e){const t=A2(e.getAttribute("width")),n=A2(e.getAttribute("height"));if(t&&n)return{width:t,height:n};const i=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],r=i[2],o=i[3],c=r!==void 0&&Number.isFinite(r)&&r>0?r:null,d=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??c??800,height:n??d??600}}function NH(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:RH(e)}function A2(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function Fl(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function LH(e){let t=0,n=Number.POSITIVE_INFINITY;return Os.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function rf(e){return Os[e]??Os[0]}function MH(e,t){const n=e.getAttribute("id")??"";e.setAttribute("id",t);const i=e.querySelector("style");!n||!i?.textContent||(i.textContent=i.textContent.split(`#${n}`).join(`#${t}`))}function Uu(e){const t=fh;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),DH(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),fh=null,e&&t.trigger.isConnected&&t.trigger.focus())}function OH(e){const t=[];for(const n of Array.from(document.body.children))!(n instanceof HTMLElement)||n===e||(t.push({element:n,ariaHidden:n.getAttribute("aria-hidden"),inert:n.inert}),n.inert=!0,n.setAttribute("aria-hidden","true"));return t}function DH(e){for(const t of e)t.element.inert=t.inert,t.ariaHidden===null?t.element.removeAttribute("aria-hidden"):t.element.setAttribute("aria-hidden",t.ariaHidden)}function jH(e,t){const n=Array.from(t.querySelectorAll(uH)).filter($H);if(n.length===0){e.preventDefault(),t.focus();return}const i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function IH(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function up(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!BH(t)}function BH(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function $H(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function dR(e){const t=e.trim();if(!t||t.includes(".."))return null;if(/^[a-z][a-z0-9+.-]*:/i.test(t)){if(/^javascript:/i.test(t)||/^data:/i.test(t))return null;let i;try{i=new URL(t)}catch{return null}return i.origin!==window.location.origin?null:dR(i.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const i=t.slice(7);let r;try{r=decodeURIComponent(i)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(r)?`/entry/${encodeURIComponent(r)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function PH(e){const t=fH.exec(e);if(!t)return null;const n=t[1]?.trim();if(!n)return null;const i=n.indexOf("/"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1).trim():"",c=r.trim().split(/[\s,]+/).filter(Boolean);if(c.length!==3)return null;const[d,f,p]=c;if(!d||!f||!p)return null;const _=J_(d,1),g=J_(f,.4),b=HH(p);if(_===null||g===null||b===null)return null;let S=1;if(i>=0){const w=J_(o,1);if(w===null)return null;S=w}return{L:_,C:g,h:b,alpha:S}}function zH(e){const t=e.h*Math.PI/180,n=e.C*Math.cos(t),i=e.C*Math.sin(t),r=e.L,o=r+.3963377774*n+.2158037573*i,c=r-.1055613458*n-.0638541728*i,d=r-.0894841775*n-1.291485548*i,f=o**3,p=c**3,_=d**3,g=4.0767416621*f-3.3077115913*p+.2309699292*_,b=-1.2684380046*f+2.6097574011*p-.3413193965*_,S=-.0041960863*f-.7034186147*p+1.707614701*_,w=af(Q_(g)),x=af(Q_(b)),E=af(Q_(S));if(e.alpha<1){const D=af(e.alpha);return`#${yo(w)}${yo(x)}${yo(E)}${yo(D)}`}return`#${yo(w)}${yo(x)}${yo(E)}`}function J_(e,t){if(!e)return null;if(e.endsWith("%")){const i=Number(e.slice(0,-1));return Number.isFinite(i)?i/100*t:null}const n=Number(e);return Number.isFinite(n)?n:null}function HH(e){const t=pH.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function Q_(e){const t=Math.max(0,Math.min(1,e));return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function af(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function yo(e){return e.toString(16).padStart(2,"0")}const FH=[{icon:"◈",tone:"aurora",text:"Walk me through how this session unfolded"},{icon:"●",tone:"aurora",text:"What is the agent doing right now?"},{icon:"▲",tone:"coral",text:"Flag anything I should review"},{icon:"≡",tone:"brass",text:"Draft a handoff brief"}],UH=32,Wu="session-analyst-artifacts";function WH({context:e}){const{state:t,dispatch:n,send:i,stop:r,reset:o}=BA(e),[c,d]=y.useState(""),f=t.catalog?.clis.find(G=>G.cliId===t.cliId),p=f?.models.find(G=>G.id===t.model),_=t.entries.length>0,g=t.artifacts.length,b=e.hiddenCompanionPanelIds,S=e.onSetCompanionPanelVisible,w=b!==void 0&&S!==void 0,x=b?.includes(Wu)??!1,E=g>0&&!x,D=y.useRef(0),[j,z]=y.useState(0),T=y.useRef(null),N=y.useRef(null),L=t.entries.at(-1),H=y.useRef(_).current,F=_&&!H;y.useLayoutEffect(()=>{const G=N.current;!G||!_||(G.scrollTop=G.scrollHeight)},[_,L?.text,t.entries.length,t.latestActivity,t.phase]),y.useEffect(()=>{const G=N.current;G&&zp(G)},[]),y.useEffect(()=>{const G=D.current;if(D.current=g,!(!w||!S)){if(g===0){if(t.artifactsAutoOpenArmed||n({type:"artifacts-chip-rearm"}),!x){const P=document.activeElement instanceof Element&&document.activeElement.closest(".session-analyst__artifacts")!==null;S(Wu,!1),P&&window.requestAnimationFrame(()=>T.current?.focus())}return}if(G===0&&x&&t.artifactsAutoOpenArmed){S(Wu,!0);return}g>G&&x&&z(P=>P+1)}},[g,x,n,S,t.artifactsAutoOpenArmed,w]);const J=async G=>{const P=G.trim();!P||t.busy||(d(""),await i(P))},pe=y.useCallback(G=>{const P=G.target.closest('[data-action="copy-code"]');if(!P)return;const A=P.closest("pre")?.getAttribute("data-code");A&&GH(P,A)},[]);return u.jsxs("section",{className:`session-analyst__chat-pane ${_?"has-interacted":"is-initial"}`,"aria-label":"Session Analyst chat","data-phase":t.phase,children:[w?u.jsxs("button",{ref:T,type:"button",className:`session-analyst-handle session-analyst-handle--artifacts${g===0?" is-waiting":""}`,"aria-label":E?"Hide Artifacts":"Open Artifacts","aria-pressed":E,"aria-disabled":g===0,tabIndex:g===0?-1:void 0,title:g===0?"Artifacts the analyst publishes appear here":void 0,onClick:()=>{!S||g===0||(E&&n({type:"artifacts-chip-disarm"}),S(Wu,!E))},children:[u.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:E?"«":"»"}),g>0?u.jsx("span",{className:`session-analyst-handle__count${j>0?" is-pulsing":""}`,children:g},j):null,u.jsx("span",{className:"session-analyst-handle__label",children:"ARTIFACTS"})]}):null,u.jsx(KH,{state:t,onReset:()=>{o().then(()=>d("")).catch(()=>{})}}),u.jsxs("div",{className:"session-analyst__workspace",children:[u.jsxs("section",{ref:N,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[_?u.jsx("ol",{className:"session-analyst__transcript",onClick:pe,children:t.entries.map((G,P)=>u.jsx("li",{className:`session-analyst__message session-analyst__message--${G.role}`,children:G.role==="analyst"?u.jsx(qH,{text:G.text,streaming:t.busy&&P===t.entries.length-1}):G.text},`${G.role}-${P}`))}):u.jsxs("div",{className:"session-analyst__hero-wrap",children:[u.jsxs("header",{className:"session-analyst__hero",children:[u.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),u.jsx("h2",{children:"Ask about this session"}),u.jsx("p",{children:"Review, explain, and summarize this session — without affecting the host agent."})]}),u.jsx("div",{className:"session-analyst__suggestions",children:FH.map(G=>u.jsxs("button",{type:"button",onClick:()=>{J(G.text)},children:[u.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":G.tone,"aria-hidden":"true",children:G.icon}),G.text]},G.text))})]}),t.phase!=="idle"?u.jsx(VH,{state:t}):null]}),u.jsx("form",{className:`session-analyst__composer ${_?"is-docked":"is-initial"}${F?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:G=>{G.preventDefault(),J(c)},children:u.jsxs("div",{className:"session-analyst__composer-surface",children:[_?null:u.jsxs("div",{className:"session-analyst__selector-strip","aria-label":"Initial analysis settings",children:[u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis CLI",disabled:t.started||!t.catalog,value:t.cliId,onChange:G=>n({type:"select-cli",cliId:G.target.value}),children:t.catalog?.clis.map(G=>u.jsx("option",{value:G.cliId,disabled:!G.available,children:G.label},G.cliId))})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis model",disabled:t.started||!p,value:t.model,onChange:G=>n({type:"select-model",model:G.target.value}),children:f?.models.map(G=>u.jsx("option",{value:G.id,children:G.label},G.id))})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx("select",{"aria-label":"Analysis effort",disabled:t.started||!p||!p.effortLevels.length,value:t.effort,onChange:G=>n({type:"select-effort",effort:G.target.value}),children:p?.effortLevels.length?p.effortLevels.map(G=>u.jsx("option",{value:G,children:G},G)):u.jsx("option",{value:"",children:"n/a"})})})]}),u.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:"Ask about this session"}),u.jsx("textarea",{id:`analysis-${e.operationId}`,rows:1,placeholder:"Ask about the session…",value:c,onChange:G=>d(G.target.value),onKeyDown:G=>{G.key!=="Enter"||G.shiftKey||G.nativeEvent.isComposing||(G.preventDefault(),J(c))},disabled:t.busy}),t.busy?u.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":"Stop",onClick:()=>{r()},children:u.jsx("span",{"aria-hidden":"true"})}):u.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":"Send",disabled:!c.trim(),children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:u.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]})})]})]})}const qH=y.memo(function({text:t,streaming:n}){const i=y.useRef(t),r=y.useRef(n?t:""),o=y.useRef(null),[c,d]=y.useState(()=>n?$s(t).html:"");i.current=t;const f=y.useMemo(()=>n?null:$s(t).html,[n,t]);return y.useEffect(()=>{if(!n){o.current!==null&&window.clearTimeout(o.current),o.current=null;return}r.current===t||o.current!==null||(o.current=window.setTimeout(()=>{o.current=null;const p=i.current;p!==r.current&&(r.current=p,d($s(p).html))},UH))},[n,t]),y.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]),u.jsx("div",{className:"session-analyst__response markdown-body",dangerouslySetInnerHTML:{__html:f??c}})});function GH(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function KH({state:e,onReset:t}){const n=e.started||e.phase!=="idle"||e.entries.length>0||e.artifacts.length>0;return u.jsxs("header",{className:"session-analyst__panel-head",children:[u.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:"Session Analyst"}),u.jsx("small",{children:"Read-only intelligence for this operation"})]}),u.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":"Reset Session Analyst",onClick:t,disabled:!n,children:"Reset"}),u.jsxs("span",{className:"session-analyst__panel-state",children:[u.jsx("i",{"aria-hidden":"true"}),ZH(e)]})]})}function VH({state:e}){const t=JH(e),n=QH(t),i=XH(e.latestActivity);if(e.phase==="complete")return null;if(e.phase==="stopped")return u.jsxs("div",{className:"session-analyst__receipt is-stopped",role:"status",children:["Stopped · last confirmed: ",i," · ",n]});const r=e.phase==="error",o=YH(e.latestActivity);return u.jsxs("div",{className:`session-analyst__pulse${r?" is-error":""}`,role:r?"alert":"status","aria-live":r?void 0:"polite",children:[r?null:u.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),u.jsxs("div",{className:"session-analyst__pulse-main",children:[u.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),u.jsxs("span",{className:"session-analyst__pulse-copy",children:[u.jsx("strong",{children:r?e.error:o.label},`${e.phase}-${o.label}`),u.jsx("small",{children:r?`Last confirmed activity: ${i}`:o.note})]}),u.jsx("time",{children:n})]}),u.jsx("span",{className:"session-analyst__truth-mark",children:"Last confirmed activity only"})]})}function YH(e){return!e||e.kind==="starting"?{label:"Starting analyst",note:e?.connected?"Analyst connection confirmed":"Starting a new analysis session"}:e.kind==="reasoning"?{label:"Reasoning over session",note:"Thought event received · content hidden"}:e.kind==="tool"?{label:`Using ${e.title}`,note:`Tool status: ${e.status}`}:{label:"Writing answer",note:"Answer chunk received"}}function XH(e){return!e||e.kind==="starting"?"Starting analyst":e.kind==="reasoning"?"Reasoning over session":e.kind==="tool"?`Using ${e.title} (${e.status})`:"Writing answer"}function ZH(e){return e.phase==="error"?"Needs attention":e.busy?"Analyzing":e.phase==="complete"?"Complete":e.phase==="stopped"?"Stopped":"Ready"}function JH(e){const[t,n]=y.useState(()=>Date.now());return y.useEffect(()=>{if(!e.busy)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e.busy,e.runStartedAt]),e.runStartedAt===null?0:Math.max(0,(e.runEndedAt??t)-e.runStartedAt)}function QH(e){return`${Math.floor(e/1e3)}s`}class vr extends Error{constructor(t,n){super(n),this.status=t}status}const eF=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function fR(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await O0(t),mR(await t.json(),t.status)}async function pR(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await O0(t),iF(await t.json(),t.status)}async function ev(e,t,n){return M0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function tF(e,t,n,i){return M0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function nF(e,t,n){return M0(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function M0(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await O0(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new vr(r.status,"Invalid carrier settings mutation response");return{state:mR(o.state,r.status)}}async function O0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new vr(e.status,t)}function mR(e,t){gR(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new vr(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>sF(i,t))}}function iF(e,t){gR(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new vr(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>rF(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function sF(e,t){const n=e;if(!n||typeof n.carrierId!="string"||typeof n.displayName!="string"||typeof n.sourceDisplayName!="string"||typeof n.role!="string"||typeof n.roleDescription!="string"||typeof n.slot!="number"||typeof n.cliType!="string"||typeof n.defaultCliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string"||typeof n.taskForceCapable!="boolean"||!n.taskforce||!Array.isArray(n.taskforce.backends))throw new vr(t,"Invalid carrier settings carrier response");return{carrierId:n.carrierId,displayName:n.displayName,sourceDisplayName:n.sourceDisplayName,role:n.role,roleDescription:n.roleDescription,...n.category?{category:n.category}:{},slot:n.slot,cliType:n.cliType,defaultCliType:n.defaultCliType,model:n.model,...n.effort?{effort:n.effort}:{},taskForceCapable:n.taskForceCapable,taskforce:{backends:n.taskforce.backends.map(i=>oF(i,t))}}}function rF(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.displayName!="string"||!Array.isArray(n.models)||typeof n.defaultModel!="string")throw new vr(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>aF(i,t)),defaultModel:n.defaultModel}}function aF(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new vr(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new vr(t,"Invalid carrier settings effort option");return{modelId:n.modelId,name:n.name,...n.effort?{effort:{levels:n.effort.levels.filter(i=>typeof i=="string"),default:n.effort.default}}:{}}}function oF(e,t){const n=e;if(!n||typeof n.cliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string")throw new vr(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function gR(e,t){const n=[e];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object"))for(const[r,o]of Object.entries(i)){if(eF.has(r))throw new vr(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const lF=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class tr extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function _R(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new tr(t.status,"Invalid agent state response");return n.agentClis.map(i=>_F(i,t.status))}async function cF(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.clis))throw new tr(t.status,"Invalid Agent CLI state response");return n}async function uF(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new tr(t.status,"Invalid tenants response");return n.tenants.map(i=>vF(i,t.status))}async function hF(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new tr(t.status,"Invalid jobs response");return n.tenants}async function dF(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new tr(t.status,"Invalid agent sessions response");return n.sessions.map(i=>Hp(i,t.status))}async function fF(e){const t=await fetch("/api/v1/operations",{signal:e});await ea(t);const n=await t.json();if(!Array.isArray(n.operations))throw new tr(t.status,"Invalid operations response");return{operations:n.operations.map(i=>yF(i,t.status))}}async function pF(e,t,n){const i=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:n});return await ea(i),Hp(await i.json(),i.status)}async function mF(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await ea(n),Hp(await n.json(),n.status)}async function gF(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ea(n)}function Hp(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||Gy(n))throw new tr(t,"Invalid agent session response");return{sessionId:n.sessionId,terminalSessionId:typeof n.terminalSessionId=="string"?n.terminalSessionId:n.sessionId,cwdLabel:n.cwdLabel,label:typeof n.label=="string"?n.label:void 0,cliId:typeof n.cliId=="string"?n.cliId:void 0,cliLabel:typeof n.cliLabel=="string"?n.cliLabel:void 0,status:n.status,turnState:n.turnState==="running"||n.turnState==="ended"?n.turnState:"none",createdAt:n.createdAt,theaterId:typeof n.theaterId=="string"?n.theaterId:void 0,tenantId:typeof n.tenantId=="string"?n.tenantId:void 0,registrationId:typeof n.registrationId=="string"?n.registrationId:void 0,resumeAvailable:n.resumeAvailable===!0}}async function ea(e){if(!e.ok)throw new tr(e.status,`Agent plugin request failed: ${e.status}`)}function _F(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new tr(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function vF(e,t){const n=e;if(!n||typeof n.tenantId!="string"||typeof n.tenantLabel!="string"||typeof n.createdAt!="number"||typeof n.sessions!="number")throw new tr(t,"Invalid tenant response");return n}function yF(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||Gy(n)||Gy(n.payload))throw new tr(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,ts:n.ts}}function Gy(e){return Ky(e,new Set(lF))}function Ky(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Ky(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Ky(i,t))}const bF="active",Vy=new Set(["done","error","aborted"]);function SF(e,t){let n=yR(Yy(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=vR(n,i);return Vy.has(t.status)&&!Vy.has(n.status)&&(n={...n,status:t.status}),n}function vR(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:kF(e.recentEvents,t)};switch(t.type){case"job:registered":return xF(i,n);case"job:finalized":return{...i,status:An(n.status)??"done",finishedAt:Da(n.finishedAt)??t.at,summary:An(n.summary),error:An(n.error)};case"track:begin":return Rl(yR(i,n.request),n,t.id,r=>({...r,startedAt:Da(n.startedAt)??t.at,requestPreview:An(n.requestPreview)}));case"track:status":return Rl(i,n,t.id,r=>({...r,status:An(n.status)??r.status}));case"track:text":return Rl(i,n,t.id,r=>{const o=r.text+(An(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Da(n.textLength)??An(n.text)?.length??0),latestLine:EF(o)||r.latestLine}});case"track:thought":return Rl(i,n,t.id,r=>{const o=r.thought+(An(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Da(n.textLength)??An(n.text)?.length??0)}});case"track:tool":return Rl(i,n,t.id,r=>({...r,status:"stream",tools:CF(r.tools,n)}));case"track:finalized":return Rl(i,n,t.id,r=>{const o=R2(r.text,r.sentTextLength,An(n.fallbackText),Da(n.fallbackTextLength)),c=R2(r.thought,r.sentThoughtLength,An(n.fallbackThought),Da(n.fallbackThoughtLength));return{...r,status:An(n.status)??"done",finishedAt:Da(n.finishedAt)??t.at,error:An(n.error),text:o.text,sentTextLength:o.sentLength,thought:c.text,sentThoughtLength:c.sentLength}});default:return i}}function yR(e,t){if(e.request)return e;const n=wF(t);return n?{...e,request:n}:e}function wF(e){if(typeof e!="object"||e===null)return;const t=e;if(!Array.isArray(t.blocks)||typeof t.additional!="string")return;const n=[];for(const i of t.blocks){if(typeof i!="object"||i===null)return;const r=i;if(typeof r.tag!="string"||typeof r.hint!="string"||typeof r.required!="boolean"||typeof r.present!="boolean"||typeof r.body!="string")return;n.push({tag:r.tag,hint:r.hint,required:r.required,present:r.present,body:r.body})}return{blocks:n,additional:t.additional}}function Yy(e,t,n){return{jobId:t,tenantId:e,status:bF,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function tc(e){return Vy.has(e)}function xF(e,t){const n=Array.isArray(t.tracks)?t.tracks:[];let i=e.trackOrder,r=e.tracks;for(const o of n){if(!o.trackId)continue;const c=r[o.trackId],d={...c??bR(o.trackId),displayName:o.displayName??c?.displayName??o.trackId,displayCli:o.displayCli??c?.displayCli,model:o.model??c?.model,effort:o.effort??c?.effort,subtitle:o.subtitle??c?.subtitle,kind:o.kind??c?.kind,startedAt:o.startedAt??c?.startedAt};c||(i=[...i,o.trackId]),r={...r,[o.trackId]:d}}return{...e,label:An(t.label)??e.label,ownerCarrierId:An(t.ownerCarrierId)??e.ownerCarrierId,kind:An(t.kind)??e.kind,signatureCli:An(t.signatureCli)??e.signatureCli,startedAt:Da(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function Rl(e,t,n,i){const r=An(t.trackId);if(!r)return e;const o=e.tracks[r],c={...i(o??bR(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:c}}}function bR(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function CF(e,t){const n=An(t.toolId)??An(t.id);if(!n)return e;const i={id:n,name:An(t.name),input:t.input,output:t.output,status:An(t.status)},r=e.findIndex(o=>o.id===n);return r>=0?[...e.slice(0,r),{...e[r],...i},...e.slice(r+1)]:[...e,i]}function R2(e,t,n,i){return n?t>=(i??n.length)?{text:e,sentLength:t}:{text:n,sentLength:i??n.length}:{text:e,sentLength:t}}function kF(e,t){return[...e,t].slice(-120)}function EF(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
214
|
-
`);return n[n.length-1]?.trim()??""}function An(e){return typeof e=="string"?e:void 0}function Da(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const TF=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function AF(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
|
|
215
|
-
|
|
216
|
-
`);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=NF(r);o&&n.push(o),i=e.indexOf(`
|
|
217
|
-
|
|
218
|
-
`)}return n}}function RF(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const i=t.tenant?.tenantId;return!i||!t.truncation?null:{kind:"truncation",tenantId:i,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const i=L2(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=L2(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:LF(t.reason)}:null}const n=N2(t.event)??N2(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function NF(e){const t=e.split(`
|
|
219
|
-
`),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
|
|
220
|
-
`);return!i&&n==="message"?null:{event:n,data:i}}function N2(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.id!="number"||typeof t.tenantId!="string"||typeof t.type!="string"||typeof t.at!="number"?null:{...t,event:typeof t.event=="object"&&t.event!==null?t.event:{}}}function L2(e){try{return Hp(e,200)}catch{return null}}function LF(e){return typeof e=="string"&&TF.has(e)?e:void 0}const D0={droppedCount:0},Xy=new Set;let fn={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function MF(){return s5(OF,SR)}function SR(){return fn}function OF(e){return Xy.add(e),()=>{Xy.delete(e)}}function gs(e){fn={...fn,...e},PF()}function wR(e){gs({agentClis:e})}function DF(e){const t={};for(const n of e)t[n.sessionId]=n;gs({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function hp(e){const t=!!fn.sessions[e.sessionId];gs({sessions:{...fn.sessions,[e.sessionId]:e},sessionOrder:t?fn.sessionOrder:[e.sessionId,...fn.sessionOrder],turnState:{...fn.turnState,[e.sessionId]:e.turnState}})}function xR(e){const{[e]:t,...n}=fn.sessions,{[e]:i,...r}=fn.turnState;gs({sessions:n,sessionOrder:fn.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:fn.activeTerminalSessionId===e?null:fn.activeTerminalSessionId,turnState:r})}function CR(e){gs({activeTerminalSessionId:e})}function jF(e){gs({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...fn.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&fn.tenantJobs[t])]})}function IF(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=SF(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??D0}}gs({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...fn.tenantOrder.filter(n=>t[n])]})}function BF(e,t){const n=e.tenantId,i=e.jobId??zF(e),r=fn.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:D0},o=i?r.jobs[i]??Yy(n,i,e.at):Yy(n,"__unknown__",e.at),c=vR(o,e),d=i&&r.jobOrder.includes(i)?r.jobOrder:i?[i,...r.jobOrder]:r.jobOrder,f={...r,tenantLabel:t??r.tenantLabel,jobOrder:d,jobs:i?{...r.jobs,[i]:c}:r.jobs};return gs({tenantJobs:{...fn.tenantJobs,[n]:f},tenantOrder:fn.tenantOrder.includes(n)?fn.tenantOrder:[n,...fn.tenantOrder]}),{job:c,unknownTenant:!fn.tenantJobs[n]}}function $F(e,t,n){const i=fn.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:D0};gs({tenantJobs:{...fn.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function kR(e){const t=e.tenantId;if(!t)return[];const n=fn.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function PF(){for(const e of Xy)e()}function zF(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const M2=250,HF=5e3,Zy=new Map;function FF(e){const t=new AbortController;return UF(t.signal,e),()=>t.abort()}async function UF(e,t){let n=M2;for(;!e.aborted;){gs({connection:"connecting"});try{await KF(e,t);const i=await fetch("/plugins/terminal/agent/events",{signal:e});if(!i.ok||!i.body)throw new Error(`Agent stream failed: ${i.status}`);gs({connection:"live",connectionError:null}),n=M2,await WF(i.body.getReader(),e,t),e.aborted||gs({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;gs({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await YF(n,e),n=Math.min(n*2,HF)}}async function WF(e,t,n){const i=new TextDecoder,r=AF();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const c of r(i.decode(o.value,{stream:!0}))){const d=RF(c);if(d){if(d.kind==="truncation"&&d.truncation){$F(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){hp(d.session),dp(n,d.session.sessionId,j0(d.session));continue}if(d.kind==="attention"&&d.session){hp(d.session),d.reason!=="idle_prompt"&&dp(n,d.session.sessionId,"awaiting");continue}d.event&&(BF(d.event,d.tenantLabel),GF(n,d.event.tenantId))}}}}function j0(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&qF(e)?"running":"idle"}function qF(e){return kR(e).some(t=>!tc(t.status))}function dp(e,t,n){const i=Zy.get(t);e.status.set(t,n),Zy.set(t,n),i!==n&&(n==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):n==="idle"&&(i==="running"||i==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function GF(e,t){const{sessions:n}=SR();for(const i of Object.values(n))i.tenantId===t&&Zy.get(i.sessionId)!=="awaiting"&&dp(e,i.sessionId,j0(i))}async function KF(e,t){const[n,i,r,o,c]=await Promise.all([_R(e),dF(e),uF(e),hF(e),fF(e)]);wR(n),DF(i),jF(r),IF(o);for(const d of i)dp(t,d.sessionId,j0(d));VF(c.operations,t)}function VF(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function YF(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const XF=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function ZF(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return`${n}m ${i}s`}function JF(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function QF(e){return e.trackOrder.reduce((t,n)=>{const i=e.tracks[n];return i?t+Math.round((i.sentTextLength+i.sentThoughtLength)/4):t},0)}function ER(e){if(e)return XF.has(e)?e:void 0}function eU(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function Fp(e){return e==="err"||e==="error"}function ph(e,t){return!tc(e)&&eU(t)}function I0(e,t){return Fp(e)?"error":e==="done"||e==="aborted"?e:tc(t)?t:e}function tU(e,t){const n=new Set(e),i=t.filter(r=>n.has(r)?!1:(n.add(r),!0));return i.length===0?e:[...e,...i]}function nU(e,t,n){const i=new Map(e.map(o=>[o.jobId,o]));let r=!1;for(const o of t)i.get(o)?.expiresAt!==n&&(i.set(o,{jobId:o,expiresAt:n}),r=!0);return r?[...i.values()]:e}function iU(e,t,n){const i=new Set(t.map(o=>o.jobId)),r=e.filter(o=>o.expiresAt>n&&i.has(o.jobId));return r.length===e.length?e:r}function TR(e,t){const n=new Map(e.map(i=>[i.jobId,i]));return t.flatMap(i=>{const r=n.get(i);return r?[r]:[]})}function sU(e){const t=e.flatMap(r=>r.trackOrder.map(o=>({job:r,track:r.tracks[o]}))).filter(r=>!!r.track).sort((r,o)=>o.track.lastEventId-r.track.lastEventId),n=t.filter(({job:r,track:o})=>ph(r.status,o.status)),i=n.length>0?n:t;for(const{job:r,track:o}of i){if(o.latestLine)return{text:o.latestLine,thinking:!1};if(ph(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function rU(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=TR(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class Up extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function aU(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await B0(t),RR(await t.json(),t.status)}async function oU(e,t,n){const i=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t}),signal:n});return await B0(i),AR(await i.json(),i.status)}async function lU(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await B0(n),AR(await n.json(),n.status)}async function B0(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new Up(e.status,t)}function AR(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new Up(t,"Invalid model auth mutation response");return{state:RR(n.state,t)}}function RR(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new Up(t,"Invalid model auth state response");return{providers:n.providers.map(i=>cU(i,t))}}function cU(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new Up(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const Jy=new Set;let Qy={loading:!1,state:null,busyCli:null,error:null},Vr=0;function uU(){return y.useSyncExternalStore(hU,O2,O2)}function O2(){return Qy}function hU(e){return Jy.add(e),()=>Jy.delete(e)}async function dU(e){const t=++Vr;Yr({loading:!0,error:null});try{const n=await aU(e);if(t!==Vr)return;Yr({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Vr)return;Yr({loading:!1,error:$0(n)})}}async function fU(e,t){const n=++Vr;Yr({busyCli:e,error:null});try{const i=await oU(e,t);return n!==Vr||(Yr({state:i.state,busyCli:null,error:null}),await NR()),!0}catch(i){return n!==Vr||Yr({busyCli:null,error:$0(i)}),!1}}async function pU(e){const t=++Vr;Yr({busyCli:e,error:null});try{const n=await lU(e);return t!==Vr||(Yr({state:n.state,busyCli:null,error:null}),await NR()),!0}catch(n){return t!==Vr||Yr({busyCli:null,error:$0(n)}),!1}}async function NR(){try{wR(await _R())}catch{}}function Yr(e){Qy={...Qy,...e};for(const t of Jy)t()}function $0(e){return e instanceof Error?e.message:String(e)}class LR extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function mU(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await MR(t),OR(await t.json(),t.status)}async function gU(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await MR(n),OR(await n.json(),n.status)}async function MR(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new LR(e.status,t)}function OR(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new LR(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode,kimiModel:_U(n.kimiModel)}}function _U(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.model!="string"||t.model.length===0?null:{model:t.model,...typeof t.effort=="string"?{effort:t.effort}:{}}}const eb=new Set;let fp={loading:!1,state:null,savingField:null,error:null},Mf=0;function P0(){return y.useSyncExternalStore(vU,D2,D2)}function D2(){return fp}function vU(e){return eb.add(e),()=>{eb.delete(e)}}async function z0(e){const t=++Mf;Yl({loading:!0,error:null});try{const n=await mU(e);if(t!==Mf)return;Yl({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Mf)return;Yl({loading:!1,error:DR(n)})}}async function H0(e,t){const n=fp.state;if(!n||e==="kimiModel"&&t===null)return!1;Mf+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:e==="codexLaunchMode"?{codexLaunchMode:i.codexLaunchMode}:{kimiModel:i.kimiModel};Yl({state:i,savingField:e,error:null});try{const o=await gU(r);return Yl({state:o,savingField:null,error:null}),!0}catch(o){return Yl({state:n,savingField:null,error:DR(o)}),!1}}function Yl(e){fp={...fp,...e};for(const t of eb)t()}function DR(e){return e instanceof Error?e.message:String(e)}function yU({job:e}){const t=e.request;return u.jsxs("section",{className:"request-details","aria-label":`Request for ${e.label??e.jobId}`,children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),t?u.jsxs("div",{className:"request-details-blocks",children:[t.blocks.map((n,i)=>u.jsx(bU,{block:n},`${n.tag}-${i}`)),t.additional.trim().length>0?u.jsxs("section",{className:"request-details-block request-details-additional","aria-label":"Additional request",children:[u.jsxs("header",{className:"request-details-block-head",children:[u.jsx("span",{className:"request-details-tag",children:"Additional"}),u.jsx("span",{className:"request-details-presence",children:"residual"})]}),u.jsx("pre",{children:t.additional})]}):null]}):u.jsx("p",{className:"request-details-unavailable",children:"Request unavailable for this legacy job."})]})}function bU({block:e}){const t=e.present?e.body.length===0?"present · empty":"present":e.required?"missing · required":"missing · optional";return u.jsxs("section",{className:"request-details-block","aria-label":`${e.tag} ${t}`,children:[u.jsxs("header",{className:"request-details-block-head",children:[u.jsx("span",{className:"request-details-tag",children:e.tag}),u.jsx("span",{className:"request-details-hint",children:e.hint}),u.jsx("span",{className:"request-details-required",children:e.required?"required":"optional"}),u.jsx("span",{className:`request-details-presence ${e.present?"is-present":"is-missing"}`,children:t})]}),e.present?u.jsx("pre",{children:e.body}):null]})}const SU=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],wU="/plugins/terminal/agent/ticket",xU="/plugins/terminal/ws",tv="fleet-plugin.terminal.stream-dock-expanded",CU="fleet-plugin.terminal.stream-dock-collapsed",kU=56,EU=4e3,TU={...fP,step:1,defaultValue:14},AU="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",RU=5e3,jR={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>qu(e.payload,"cliLabel")??void 0,render:e=>u.jsx(IU,{context:e}),canOpenCompanions:({api:e,operation:t})=>jA(e,t.id),companions:[{id:"session-analyst-chat",title:"Session Analyst",hideCaption:!0,render:e=>u.jsx(WH,{context:e})},{id:Wu,title:"Artifacts",hideCaption:!0,defaultHidden:!0,render:e=>u.jsx(x9,{context:e})}]},IR={id:"general",title:"General",render:()=>u.jsx(PU,{})},BR={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(zU,{})},$R={id:"agent.attention",title:"Agent input waiting"},NU={id:"agent.ended",title:"Agent turn ended"},of={id:"terminal",operationKinds:[jR],settingsSections:[IR,BR],notificationKinds:[$R,NU],install:e=>LU(e),closeOperation:async e=>{try{await gF(e)}finally{v9(e),xR(e)}},launch:async({theaterId:e,kind:t})=>{const n=await pF(e,t.id);return hp(n),CR(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?u.jsx(rW,{}):e.id==="claude"?u.jsx(iW,{}):e.id==="codex"?u.jsx(sW,{}):u.jsx(nW,{})};function LU(e){return FF({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function PR(e,t){const n=y.useRef(null),i=y.useRef(!0),[r,o]=y.useState(!0),c=y.useCallback(f=>{i.current!==f&&(i.current=f,o(f))},[]);y.useEffect(()=>{const f=n.current;if(!f)return;const p=()=>{const _=f.scrollHeight-f.scrollTop-f.clientHeight;c(_<=kU)};return f.addEventListener("scroll",p,{passive:!0}),()=>f.removeEventListener("scroll",p)},[e,c]),y.useLayoutEffect(()=>{c(!0);const f=n.current;f&&(f.scrollTop=f.scrollHeight)},[e,c]),y.useLayoutEffect(()=>{const f=n.current;!f||!i.current||(f.scrollTop=f.scrollHeight)},[t]);const d=y.useCallback(()=>{const f=n.current;f&&(f.scrollTop=f.scrollHeight,f.focus({preventScroll:!0}),c(!0))},[c]);return{containerRef:n,pinned:r,jumpToLatest:d}}function MU(e){return Array.from(e.querySelectorAll("button, summary, [href], input, select, textarea, [tabindex]")).filter(t=>{if(t.tabIndex<0||t.hidden||t.closest("[hidden]")||t.matches(":disabled"))return!1;const n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"&&t.getClientRects().length>0})}function OU(){const[e,t]=y.useState(()=>{try{return localStorage.removeItem(CU),localStorage.getItem(tv)==="true"}catch{return!1}}),n=y.useCallback(i=>{try{i?localStorage.setItem(tv,"true"):localStorage.removeItem(tv)}catch{}t(i)},[]);return[e,n]}function DU(e,t){const[n,i]=y.useState(Date.now);return y.useEffect(()=>{if(e===void 0||t!==void 0)return;const r=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(r)},[e,t]),e===void 0?"":ZF((t??n)-e)}function jU(e){const t=e.companionsOpen??!1,[n,i]=y.useState(!1);return y.useEffect(()=>{if(t||n)return;let r=!1,o=!1;const c=async()=>{if(o)return;o=!0;const f=await jA(e.api,e.operationId);o=!1,!r&&f&&i(!0)};c();const d=window.setInterval(()=>{c()},RU);return()=>{r=!0,window.clearInterval(d)}},[t,e.api,e.operationId,n]),t||n}function j2({context:e,ready:t}){const n=e.companionsOpen??!1;return u.jsxs("button",{type:"button",className:`session-analyst-handle${t?"":" is-waiting"}`,"aria-label":n?"Exit Session Analyst":"Open Session Analyst","aria-pressed":n,"aria-disabled":!t,disabled:!t,title:t?void 0:"Send a message in this session first",onClick:()=>{t&&e.onRequestCompanions?.(!e.companionsOpen)},children:[u.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),u.jsx("span",{className:"session-analyst-handle__label",children:n?"EXIT":"ANALYZE"})]})}function IU({context:e}){const n=MF().sessions[e.operationId]??YU(e),[i,r]=y.useState(!1),[o,c]=y.useState("request"),[d,f]=y.useState([]),[p,_]=y.useState([]),g=y.useId(),b=y.useRef(null),S=y.useRef(null),w=y.useRef(null),x=y.useRef(new Set),E=y.useRef(!0),D=jU(e);y.useEffect(()=>{const A=e.companionsOpen??!1,$=E.current;E.current=A,$&&!A&&y9(e.operationId)},[e.companionsOpen,e.operationId]);const j=kR(n),z=j.filter(A=>!tc(A.status)),T=rU(z,j,p),N=TR(j,d),L=`${i}:${o}`,H=N.map(A=>`${A.jobId}:${A.lastEventId}`).join(","),F=PR(L,H);y.useLayoutEffect(()=>{const A=x.current,$=j.filter(M=>A.has(M.jobId)&&tc(M.status)).map(M=>M.jobId);x.current=new Set(z.map(M=>M.jobId)),$.length!==0&&_(M=>nU(M,$,Date.now()+EU))},[z,j]),y.useEffect(()=>{if(p.length===0)return;const A=Math.min(...p.map(M=>M.expiresAt)),$=window.setTimeout(()=>{_(M=>iU(M,j,Date.now()))},Math.max(0,A-Date.now()));return()=>window.clearTimeout($)},[j,p]),y.useEffect(()=>{i&&f(A=>tU(A,z.map($=>$.jobId)))},[z,i]);const J=y.useCallback(()=>{r(!1),f([]),w.current?.focus()},[]),pe=y.useCallback(()=>{f(T.map(A=>A.jobId)),c("request"),r(!0)},[T]),G=y.useCallback(A=>{c(A)},[]),P=y.useCallback(A=>{const $=["request","activity"],M=$.indexOf(o);let k;if(A.key==="ArrowLeft"&&(k=(M+$.length-1)%$.length),A.key==="ArrowRight"&&(k=(M+1)%$.length),A.key==="Home"&&(k=0),A.key==="End"&&(k=$.length-1),k===void 0)return;A.preventDefault();const B=$[k];c(B),document.getElementById(`${g}-${B}`)?.focus()},[o,g]);return y.useLayoutEffect(()=>{if(!i)return;const A=window.requestAnimationFrame(()=>b.current?.focus());return()=>window.cancelAnimationFrame(A)},[i]),y.useEffect(()=>{if(!i)return;const A=$=>{if($.key==="Escape"){$.stopPropagation(),J();return}if($.key==="Tab"){const M=S.current;if(!M)return;const k=MU(M),B=k[0],O=k[k.length-1];$.shiftKey&&document.activeElement===B?($.preventDefault(),O?.focus()):!$.shiftKey&&document.activeElement===O&&($.preventDefault(),B?.focus())}};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[i,J]),n.status==="dormant"?u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(j2,{context:e,ready:D}),u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{VU(n.sessionId)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),u.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]})]}):u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(j2,{context:e,ready:D}),u.jsx(S0,{operationId:n.sessionId,ticketPath:wU,wsPath:xU,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,theme:e.theme,onExit:()=>xR(n.sessionId)}),T.length>0?u.jsx(BU,{activeJobs:T,onOpenDetail:pe,detailBtnRef:w}):null,i?u.jsxs("div",{ref:S,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[u.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:J}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:b,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:J,children:"×"}),u.jsxs("div",{className:"job-overlay-tabs",role:"tablist","aria-label":"Carrier stream details",children:[u.jsx("button",{id:`${g}-request`,type:"button",role:"tab","aria-selected":o==="request","aria-controls":`${g}-request-panel`,tabIndex:o==="request"?0:-1,onClick:()=>G("request"),onKeyDown:P,children:"Request"}),u.jsx("button",{id:`${g}-activity`,type:"button",role:"tab","aria-selected":o==="activity","aria-controls":`${g}-activity-panel`,tabIndex:o==="activity"?0:-1,onClick:()=>G("activity"),onKeyDown:P,children:"Activity"})]}),u.jsx("div",{id:`${g}-request-panel`,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${g}-request`,hidden:o!=="request",tabIndex:o==="request"?0:-1,children:N.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):N.map(A=>u.jsx(yU,{job:A},A.jobId))}),u.jsx("div",{id:`${g}-activity-panel`,ref:o==="activity"?F.containerRef:void 0,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${g}-activity`,hidden:o!=="activity",tabIndex:o==="activity"?0:-1,children:N.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):N.map(A=>u.jsx(GU,{job:A},A.jobId))}),o==="activity"&&!F.pinned?u.jsx("button",{type:"button",className:"follow-button",onClick:F.jumpToLatest,children:"↓ Follow"}):null]})]}):null]})}function BU({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=OU(),o=e[0],c=DU(o?.startedAt,o?.finishedAt),d=e.reduce((L,H)=>L+QF(H),0),f=JF(d),p=e.length===1&&o?ER(o.ownerCarrierId):void 0,_=e.length===1&&o?o.label:void 0,g=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",b=sU(e),S=e.map(L=>`${L.jobId}:${L.lastEventId}`).join(","),w=`${i}:${e.map(L=>L.jobId).join(",")}`,{containerRef:x,pinned:E,jumpToLatest:D}=PR(w,S),j=e.some(L=>L.trackOrder.some(H=>{const F=L.tracks[H];return F?ph(L.status,F.status):!1})),z=e.some(L=>!tc(L.status)),T=e.some(L=>L.status==="error"||L.trackOrder.some(H=>Fp(L.tracks[H]?.status??""))),N=z?"job-dock-dot":T?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle";return u.jsxs("div",{className:"job-dock",children:[u.jsxs("div",{className:"job-dock-strip",children:[u.jsx("span",{className:N,"aria-hidden":"true"}),u.jsxs("span",{className:"job-dock-carrier",title:_,children:[p?u.jsx("span",{className:"job-dock-captain-dot","data-captain":p,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:g})]}),u.jsxs("span",{className:"job-dock-strip-line",style:i?{display:"none"}:void 0,"aria-hidden":"true",children:[b.thinking?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):b.text,!i&&j&&b.text?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),u.jsxs("span",{className:"job-dock-meta",children:[c?u.jsx("span",{children:c}):null,f?u.jsx("span",{children:f}):null]}),u.jsx("button",{type:"button",className:"job-dock-grip","aria-label":i?"Collapse stream dock":"Expand stream dock","aria-expanded":i,onClick:()=>r(!i),children:i?"▼":"▲"}),u.jsx("button",{ref:n,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),u.jsxs("div",{className:`job-dock-body-wrap${i?"":" is-collapsed"}`,children:[u.jsxs("div",{ref:x,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&_?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:_})}):null,e.map(L=>{const H=e.length>1,F=!H&&L.trackOrder.length===1;return L.trackOrder.map(J=>{const pe=L.tracks[J];return pe?u.jsx($U,{track:pe,job:L,multiJob:H,singleTrack:F},`${L.jobId}:${J}`):null})})]}),E?null:u.jsx("button",{type:"button",className:"follow-button",onClick:D,children:"↓ Follow"})]})]})}function $U({track:e,job:t,multiJob:n,singleTrack:i}){const r=ph(t.status,e.status),c=ZU(e.text),d=!c&&r&&!!e.thought,f=r?XU(e):void 0,p=I0(e.status,t.status),_=n||!i,g=n?ER(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[_?u.jsxs("span",{className:"job-dock-row-name",children:[g?u.jsx("span",{className:"job-dock-captain-dot","data-captain":g,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}):null,u.jsxs("span",{className:`job-dock-row-status${r?" job-dock-row-status--live":""}${Fp(p)?" job-dock-row-status--error":""}`,children:[p,f?` · ${f}`:""]}),c?u.jsxs("span",{className:"job-dock-row-line",children:[c,r?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null,d?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]})}function PU(){const{renderer:e,font:t}=MA();return u.jsxs(u.Fragment,{children:[u.jsx(UU,{}),u.jsx(JU,{terminalFont:t}),u.jsx(QU,{terminalRenderer:e})]})}function zU(){const[e,t]=y.useState([]),[n,i]=y.useState(null),r=P0();return y.useEffect(()=>{const o=new AbortController;return cF(o.signal).then(c=>t(c.clis)).catch(c=>{o.signal.aborted||i(c instanceof Error?c.message:String(c))}),()=>o.abort()},[]),y.useEffect(()=>{const o=new AbortController;return z0(o.signal),()=>o.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),u.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),n?u.jsx("p",{className:"settings-error",children:n}):null,u.jsx("div",{className:"agent-cli-list",children:e.map(o=>u.jsx(qU,{cli:o,codexLaunchMode:r.state?.codexLaunchMode,disabled:r.savingField!==null,onCodexLaunchModeChange:c=>{H0("codexLaunchMode",c)}},o.id))}),r.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:r.error}):null,u.jsx("p",{className:"global-settings-help",children:"Codex launch mode controls the unified-agent carrier protocol for new Codex sessions; it does not affect the interactive Codex TUI in terminal panels."}),u.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),u.jsx(HU,{})]})}function HU(){const e=uU(),t=P0(),[n,i]=y.useState(null);y.useEffect(()=>{const _=new AbortController;return dU(_.signal),()=>_.abort()},[]),y.useEffect(()=>{const _=new AbortController;return pR(_.signal).then(g=>i(g.cliTypes.find(b=>b.id==="claude-kimi")??null)).catch(()=>{}),()=>_.abort()},[]),y.useEffect(()=>{const _=new AbortController;return z0(_.signal),()=>_.abort()},[]);const r=t.state?.kimiModel??null,o=r?.model??n?.defaultModel,c=n?.models.find(_=>_.modelId===o),d=r?.effort??c?.effort?.default,f=t.savingField!==null,p=(_,g)=>{H0("kimiModel",g?{model:_,effort:g}:{model:_})};return u.jsxs("section",{className:"global-settings-card","aria-label":"Model sign-in",children:[u.jsxs("div",{className:"model-auth-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Settings for Kimi"}),u.jsx("p",{className:"global-settings-help",children:"Register a Kimi API key to run carriers and terminal sessions through Claude Code against the Kimi endpoint. The key is validated and stored locally, and is never returned to the browser."})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading sign-in state."}):null,e.state?.providers.map(_=>u.jsx(FU,{provider:_,busy:e.busyCli===_.cli},_.cli)),n&&o?u.jsxs("div",{className:"model-auth-row",children:[u.jsxs("div",{className:"terminal-carriers-runtime-row",children:[u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:"kimi-default-model",children:"Default model"}),u.jsx("select",{id:"kimi-default-model",className:"terminal-carriers-select",value:o,disabled:f||!t.state,onChange:_=>{const g=n.models.find(b=>b.modelId===_.target.value);g&&p(g.modelId,g.effort?r?.effort??g.effort.default:void 0)},children:n.models.map(_=>u.jsx("option",{value:_.modelId,children:_.name},_.modelId))})]}),c?.effort?u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:"kimi-default-effort",children:"Default effort"}),u.jsx("select",{id:"kimi-default-effort",className:"terminal-carriers-select",value:d??c.effort.default,disabled:f||!t.state,onChange:_=>p(c.modelId,_.target.value),children:c.effort.levels.map(_=>u.jsx("option",{value:_,children:_},_))})]}):null]}),u.jsx("p",{className:"global-settings-help",children:"Used for Kimi sessions without an explicit carrier model. Applies to newly launched sessions."})]}):null,u.jsx("p",{className:"global-settings-foot",children:"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched."})]})}function FU({provider:e,busy:t}){const[n,i]=y.useState(""),r=async()=>{await fU(e.cli,n)&&i("")};return u.jsxs("div",{className:"model-auth-row",children:[u.jsxs("div",{className:"model-auth-row-head",children:[u.jsx("span",{className:"model-auth-name",children:e.displayName}),u.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?"Signed in":"Not signed in"})]}),e.signedIn?u.jsx("div",{className:"model-auth-actions",children:u.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{pU(e.cli)},children:t?"Working…":"Sign out"})}):u.jsxs("form",{className:"model-auth-form",onSubmit:o=>{o.preventDefault(),r()},children:[u.jsx("input",{type:"password",className:"model-auth-input",placeholder:"API key",value:n,autoComplete:"off",spellCheck:!1,disabled:t,"aria-label":`${e.displayName} API key`,onChange:o=>i(o.target.value)}),u.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||n.trim().length===0,children:t?"Verifying…":"Sign in"})]})]})}function UU(){const e=P0(),t=e.state,n=e.savingField!==null;return y.useEffect(()=>{const i=new AbortController;return z0(i.signal),()=>i.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?u.jsx(u.Fragment,{children:u.jsx(WU,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:n,onToggle:()=>{H0("enableMetaphor",!t.enableMetaphor)}})}):u.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function WU({title:e,help:t,onLabel:n,offLabel:i,value:r,disabled:o,onToggle:c}){return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:e}),u.jsx("p",{className:"global-settings-help",children:t})]}),u.jsx("button",{type:"button",className:`global-settings-toggle ${r?"is-on":""}`,disabled:o,"aria-pressed":r,onClick:c,children:u.jsx("span",{children:r?n:i})})]})}function qU({cli:e,codexLaunchMode:t,disabled:n,onCodexLaunchModeChange:i}){return u.jsxs("div",{className:"agent-cli-row",children:[u.jsx("span",{className:"agent-cli-name",children:e.displayName}),u.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?u.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[u.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:n,onClick:()=>i("acp"),children:"ACP"}),u.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:n,onClick:()=>i("app-server"),children:"App Server"})]}):null,e.available&&e.version?u.jsx("span",{className:"agent-cli-version",children:e.version}):null,u.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function GU({job:e}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),u.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const n=e.tracks[t];return n?u.jsx(KU,{track:n,jobStatus:e.status},n.trackId):null})})]})}function KU({track:e,jobStatus:t}){const n=tW(e.status,t),i=n==="track-card--live",r=I0(e.status,t);return u.jsxs("article",{className:n?`track-card ${n}`:"track-card",children:[u.jsxs("header",{className:"track-card-head",children:[u.jsx("span",{className:"track-card-title",children:e.displayName}),u.jsx("span",{className:"track-card-status",children:r})]}),e.thought?u.jsxs("details",{className:"track-card-thinking",children:[u.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),u.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:u.jsx("pre",{children:e.thought})})]}):null,e.text?u.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[u.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),u.jsxs("pre",{children:[e.text,i?u.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?u.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?u.jsx("ul",{className:"track-card-tools",children:e.tools.map(o=>u.jsx("li",{children:o.name??o.id},o.id))}):null]})}async function VU(e){hp(await mF(e)),CR(e)}function YU(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:qu(e.operation.payload,"cliId")??void 0,cliLabel:qu(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:qu(e.operation.payload,"tenantId")??void 0,registrationId:qu(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function qu(e,t){const n=e[t];return typeof n=="string"?n:null}function XU(e){const t=e.tools.find(n=>n.status!=="completed"&&n.status!=="failed"&&n.status!=="error");return t?t.name??t.id:void 0}function ZU(e){const t=e.trim();if(!t)return"";const n=t.split(`
|
|
221
|
-
`);return n[n.length-1]?.trim()??""}function JU({terminalFont:e}){const[t,n]=y.useState([]),[i,r]=y.useState(!0),[o,c]=y.useState(null),d=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Kl.id:Kl.id}:{source:"system",familyName:e.customName};y.useEffect(()=>{const p=new AbortController;return r(!0),c(null),nT({signal:p.signal}).then(_=>{p.signal.aborted||n(_.fonts.filter(g=>g.monospace).map(g=>({family:g.family,monospace:g.monospace})))}).catch(_=>{p.signal.aborted||eW(_)||(n([]),c("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{p.signal.aborted||r(!1)}),()=>p.abort()},[]);const f=p=>{if(p.source==="system"){xP(p.familyName);return}const _=lh.find(g=>g.id===p.id);_&&wP(_.id)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[u.jsx("div",{className:"global-settings-row",children:u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:"Typeface and size for every terminal panel — agent-cli and shell alike. Applies live to all open terminals and persists on the Console server across browsers and restarts."})]})}),u.jsx("div",{"aria-describedby":"terminal-font-help",children:u.jsx(eT,{builtIns:lh.map(p=>({id:p.id,label:p.name,family:p.family,aliases:[p.familyName],description:p.meta})),installedFonts:t,selected:d,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:Kl.family,previewText:AU,size:e.size,sizeRange:TU,loading:i,error:o,onSelectionChange:f,onSizeCommit:CP})}),u.jsx("p",{className:"global-settings-foot",children:"Font preferences apply immediately and are stored on the Console server, separate from session settings and shared across browsers after restart."})]})}function QU({terminalRenderer:e}){return u.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),u.jsx("p",{className:"global-settings-help",children:"WebGL paints the terminal on the GPU for sharper, faster output; DOM is a compatibility fallback. Switching applies to the live terminal instantly without dropping the session."})]}),u.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:SU.map(t=>{const n=t.id===e;return u.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>SP(t.id),children:t.label},t.id)})})]})})}function eW(e){return e instanceof DOMException&&e.name==="AbortError"}function tW(e,t){if(ph(t,e))return"track-card--live";const n=I0(e,t);return Fp(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function nW(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M8 2.6 12.6 5.2v5.6L8 13.4 3.4 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function iW(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fill:"currentColor"})})}function sW(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}function rW(){return u.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:u.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}const aW={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},tb=new Set;let xi={loading:!1,state:null,options:null,activeCarrierId:null,draft:aW,savingActionId:null,error:null};function zR(){return y.useSyncExternalStore(oW,I2,I2)}function I2(){return xi}function oW(e){return tb.add(e),()=>{tb.delete(e)}}async function nv(e){pr({loading:!0,error:null});try{const[t,n]=await Promise.all([fR(e),pR(e)]);HR(t,n)}catch(t){if(e?.aborted)return;pr({loading:!1,error:UR(t)})}}function lW(e){const t=xi.state?.carriers.find(n=>n.carrierId===e);pr({activeCarrierId:e,draft:t?F0(t,xi.options):xi.draft,error:null})}function Ul(e){pr({draft:{...xi.draft,...e},error:null})}function nb(e,t){const n=xi.draft.taskforce[e]??{model:"",effort:""};pr({draft:{...xi.draft,taskforce:{...xi.draft.taskforce,[e]:{...n,...t}}},error:null})}function cW(){const e=FR();e&&pr({draft:F0(e,xi.options),error:null})}async function uW(e){const t=FR();return t?hW("save-all",async()=>{const n=xi.draft;let i=null;n.displayName!==t.displayName&&(i=(await ev(t.carrierId,{displayName:n.displayName})).state);const r=n.cliType!==t.cliType;return r&&(i=(await ev(t.carrierId,{cli:n.cliType})).state),(r||n.model!==t.model||(n.effort||"")!==(t.effort||""))&&(i=(await ev(t.carrierId,{model:fW(n)})).state),i=await pW(t,e,i),{state:i??await fR()}}):!1}function HR(e,t){const n=mW(e,xi.activeCarrierId),i=e.carriers.find(r=>r.carrierId===n)??null;pr({loading:!1,state:e,options:t,activeCarrierId:n,draft:i?F0(i,t):xi.draft,error:null})}async function hW(e,t){pr({savingActionId:e,error:null});try{const n=await t();return HR(n.state,xi.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),pr({savingActionId:null}),!0}catch(n){return pr({savingActionId:null,error:UR(n)}),!1}}function F0(e,t){const n=Object.fromEntries((t?.cliTypes??[]).map(i=>{const r=e.taskforce.backends.find(o=>o.cliType===i.id);return[i.id,{model:r?.model??i.defaultModel,effort:r?.effort??dW(i.id,r?.model??i.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:n}}function dW(e,t,n){return n?.cliTypes.find(o=>o.id===e)?.models.find(o=>o.modelId===t)?.effort?.default??null}function fW(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function FR(){return xi.state?.carriers.find(e=>e.carrierId===xi.activeCarrierId)??null}async function pW(e,t,n){const i=new Set(t.map(r=>r.cliType));for(const r of e.taskforce.backends)i.has(r.cliType)||(n=(await nF(e.carrierId,r.cliType)).state);for(const r of t){const o=e.taskforce.backends.find(c=>c.cliType===r.cliType);o&&o.model===r.model&&(o.effort||"")===(r.effort||"")||(n=(await tF(e.carrierId,r.cliType,{model:r.model,...r.effort?{effort:r.effort}:{}})).state)}return n}function mW(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function pr(e){xi={...xi,...e};for(const t of tb)t()}function UR(e){return e instanceof Error?e.message:String(e)}const gW=50,_W=2400,vW={nimitz:"var(--captain-nimitz)",kirov:"var(--captain-kirov)",genesis:"var(--captain-genesis)",ohio:"var(--captain-ohio)",sentinel:"var(--captain-sentinel)",vanguard:"var(--captain-vanguard)",tempest:"var(--captain-tempest)",chronicle:"var(--captain-chronicle)"},yW={id:"carriers",title:"Carriers",render:()=>u.jsx(bW,{})};function bW(){const e=zR(),t=e.state?.carriers.find(x=>x.carrierId===e.activeCarrierId)??null,n=e.options?.cliTypes.find(x=>x.id===e.draft.cliType)??null,i=n?.models.find(x=>x.modelId===e.draft.model)??null,[r,o]=y.useState(!1),[c,d]=y.useState([]),[f,p]=y.useState("idle"),_=e.savingActionId==="save-all",g=t?EW(t,e.draft,c):!1,b=t?.taskforce.backends.map(x=>`${x.cliType}:${x.model}:${x.effort??""}`).join("|")??"";y.useEffect(()=>{const x=new AbortController;return nv(x.signal),()=>x.abort()},[]),y.useEffect(()=>{o(!1),d(t?.taskforce.backends.map(x=>x.cliType)??[]),p("idle")},[t?.carrierId,b]),y.useEffect(()=>{if(f!=="saved")return;const x=window.setTimeout(()=>p("idle"),_W);return()=>window.clearTimeout(x)},[f]);function S(){t&&(cW(),d(t.taskforce.backends.map(x=>x.cliType)),o(!1),p("idle"))}async function w(){if(!t)return;if(p("saving"),!await uW(AW(c,e.draft.taskforce))){p("idle");return}o(!1),p("saved")}return u.jsxs(u.Fragment,{children:[e.error?u.jsx("p",{className:"terminal-carriers-error",role:"alert",children:e.error}):null,u.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":"Carrier list",children:[e.loading&&!e.state?u.jsx("p",{className:"terminal-carriers-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?u.jsx("p",{className:"terminal-carriers-empty",children:"No carriers registered."}):null,e.state?.carriers.map(x=>u.jsx(SW,{carrier:x,active:x.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??null,onSelect:()=>lW(x.carrierId)},x.carrierId))]}),t&&e.options&&n?u.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:GR(t.carrierId),children:[u.jsxs("div",{className:"terminal-carriers-detail-head",children:[u.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[u.jsxs("div",{className:"terminal-carriers-captain-id",children:[u.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),u.jsx("div",{className:`terminal-carriers-name-line ${r?"is-editing":""}`,children:r?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":"Display name",value:e.draft.displayName,maxLength:gW,onChange:x=>Ul({displayName:x.target.value})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Save display name",disabled:_,onClick:()=>{o(!1)},children:u.jsx(NW,{})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Cancel display name edit",onClick:()=>{Ul({displayName:t.displayName}),o(!1)},children:u.jsx(LW,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"terminal-carriers-captain-name",children:t.displayName}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Edit display name",onClick:()=>{Ul({displayName:t.displayName}),o(!0)},children:u.jsx(RW,{})})]})}),u.jsx("div",{className:"terminal-carriers-captain-role",children:t.role})]}),u.jsxs("div",{className:"terminal-carriers-detail-actions",children:[u.jsx("div",{className:`terminal-carriers-save-status ${f==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:f==="saving"||_?"Saving…":f==="saved"?"Saved ✓":""}),u.jsxs("div",{className:"terminal-carriers-save-actions",children:[u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${g?"is-dirty":""}`,disabled:!g||_,onClick:()=>{w()},children:"Save"}),u.jsx("button",{type:"button",className:`terminal-carriers-action-button ${g?"is-dirty":""}`,disabled:!g||_,onClick:S,children:"Discard"}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:e.loading,onClick:()=>{nv()},children:"Refresh"})]})]})]}),u.jsxs("div",{className:"terminal-carriers-body",children:[u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:"Identity"}),u.jsx("div",{className:"terminal-carriers-mission",children:t.roleDescription})]}),u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:"Runtime"}),u.jsxs("div",{className:"terminal-carriers-runtime",children:[u.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:u.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:"carrier-cli",children:"CLI"}),u.jsx("select",{id:"carrier-cli",className:"terminal-carriers-select",value:e.draft.cliType,onChange:x=>xW(x.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(x=>u.jsx("option",{value:x.id,children:x.displayName},x.id))})]})}),u.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[u.jsx(WR,{id:"carrier-model",label:"Model",models:n.models,value:e.draft.model,onChange:x=>CW(n,x)}),u.jsx(qR,{id:"carrier-effort",model:i,value:e.draft.effort,onChange:x=>Ul({effort:x})})]})]})]}),t.taskForceCapable?u.jsx(wW,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:c,onRowsChange:d}):null]})]},t.carrierId):u.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[u.jsx("p",{className:"terminal-carriers-empty",children:"Select a carrier."}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:e.loading,onClick:()=>{nv()},children:"Refresh"})]})]})}function SW({carrier:e,active:t,minBackends:n,onSelect:i}){const r=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return u.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:GR(e.carrierId),onClick:i,children:[u.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),u.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),r?u.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function WR({id:e,label:t,models:n,value:i,disabled:r=!1,onChange:o}){return u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:t}),u.jsx("select",{id:e,className:"terminal-carriers-select",value:i,disabled:r,onChange:c=>o(c.target.value),children:n.map(c=>u.jsx("option",{value:c.modelId,children:c.name},c.modelId))})]})}function qR({id:e,model:t,value:n,disabled:i=!1,onChange:r}){return t?.effort?u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("label",{className:"terminal-carriers-label",htmlFor:e,children:"Effort"}),u.jsx("select",{id:e,className:"terminal-carriers-select",value:n||t.effort.default,disabled:i,onChange:o=>r(o.target.value),children:t.effort.levels.map(o=>u.jsx("option",{value:o,children:o},o))})]}):u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",children:"Effort"}),u.jsx("p",{className:"terminal-carriers-help",children:"Not supported for this model."})]})}function wW({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,rows:r,onRowsChange:o}){const c=zR(),d=e.taskforce.backends.length,[f,p]=y.useState(d>0),[_,g]=y.useState(!1),[b,S]=y.useState(""),w=e.taskforce.backends.length>=n,x=t.filter(D=>!r.includes(D.id)),E=b||x[0]?.id||"";return u.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${f?"is-expanded":""}`,children:[u.jsxs("div",{className:"terminal-carriers-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"terminal-carriers-resp-title",children:"Task Force"}),u.jsx("p",{className:"terminal-carriers-help",children:d>0?`${d} backend${d===1?"":"s"} configured${w?" · active":` · needs ${n}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${n} to activate.`})]}),u.jsx("div",{className:"terminal-carriers-tf-head-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":f,onClick:()=>p(D=>!D),children:f?"Hide":"Configure"})})]}),f?u.jsxs("div",{className:"terminal-carriers-tf-list",children:[r.length===0?u.jsx("p",{className:"terminal-carriers-tf-empty",children:"No Task Force backend drafted."}):null,r.map(D=>{const j=t.find(L=>L.id===D);if(!j)return null;const z=c.draft.taskforce[j.id]??{model:j.defaultModel,effort:""},T=j.models.find(L=>L.modelId===z.model)??j.models[0]??null,N=e.taskforce.backends.some(L=>L.cliType===j.id);return u.jsxs("div",{className:`terminal-carriers-tf-item ${N?"is-active":""}`,children:[u.jsxs("div",{className:"terminal-carriers-tf-title",children:[u.jsx("span",{className:`terminal-carriers-live-dot ${N?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:j.displayName})]}),u.jsx(WR,{id:`tf-${j.id}-model`,label:"Model",models:j.models,value:z.model,onChange:L=>kW(j,L)}),u.jsx(qR,{id:`tf-${j.id}-effort`,model:T,value:z.effort,onChange:L=>nb(j.id,{effort:L})}),u.jsx("div",{className:"terminal-carriers-tf-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:i==="save-all",onClick:()=>o(r.filter(L=>L!==j.id)),children:"Remove"})})]},j.id)}),u.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[_&&x.length>0?u.jsx("select",{className:"terminal-carriers-select terminal-carriers-tf-add-select",value:E,onChange:D=>S(D.target.value),"aria-label":"Task Force CLI to add",children:x.map(D=>u.jsx("option",{value:D.id,children:D.displayName},D.id))}):null,u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:x.length===0||i==="save-all",onClick:()=>{if(!_){g(!0);return}const D=E,j=t.find(T=>T.id===D),z=j?.models.find(T=>T.modelId===j.defaultModel)??j?.models[0]??null;!j||!z||(nb(j.id,{model:z.modelId,effort:z.effort?.default??""}),o(r.includes(j.id)?r:[...r,j.id]),S(""),g(!1))},children:"Add"})]})]}):null]})}function xW(e,t){const n=t.find(r=>r.id===e),i=n?.models.find(r=>r.modelId===n.defaultModel)??n?.models[0]??null;Ul({cliType:e,model:i?.modelId??"",effort:i?.effort?.default??""})}function CW(e,t){const n=e.models.find(i=>i.modelId===t);Ul({model:t,effort:n?.effort?.default??""})}function kW(e,t){const n=e.models.find(i=>i.modelId===t);nb(e.id,{model:t,effort:n?.effort?.default??""})}function EW(e,t,n){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:TW(e,n,t.taskforce)}function TW(e,t,n){if(t.length!==e.taskforce.backends.length)return!0;const i=new Set(t);for(const r of e.taskforce.backends){if(!i.has(r.cliType))return!0;const o=n[r.cliType];if(!o||o.model!==r.model||(o.effort||"")!==(r.effort||""))return!0}return!1}function AW(e,t){return e.map(n=>{const i=t[n];return i?{cliType:n,model:i.model,...i.effort?{effort:i.effort}:{}}:null}).filter(n=>n!==null)}function GR(e){return{"--cap-color":vW[e]??"var(--brass)"}}function RW(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),u.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function NW(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function LW(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const MW="global-shell:theater:",OW="/plugins/terminal/global/ticket",DW="/plugins/terminal/ws",jW=168,IW={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},BW={id:"global-shell",title:"Shell",icon:$W,preferredExtraWidth:jW,render:e=>u.jsx("div",{style:IW,children:u.jsx(S0,{operationId:`${MW}${encodeURIComponent(e.theaterId??"")}`,ticketPath:OW,wsPath:DW,theme:"instrument",active:!0})})};function $W(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const PW="/plugins/terminal/shell/ticket",zW="/plugins/terminal/ws",KR={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>y.createElement(HW,{context:e})},iv={id:"terminal",operationKinds:[KR],install:()=>{},closeOperation:async e=>{await fetch(`/plugins/terminal/shell/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},launch:async({theaterId:e,operations:t})=>({id:(await t.create({theaterId:e,type:"shell",pluginId:"terminal",title:"Shell",payload:{theaterId:e}})).id}),renderLaunchIcon:()=>u.jsx(FW,{})};function HW({context:e}){return u.jsx(S0,{operationId:e.operationId,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,ticketPath:PW,wsPath:zW,theme:e.theme,onExit:e.onClose})}function FW(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),u.jsx("path",{d:"M5 6.6 6.8 8.4 5 10.2M8.4 10.2h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"})]})}const UW=new Set(["agent"]),WW={id:"terminal",operationKinds:[KR,jR],settingsSections:[IR,BR,yW],notificationKinds:[$R],railPanels:[BW],install:e=>(OA(),bP(e.settings),of.install?.(e)),closeOperation:async e=>{const t=await GW(e);if(t?.type==="shell"){await iv.closeOperation?.(e);return}t&&UW.has(t.type)&&await of.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?iv.launch?.(e)??{id:""}:of.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?iv.renderLaunchIcon?.(e):of.renderLaunchIcon?.(e)},qW=[WW];async function GW(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const n=await t.json();return typeof n.operation?.type=="string"?{type:n.operation.type}:null}const ee={ts:"ts",js:"js",json:"json",css:"css",html:"html",md:"md",py:"py",go:"go",rust:"rust",shell:"shell",config:"config",image:"image",data:"data",archive:"archive",binary:"binary",ruby:"ruby",folder:"folder",default:"default"},KW={src:ee.ts,lib:ee.ts,app:ee.ts,test:ee.shell,tests:ee.shell,__tests__:ee.shell,spec:ee.shell,specs:ee.shell,node_modules:ee.binary,vendor:ee.binary,dist:ee.config,build:ee.config,out:ee.config,target:ee.config,docs:ee.md,doc:ee.md,public:ee.data,assets:ee.data,static:ee.data,components:ee.image,scripts:ee.js,styles:ee.css,".git":ee.html,".github":ee.config,".vscode":ee.css},B2={ts:{shape:"angle",tone:ee.ts},tsx:{shape:"angle",tone:ee.ts},mts:{shape:"angle",tone:ee.ts},cts:{shape:"angle",tone:ee.ts},"d.ts":{shape:"angle",tone:ee.ts},js:{shape:"angle",tone:ee.js},jsx:{shape:"angle",tone:ee.js},mjs:{shape:"angle",tone:ee.js},cjs:{shape:"angle",tone:ee.js},json:{shape:"braces",tone:ee.json},jsonc:{shape:"braces",tone:ee.json},json5:{shape:"braces",tone:ee.json},jsonl:{shape:"braces",tone:ee.json},graphql:{shape:"braces",tone:ee.image},gql:{shape:"braces",tone:ee.image},proto:{shape:"braces",tone:ee.go},css:{shape:"hash",tone:ee.css},scss:{shape:"hash",tone:ee.css},sass:{shape:"hash",tone:ee.css},less:{shape:"hash",tone:ee.css},styl:{shape:"hash",tone:ee.css},html:{shape:"markup",tone:ee.html},htm:{shape:"markup",tone:ee.html},xml:{shape:"markup",tone:ee.html},xhtml:{shape:"markup",tone:ee.html},vue:{shape:"markup",tone:ee.shell},svelte:{shape:"markup",tone:ee.rust},astro:{shape:"markup",tone:ee.image},md:{shape:"doc",tone:ee.md},mdx:{shape:"doc",tone:ee.md},markdown:{shape:"doc",tone:ee.md},rst:{shape:"doc",tone:ee.md},txt:{shape:"doc",tone:ee.default},text:{shape:"doc",tone:ee.default},log:{shape:"doc",tone:ee.default},adoc:{shape:"doc",tone:ee.md},pdf:{shape:"doc",tone:ee.ruby},py:{shape:"angle",tone:ee.py},pyi:{shape:"angle",tone:ee.py},pyw:{shape:"angle",tone:ee.py},go:{shape:"angle",tone:ee.go},rs:{shape:"angle",tone:ee.rust},rb:{shape:"angle",tone:ee.ruby},rake:{shape:"angle",tone:ee.ruby},gemspec:{shape:"angle",tone:ee.ruby},java:{shape:"angle",tone:ee.html},kt:{shape:"angle",tone:ee.config},kts:{shape:"angle",tone:ee.config},scala:{shape:"angle",tone:ee.ruby},c:{shape:"angle",tone:ee.ts},h:{shape:"angle",tone:ee.ts},cpp:{shape:"angle",tone:ee.css},cc:{shape:"angle",tone:ee.css},cxx:{shape:"angle",tone:ee.css},hpp:{shape:"angle",tone:ee.css},cs:{shape:"angle",tone:ee.config},php:{shape:"angle",tone:ee.config},swift:{shape:"angle",tone:ee.html},lua:{shape:"angle",tone:ee.ts},dart:{shape:"angle",tone:ee.go},sh:{shape:"terminal",tone:ee.shell},bash:{shape:"terminal",tone:ee.shell},zsh:{shape:"terminal",tone:ee.shell},fish:{shape:"terminal",tone:ee.shell},ps1:{shape:"terminal",tone:ee.css},bat:{shape:"terminal",tone:ee.shell},cmd:{shape:"terminal",tone:ee.shell},yaml:{shape:"gear",tone:ee.config},yml:{shape:"gear",tone:ee.config},toml:{shape:"gear",tone:ee.config},ini:{shape:"gear",tone:ee.config},conf:{shape:"gear",tone:ee.config},cfg:{shape:"gear",tone:ee.config},properties:{shape:"gear",tone:ee.config},env:{shape:"gear",tone:ee.config},editorconfig:{shape:"gear",tone:ee.config},png:{shape:"image",tone:ee.image},jpg:{shape:"image",tone:ee.image},jpeg:{shape:"image",tone:ee.image},gif:{shape:"image",tone:ee.image},webp:{shape:"image",tone:ee.image},svg:{shape:"image",tone:ee.image},ico:{shape:"image",tone:ee.image},bmp:{shape:"image",tone:ee.image},avif:{shape:"image",tone:ee.image},tiff:{shape:"image",tone:ee.image},heic:{shape:"image",tone:ee.image},mp4:{shape:"image",tone:ee.data},mov:{shape:"image",tone:ee.data},webm:{shape:"image",tone:ee.data},mkv:{shape:"image",tone:ee.data},mp3:{shape:"chip",tone:ee.shell},wav:{shape:"chip",tone:ee.shell},flac:{shape:"chip",tone:ee.shell},ogg:{shape:"chip",tone:ee.shell},sql:{shape:"database",tone:ee.data},csv:{shape:"database",tone:ee.data},tsv:{shape:"database",tone:ee.data},db:{shape:"database",tone:ee.data},sqlite:{shape:"database",tone:ee.data},sqlite3:{shape:"database",tone:ee.data},parquet:{shape:"database",tone:ee.data},zip:{shape:"archive",tone:ee.archive},tar:{shape:"archive",tone:ee.archive},gz:{shape:"archive",tone:ee.archive},tgz:{shape:"archive",tone:ee.archive},bz2:{shape:"archive",tone:ee.archive},xz:{shape:"archive",tone:ee.archive},rar:{shape:"archive",tone:ee.archive},"7z":{shape:"archive",tone:ee.archive},zst:{shape:"archive",tone:ee.archive},bin:{shape:"chip",tone:ee.binary},exe:{shape:"chip",tone:ee.binary},dll:{shape:"chip",tone:ee.binary},so:{shape:"chip",tone:ee.binary},dylib:{shape:"chip",tone:ee.binary},wasm:{shape:"chip",tone:ee.config},class:{shape:"chip",tone:ee.binary},lock:{shape:"chip",tone:ee.binary},woff:{shape:"chip",tone:ee.config},woff2:{shape:"chip",tone:ee.config},ttf:{shape:"chip",tone:ee.config},otf:{shape:"chip",tone:ee.config}},VW={dockerfile:{shape:"chip",tone:ee.css},"docker-compose.yml":{shape:"gear",tone:ee.css},"docker-compose.yaml":{shape:"gear",tone:ee.css},makefile:{shape:"gear",tone:ee.html},"cmakelists.txt":{shape:"gear",tone:ee.html},".gitignore":{shape:"gear",tone:ee.html},".gitattributes":{shape:"gear",tone:ee.html},".dockerignore":{shape:"gear",tone:ee.html},".npmignore":{shape:"gear",tone:ee.html},".npmrc":{shape:"gear",tone:ee.ruby},"package.json":{shape:"braces",tone:ee.shell},"tsconfig.json":{shape:"braces",tone:ee.ts},license:{shape:"doc",tone:ee.json},"license.md":{shape:"doc",tone:ee.json},licence:{shape:"doc",tone:ee.json}},YW={shape:"default",tone:ee.default},ib={angle:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.5 13.6 8l-3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.4 3.4c-1.1 0-1.5.5-1.5 1.5v1.2c0 .9-.4 1.4-1.1 1.6v.6c.7.2 1.1.7 1.1 1.6v1.2c0 1 .4 1.5 1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.6 3.4c1.1 0 1.5.5 1.5 1.5v1.2c0 .9.4 1.4 1.1 1.6v.6c-.7.2-1.1.7-1.1 1.6v1.2c0 1-.4 1.5-1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),u.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.7 8.6h4.6M5.7 10.5h4.6M5.7 12.1h3",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.7"})]}),image:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),u.jsx("path",{d:"M3 11.4 6.6 7.9l2 2 1.9-1.7 2.5 2.3",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),terminal:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M8 2.4v2.1M8 11.5v2.1M13.6 8h-2.1M4.5 8H2.4M11.96 4.04l-1.49 1.49M5.53 10.47l-1.49 1.49M11.96 11.96l-1.49-1.49M5.53 5.53 4.04 4.04",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),markup:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.2 13.6 8l-3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:u.jsxs(u.Fragment,{children:[u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M3.6 4.6v6.8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8V4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M3.6 8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.65"})]}),archive:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("path",{d:"M6.5 2.6v1.6M9.5 2.6v1.6M6.5 11.8v1.6M9.5 11.8v1.6M2.6 6.5h1.6M2.6 9.5h1.6M11.8 6.5h1.6M11.8 9.5h1.6",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),default:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.14"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"currentColor",opacity:"0.2"}),u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderOpen:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v1.1H2.4V5.2Z",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"currentColor",opacity:"0.26"}),u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]})};function XW({name:e}){const t=JW(e);return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${t.tone})`},children:ib[t.shape]})}function ZW({name:e,open:t}){const n=KW[e.toLowerCase()]??ee.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?ib.folderOpen:ib.folderClosed})}function JW(e){const t=e.toLowerCase(),n=VW[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:ee.config};if(t.startsWith("readme"))return{shape:"doc",tone:ee.md};if(t.endsWith(".d.ts"))return B2["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=B2[r];if(o)return o}return YW}const QW=200,lf=30,$2=5,VR="fleet-console.fileExplorer.showHidden",P2=500;function qs(e,t){return e===t}async function eq({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:r,onFolderResult:o}){const c=[],d=new Map(t),f=new Set,p=new Set;let _=0;const g=b=>{for(const S of b)if(!(!nq(S,i)||f.has(S.relativePath))){if(f.size>=P2)return;f.add(S.relativePath),c.push(S)}};for(g(e);c.length>0&&r();){const b=c.shift();if(!b)return;const S=d.get(b.relativePath);if(S){if(p.has(S.relativePath))continue;p.add(S.relativePath),g(S.entries);continue}if(_>=P2)return;_+=1;try{const w=await n.listFolder(b.relativePath);if(!r())return;if(d.set(b.relativePath,w),o(b.relativePath,w),p.has(w.relativePath))continue;p.add(w.relativePath),g(w.entries)}catch{}}}function YR(e,t,n,i,r,o,c,d,f=new Set){const p=[];for(const _ of e){if(!d&&_.name.startsWith("."))continue;const g=o.get(_.relativePath),b=g?.entries,S=g?.relativePath??_.relativePath,w=_.kind==="dir"&&f.has(S),x=_.kind==="dir"&&!w&&XR(b??[],o,c,d);if(c&&!_.name.toLowerCase().includes(c)&&!x)continue;const E=i.has(_.relativePath)||!!(c&&x);if(p.push({entry:_,depth:t,isSelected:n===_.relativePath,isExpanded:E,isLoading:r.has(_.relativePath)}),_.kind==="dir"&&E&&!w&&b){const D=new Set(f);D.add(S),p.push(...YR(b,t+1,n,i,r,o,c,d,D))}}return p}function tq({contextKey:e,files:t,theaterId:n,selectedPath:i,onSelect:r}){const[o,c]=y.useState(null),[d,f]=y.useState(null),[p,_]=y.useState(""),[g,b]=y.useState(new Set),[S,w]=y.useState(new Set),[x,E]=y.useState(new Map),[D,j]=y.useState(""),[z,T]=y.useState(0),[N,L]=y.useState(600),[H,F]=y.useState(()=>iq()),J=y.useRef(null),pe=y.useRef(g);pe.current=g;const G=y.useRef(p);G.current=p;const P=y.useRef(t);P.current=t;const A=y.useRef(e);A.current=e;const $=y.useRef(x);$.current=x;const M=y.useRef(0),k=!!D;y.useEffect(()=>{n&&(c(null),f(null),_(""),b(new Set),E(new Map),j(""),T(0))},[e,n]),y.useEffect(()=>{if(!n)return;const Le=e;t.listFolder(p||void 0).then(Se=>{qs(Le,A.current)&&(c(Se),f(null))}).catch(Se=>{qs(Le,A.current)&&f(Se instanceof Error?Se.message:"Unable to load folder")})},[e,n,p,t]),y.useEffect(()=>{const Le=++M.current;if(!k||!o)return;let Se=!0;const xe=e,Me=()=>Se&&Le===M.current&&qs(xe,A.current);return eq({entries:o.entries,cachedResults:$.current,files:t,showHidden:H,isCurrent:Me,onFolderResult:(Ke,it)=>{Me()&&E(Ge=>new Map(Ge).set(Ke,it))}}),()=>{Se=!1}},[e,t,k,o,H]),y.useEffect(()=>{const Le=J.current;if(!Le)return;const Se=new ResizeObserver(()=>L(Le.clientHeight));return Se.observe(Le),L(Le.clientHeight),()=>Se.disconnect()},[]),y.useEffect(()=>{if(!n)return;let Le=!0;const Se=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,xe=new EventSource(Se),Me=()=>{const it=e;P.current.listFolder(G.current||void 0).then(Ge=>{qs(it,A.current)&&(c(Ge),f(null))}).catch(()=>{})},Ke=()=>{Me();for(const it of pe.current){const Ge=e;P.current.listFolder(it).then(he=>{qs(Ge,A.current)&&E(Qe=>new Map(Qe).set(it,he))}).catch(()=>{})}};return xe.addEventListener("change",it=>{let Ge;try{Ge=JSON.parse(it.data)}catch{return}if(typeof Ge=="string"&&((Ge===""||Ge===G.current)&&Me(),Ge!==""&&pe.current.has(Ge))){const he=e;P.current.listFolder(Ge).then(Qe=>{qs(he,A.current)&&E(Ye=>new Map(Ye).set(Ge,Qe))}).catch(()=>{})}}),xe.onopen=()=>{if(Le){Le=!1;return}Ke()},()=>{xe.close()}},[e,n,t]);const B=y.useCallback(Le=>{const Se=Le.relativePath,xe=!g.has(Se);if(b(Me=>{const Ke=new Set(Me);return Ke.has(Se)?(Ke.delete(Se),Ke):(Ke.add(Se),Ke)}),xe){const Me=e;w(Ke=>new Set(Ke).add(Se)),t.listFolder(Se).then(Ke=>{qs(Me,A.current)&&(E(it=>new Map(it).set(Se,Ke)),w(it=>{const Ge=new Set(it);return Ge.delete(Se),Ge}))}).catch(()=>{qs(Me,A.current)&&w(Ke=>{const it=new Set(Ke);return it.delete(Se),it})})}},[e,t,g]),O=y.useCallback(Le=>{Le.kind==="dir"?B(Le):r(Le)},[B,r]),W=y.useCallback(Le=>{T(Le.currentTarget.scrollTop)},[]),U=y.useCallback(()=>{F(Le=>{const Se=!Le;try{localStorage.setItem(VR,Se?"1":"0")}catch{}return Se})},[]),R=y.useCallback(()=>{if(!n)return;const Le=e;t.listFolder(p||void 0).then(Se=>{qs(Le,A.current)&&(c(Se),f(null))}).catch(Se=>{qs(Le,A.current)&&f(Se instanceof Error?Se.message:"Unable to load folder")});for(const Se of g)t.listFolder(Se).then(xe=>{qs(Le,A.current)&&E(Me=>new Map(Me).set(Se,xe))}).catch(()=>{})},[e,t,p,g,n]),Y=D.toLowerCase(),Z=y.useMemo(()=>o?YR(o.entries,0,i,g,S,x,Y,H):[],[o,i,g,S,x,Y,H]),me=!H&&o!==null&&o.entries.length>0&&Z.length===0&&!D,ue=Z.length>QW,oe=ue?Math.max(0,Math.floor(z/lf)-$2):0,ke=ue?Math.min(Z.length,Math.ceil((z+N)/lf)+$2):Z.length,Ne=Z.slice(oe,ke),Re=Z.length*lf,ot=oe*lf;return n?d&&!o?u.jsx("div",{className:"fexp-tree-error",children:d}):o?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:D,onChange:Le=>j(Le.target.value),"aria-label":"Filter files"}),D&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>j(""),"aria-label":"Clear filter",children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:R,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${H?" is-active":""}`,onClick:U,"aria-pressed":H,"aria-label":H?"Hide hidden files":"Show hidden files",title:H?"Hide hidden files":"Show hidden files",children:H?u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),u.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),u.jsxs("div",{ref:J,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:ue?W:void 0,children:[!1,ue?u.jsx("div",{style:{height:Re,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${ot}px)`},children:Ne.map(Le=>u.jsx(z2,{row:Le,onEntryClick:O},Le.entry.relativePath))})}):Ne.map(Le=>u.jsx(z2,{row:Le,onEntryClick:O},Le.entry.relativePath)),Z.length===0&&D&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),Z.length===0&&!D&&o.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),me&&u.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):u.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):u.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function XR(e,t,n,i,r=new Set){for(const o of e)if(!(!i&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(n))return!0;if(o.kind==="dir"){const c=t.get(o.relativePath);if(c&&!r.has(c.relativePath)){const d=new Set(r);if(d.add(c.relativePath),XR(c.entries,t,n,i,d))return!0}}}return!1}function nq(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function z2({row:e,onEntryClick:t}){const{entry:n,depth:i,isSelected:r,isExpanded:o,isLoading:c}=e,d=n.kind==="dir",f=i*16,p=y.useCallback(()=>t(n),[n,t]);return u.jsxs("button",{className:`fexp-tree-row${r?" is-cur":""}${d?" is-dir":" is-file"}`,style:{paddingLeft:`${f+12}px`},type:"button",role:"treeitem","aria-selected":r,"aria-expanded":d?o:void 0,onClick:p,children:[u.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:d?u.jsx(ZW,{name:n.name,open:o}):u.jsx(XW,{name:n.name})}),u.jsx("span",{className:"fexp-tree-name",children:n.name}),c&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function iq(){try{return localStorage.getItem(VR)==="1"}catch{return!1}}function sq({name:e,sizeHint:t}){return u.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[u.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),u.jsx("p",{className:"fexp-bin-name",children:e}),t&&u.jsx("p",{className:"fexp-bin-meta",children:t}),u.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function rq(e,t){switch(t){case"typescript":case"javascript":return oq(e);case"json":return lq(e);case"python":return uq(e);case"css":case"scss":case"sass":case"less":return hq(e);case"html":case"xml":return dq(e);case"bash":case"shell":return fq(e);case"yaml":return pq(e);default:return[{kind:"text",value:e}]}}const aq=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","is","keyof","let","namespace","new","null","of","override","package","private","protected","public","readonly","return","satisfies","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]);function oq(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
222
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=Wa(e,n,"`","`");t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])||e[n]==="."&&/[0-9]/.test(e[n+1]??"")){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_$]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_$][\w$]*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);aq.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}function lq(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:r}=Wa(e,n,'"','"'),c=e.slice(n+r).trimStart().startsWith(":");t.push({kind:c?"attr":"str",value:i}),n+=r;continue}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(e.startsWith("true",n)||e.startsWith("false",n)||e.startsWith("null",n)){const i=e.slice(n).match(/^(true|false|null)/);if(i){t.push({kind:"key",value:i[0]}),n+=i[0].length;continue}}if(/[{}[\]:,]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}const cq=new Set(["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"]);function uq(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
223
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_]\w*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);cq.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function hq(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
|
|
224
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==="."||e[n]==="#"||e[n]===":"){const i=e.slice(n).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(i){t.push({kind:"tag",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z-]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z-][\w-]*/);if(i){const r=i[0];e.slice(n+r.length).trimStart().startsWith(":")?t.push({kind:"attr",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function dq(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("<!--",n)){const i=e.indexOf("-->",n+4),r=i===-1?e.slice(n):e.slice(n,i+3);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="<"){t.push({kind:"punct",value:"<"}),n++,e[n]==="/"&&(t.push({kind:"punct",value:"/"}),n++);const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);i&&(t.push({kind:"tag",value:i[0]}),n+=i[0].length);continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);if(i){const r=e.slice(n+i[0].length).trimStart();t.push({kind:r.startsWith("=")?"attr":"text",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function fq(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
|
|
225
|
-
`,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:r}),n+=o;continue}if(/[a-zA-Z_]/.test(e[n])){const r=e.slice(n).match(/^[a-zA-Z_][\w]*/);if(r){t.push({kind:i.has(r[0])?"key":"text",value:r[0]}),n+=r[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function pq(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
|
|
226
|
-
`,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Wa(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_][\w-]*/);if(i){e.slice(n+i[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:i[0]}):["true","false","null","yes","no","on","off"].includes(i[0])?t.push({kind:"key",value:i[0]}):t.push({kind:"text",value:i[0]}),n+=i[0].length;continue}}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function Wa(e,t,n,i){let r=t+n.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(i,r)){r+=i.length;break}if(i!=="`"&&e[r]===`
|
|
227
|
-
`)break;r++}return{slice:e.slice(t,r),length:r-t}}function mq({content:e,lang:t,truncated:n}){const i=y.useMemo(()=>gq(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[n&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:u.jsx("tbody",{children:i.map((r,o)=>u.jsxs("tr",{className:"fexp-code-row",children:[u.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:o+1}),u.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:r}})]},o))})})})]})}function gq(e,t){return e.split(`
|
|
228
|
-
`).map(i=>_q(i,t))}function _q(e,t){return t==="plaintext"||t==="markdown"?H2(e)||" ":rq(e,t).map(i=>{const r=H2(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function H2(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function vq({src:e,name:t}){return u.jsxs("div",{className:"fexp-img-wrap",children:[u.jsx("div",{className:"fexp-img-stage",children:u.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),u.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}const yq=new Set([".png",".jpg",".jpeg",".webp",".gif"]),bq=new Set(["img.shields.io"]),Sq=/^[a-z][a-z0-9+.-]*:/i;function F2(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||Sq.test(n))return null;const i=ZR(n);if(!i)return null;const r=Cq(i);return r===null?null:kq(r,t)}function wq(e){const t=ZR(e).toLowerCase();return[...yq].some(n=>t.endsWith(n))}function U2(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function xq(e){try{const t=new URL(e);return t.protocol==="https:"&&bq.has(t.hostname)}catch{return!1}}function ZR(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function Cq(e){try{return decodeURI(e)}catch{return null}}function kq(e,t){const n=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/"),r=i.includes("/")?i.slice(0,i.lastIndexOf("/")):"",o=n.startsWith("/")?n:`${r}/${n}`,c=[];for(const d of o.split("/"))if(!(!d||d===".")){if(d===".."){if(c.length===0)return null;c.pop();continue}c.push(d)}return c.length>0?c.join("/"):null}function Eq({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:r}){const o=y.useMemo(()=>{const g=$s(e).html,b=new DOMParser().parseFromString(g,"text/html");return sv(b.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i}),b.body.innerHTML},[e,n,i]),c=y.useRef(null);y.useEffect(()=>{const g=c.current;if(!g)return;zp(g),sv(g,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i});const b=new MutationObserver(()=>sv(g,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i}));return b.observe(g,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>b.disconnect()},[o,n,i]);const d=y.useCallback(g=>{const b=g.target.closest('[data-action="copy-code"]');if(!b)return;const S=b.closest("pre")?.getAttribute("data-code");if(!S)return;navigator.clipboard?.writeText(S);const w=b.textContent;b.textContent="Copied",window.setTimeout(()=>{b.textContent=w},1200)},[]),f=y.useCallback(g=>{const S=g.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(g.preventDefault(),t(w))},[t]),p=y.useCallback(g=>{if(g.key!=="Enter"&&g.key!==" ")return;const S=g.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(g.preventDefault(),t(w))},[t]),_=y.useCallback(g=>{d(g),f(g)},[d,f]);return u.jsxs("div",{className:"fexp-md-wrap",children:[r&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:c,className:"markdown-body",onClick:_,onKeyDown:p,dangerouslySetInnerHTML:{__html:o}})]})}function sv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=F2(i,t.currentRelativePath);r?(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("tabindex","0"),n.setAttribute("data-fexp-open-path",r),n.removeAttribute("aria-disabled")):i&&!/^(https?:|mailto:|#)/i.test(i)&&(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}for(const n of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const i=n.getAttribute("src")??"",r=n.getAttribute("data-fexp-local-image-path");if(n.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&r&&i===U2(t.theaterId,r)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&xq(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=F2(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&wq(o)){n.setAttribute("src",U2(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&Tq(n)}}function Tq(e){const t=e.getAttribute("alt")?.trim(),n=e.ownerDocument.createElement("span");n.className="fexp-md-blocked-image",n.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(n)}const Aq=360,U0=248,W0=200,pp=160,mp=4;function Rq(e){return e-W0-mp>=pp}function Nq(e,t,n){const i=n-W0-mp;return i<pp?e:Math.max(pp,Math.min(i,e-t))}function Lq(e){const t=W0+mp;return`minmax(0, 1fr) ${mp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function Mq(e){return e?Aq:null}const JR="fleet-console.file-explorer.treePaneWidth",q0={selectedPath:null,viewState:{kind:"none"}},Oq={...q0,treePaneWidth:U0},QR=new Map,W2=new Map,sb=new Set;let gp=$q();function Dq(e){return y.useSyncExternalStore(Bq,()=>Iq(e),()=>Oq)}function q2(e,t){e&&nN(e,{selectedPath:t})}function Na(e,t){e&&nN(e,{viewState:t})}function jq(e){gp=iN(e);try{localStorage.setItem(JR,String(gp))}catch{}eN()}function eN(){for(const e of sb)e()}function tN(e){return QR.get(e)??q0}function Iq(e){const t=e??"__none__",n=e!=null?tN(e):q0,i=W2.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===gp)return i;const r={...n,treePaneWidth:gp};return W2.set(t,r),r}function nN(e,t){QR.set(e,{...tN(e),...t}),eN()}function Bq(e){return sb.add(e),()=>{sb.delete(e)}}function $q(){try{return iN(Number(localStorage.getItem(JR)))}catch{return U0}}function iN(e){return!Number.isFinite(e)||e<=0?U0:Math.max(pp,Math.round(e))}const Pq=new Set([".png",".jpg",".jpeg",".webp",".gif"]),zq={id:"file-explorer",title:"Files",icon:Uq,render:e=>u.jsx(Fq,{...e})};function Hq(e){return{listFolder:async t=>{if(!e)throw new Error("no_theater");const n=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:t??""})});if(!n.ok){const i=await n.json();throw new Error(i.error??"list_failed")}return n.json()}}}function Fq(e){const{theaterId:t}=e,n=t??"",{selectedPath:i,viewState:r,treePaneWidth:o}=Dq(n),c=y.useRef(o);c.current=o;const d=y.useRef(null),[f,p]=y.useState(!1),_=y.useMemo(()=>Hq(t),[t]),g=y.useCallback(async(E,D)=>{if(!t){Na(t,{kind:"error",message:"no_theater"});return}q2(n,E);const j=D??E.split("/").filter(Boolean).at(-1)??E,z=j.slice(j.lastIndexOf(".")).toLowerCase();if(Pq.has(z)){const T=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(E)}`:"";Na(n,{kind:"image",relativePath:E,name:j,src:T});return}Na(n,{kind:"loading"});try{const T=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:E})});if(!T.ok){const L=await T.json();throw new Error(L.error??"read_failed")}const N=await T.json();if(N.binary){Na(n,{kind:"binary",name:j});return}Na(n,{kind:"code",relativePath:N.relativePath,content:N.content,lang:N.lang,truncated:N.truncated})}catch(T){const N=T instanceof Error?T.message:"Unable to load file";N==="binary_file"?Na(n,{kind:"binary",name:j}):Na(n,{kind:"error",message:N})}},[n,t]),b=y.useCallback(async E=>{E.kind==="file"&&await g(E.relativePath,E.name)},[g]),S=y.useCallback(()=>{Na(n,{kind:"none"}),q2(n,null)},[n]),w=y.useCallback(E=>{E.preventDefault();const D=d.current;if(!D)return;const j=D.getBoundingClientRect().width;if(!Rq(j))return;const z=E.clientX,T=c.current;p(!0);const N=H=>{const F=H.clientX-z,J=Nq(T,F,j);c.current=J,jq(J)},L=()=>{document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",L),p(!1)};document.addEventListener("pointermove",N),document.addEventListener("pointerup",L)},[]),x=r.kind!=="none";return y.useLayoutEffect(()=>{e.requestExtraWidth?.(Mq(x))},[e,x]),u.jsxs("div",{ref:d,className:`fexp-root${x?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:x?{gridTemplateColumns:Lq(o)}:void 0,children:[x&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"fexp-viewer-pane",children:[u.jsxs("div",{className:"fexp-viewer-head",children:[u.jsx("span",{className:"fexp-viewer-filename",children:r.kind!=="loading"&&r.kind!=="error"?"relativePath"in r?r.relativePath:r.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:S,"aria-label":"Close viewer",children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[r.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),r.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:r.message}),r.kind==="code"&&r.lang==="markdown"&&u.jsx(Eq,{content:r.content,onOpenPath:g,relativePath:r.relativePath,theaterId:t,truncated:r.truncated}),r.kind==="code"&&r.lang!=="markdown"&&u.jsx(mq,{content:r.content,lang:r.lang,truncated:r.truncated}),r.kind==="image"&&u.jsx(vq,{src:r.src,name:r.name}),r.kind==="binary"&&u.jsx(sq,{name:r.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(tq,{files:_,theaterId:t,contextKey:n,selectedPath:i,onSelect:b},n)})]})}function Uq(){return u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 5a2 2 0 012-2h3.586a1 1 0 01.707.293L10.707 4.7A1 1 0 0011.414 5H15a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}const Wq={id:"file-explorer",railPanels:[zq]},qq=[Wq],Gq={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function Kq(e){const t={dirs:{},files:[]};for(const n of e){const i=n.path.split("/");i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]={dirs:{},files:[]}),r=r.dirs[o];r.files.push(n)}return t}function sN({files:e,selectedPath:t,onSelect:n}){const i=Kq(e);return u.jsx(rN,{node:i,depth:0,selectedPath:t,onSelect:n})}function rN({node:e,depth:t,selectedPath:n,onSelect:i}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>u.jsx(Vq,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>u.jsx(Yq,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function Vq({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,c]=y.useState(!1),d=y.useCallback(()=>c(g=>!g),[]);let f=e,p=t;for(;Object.keys(p.dirs).length===1&&p.files.length===0;){const g=Object.keys(p.dirs)[0];f+="/"+g,p=p.dirs[g]}const _=n*16+12;return u.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${_}px`},onClick:d,"aria-expanded":!o,children:[u.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-folder-name",children:f})]}),!o&&u.jsx(rN,{node:p,depth:n+1,selectedPath:i,onSelect:r})]})}function Yq({entry:e,depth:t,selectedPath:n,onSelect:i}){const r=e.path===n,o=y.useCallback(()=>i(e),[e,i]),c=t*16+12,d=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`repository-file-row${r?" is-cur":""}`,style:{paddingLeft:`${c}px`},title:e.path,onClick:o,children:[u.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:Gq[e.status]??e.status}),u.jsx("span",{className:"repository-file-name",children:u.jsx("span",{className:"repository-file-fn",children:d})}),u.jsxs("span",{className:"repository-nums",children:[e.additions>0&&u.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const G2="fleet-console.diff.changesCollapsed",Xq={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function Zq(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function Jq(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function Qq({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:r,filterText:o}){const[c,d]=y.useState(()=>Jq(G2)),f=y.useCallback(()=>{d(g=>{const b=!g;try{localStorage.setItem(G2,b?"1":"0")}catch{}return b})},[]),p=y.useMemo(()=>e.kind==="ok"?Zq(e.files,o):[],[o,e]);if(e.kind==="loading")return u.jsx("div",{className:"repository-sections-loading",children:"Loading…"});if(e.kind==="notice"){const g=e.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=e.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return u.jsxs("div",{className:"repository-sections-notice",children:[u.jsx("strong",{className:"repository-notice-title",children:g}),u.jsx("span",{className:"repository-notice-body",children:b}),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]})}if(e.kind==="error")return u.jsxs("div",{className:"repository-sections-error",children:[u.jsx("span",{children:e.message}),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]});const _=o?`${p.length}/${e.files.length}`:String(e.files.length);return u.jsx("div",{className:"repository-sections",children:u.jsxs("div",{className:`repository-section${c?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-section-head",onClick:f,children:[u.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-section-name",children:"Changes"}),u.jsx("span",{className:"repository-count-badge",children:_})]}),!c&&u.jsx("div",{className:"repository-section-rows",children:p.length===0?u.jsx("div",{className:"repository-empty-row",children:o?"No matching items":"No changes"}):n==="tree"?u.jsx(sN,{files:p,selectedPath:i,onSelect:r}):p.map(g=>u.jsx(aN,{entry:g,isSelected:g.path===i,onSelect:r},g.path))})]})})}function aN({entry:e,isSelected:t,onSelect:n}){const i=y.useCallback(()=>n(e),[e,n]),r=e.path.endsWith("/")?e.path.slice(0,-1):e.path,o=r.lastIndexOf("/"),c=o>=0?r.slice(0,o+1):"",d=(o>=0?r.slice(o+1):r)+(e.path.endsWith("/")?"/":"");return u.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:i,children:[u.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":Xq[e.status]??e.status,children:e.status}),u.jsxs("span",{className:"repository-file-name",children:[u.jsx("span",{className:"repository-file-fn",children:d}),c&&u.jsx("span",{className:"repository-file-dir",children:c})]}),u.jsxs("span",{className:"repository-nums",children:[e.additions>0&&u.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const rb=new Set;let G0={file:null};function oN(){for(const e of rb)e()}function eG(e){return rb.add(e),()=>{rb.delete(e)}}function K2(){return G0}function tG(e,t){const n=y.useSyncExternalStore(eG,K2,K2);return!n.file||n.file.theaterId!==e||n.file.repoRel!==t?null:n.file}function nG(e,t,n){G0={file:{entry:e,theaterId:t,repoRel:n}},oN()}function rv(){G0={file:null},oN()}const iG=new Set(["import","export","from","const","let","var","function","return","await","async","new","interface","type","extends","implements","class","if","else","for","while","switch","case","of","in","typeof","void","null","undefined","true","false","as","default","throw","try","catch","describe","it","expect","require","module","public","private","readonly"]);function sG(e){let t="",n=0;const i=(r,o)=>`<span class="repository-token-${r}">${o}</span>`;for(;n<e.length;){const r=e[n];if(r==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(r==="/"&&e[n+1]==="/"||r==="#"){t+=i("comment",e.slice(n));break}if(r==='"'||r==="'"||r==="`"){const o=r,c=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(c,n));continue}if(/[0-9]/.test(r)&&!/[A-Za-z0-9_$]/.test(e[n-1]??"")){const o=n;for(;n<e.length&&/[0-9.xXa-fA-F]/.test(e[n]);)n++;t+=i("number",e.slice(o,n));continue}if(/[A-Za-z_$]/.test(r)){const o=n;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;const c=e.slice(o,n);t+=iG.has(c)?i("keyword",c):/^[A-Z]/.test(c)?i("type",c):c;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=i("punctuation",r),n++;continue}t+=r,n++}return t}const rG=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,aG=/^diff --git a\/(.+) b\/(.+)$/;function oG(e){if(!e)return[];const t=e.split(`
|
|
229
|
-
`);t[t.length-1]===""&&t.pop();const n=[];let i=0,r=0,o=!0;for(const c of t)if(!c.startsWith("\\")){if(c.startsWith("diff --git ")){const d=aG.exec(c),f=d?.[1],p=d?.[2]??c,_=f!==void 0&&f!==p?f:void 0;n.push({kind:"file-label",text:p,oldPath:_}),o=!0;continue}if(o){if(c.startsWith("new file mode")||c.startsWith("deleted file mode")||c.startsWith("old mode")||c.startsWith("new mode")||c.startsWith("rename from ")||c.startsWith("rename to ")||c.startsWith("similarity index")||c.startsWith("dissimilarity index")){n.push({kind:"meta",text:c});continue}if(c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ "))continue;if(!c.startsWith("@@")){c!==""&&n.push({kind:"ctx",text:` ${c}`});continue}}if(c.startsWith("@@")){o=!1;const d=rG.exec(c);if(d){i=parseInt(d[1]??"0",10),r=parseInt(d[2]??"0",10);const f=d[3]?.trimEnd()??"",p=`@@ -${d[1]??""} +${d[2]??""} @@${f?` ${f.trimStart()}`:""}`;n.push({kind:"hunk-label",text:p})}else n.push({kind:"hunk-label",text:c});continue}c.startsWith("+")?n.push({kind:"add",text:c,newLine:r++}):c.startsWith("-")?n.push({kind:"del",text:c,oldLine:i++}):n.push({kind:"ctx",text:c,oldLine:i++,newLine:r++})}return n}function cf(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function lN({ctx:e,repoRel:t,file:n,mode:i,commit:r}){const[o,c]=y.useState({kind:"loading"});if(y.useEffect(()=>{if(!e.theaterId){c({kind:"error",message:"no_theater"});return}let _=!1;return c({kind:"loading"}),r?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:r.theaterId,repoRel:r.repoRel,ref:r.fullHash,filePath:n.path,...n.oldPath??r.oldPath?{oldPath:n.oldPath??r.oldPath}:{}})}).then(async g=>{if(!g.ok)throw new Error((await g.json()).error??"git_failed");const b=await g.json();_||c({kind:"ok",result:b})}).catch(g=>{_||c({kind:"error",message:g instanceof Error?g.message:"unknown"})}):e.api.fetch("repository","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,filePath:n.path,mode:i})}).then(async g=>{if(!g.ok)throw new Error((await g.json()).error??"git_failed");const b=await g.json();_||c({kind:"ok",result:b})}).catch(g=>{_||c({kind:"error",message:g instanceof Error?g.message:"unknown"})}),()=>{_=!0}},[e.api,e.theaterId,n.oldPath,n.path,i,r,t]),o.kind==="loading")return u.jsx("div",{className:"repository-hunk-loading",children:"Loading…"});if(o.kind==="error")return u.jsx("div",{className:"repository-hunk-error",children:o.message});const{result:d}=o,p=oG(d.content).filter(_=>_.kind!=="file-label");return u.jsxs("div",{className:"repository-hunk-wrap",children:[d.truncated&&u.jsx("div",{className:"repository-truncated-badge",children:"Diff truncated"}),u.jsx("div",{className:"repository-hunk-scroll",children:u.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:u.jsx("tbody",{children:p.map((_,g)=>u.jsx("tr",{className:`repository-line repository-line-${_.kind}`,children:_.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:cf(_.text)}}):_.kind==="meta"?u.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:cf(_.text)}}):_.kind==="file-label"?u.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:cf(_.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"repository-gutter repository-gutter-old",children:_.oldLine??""}),u.jsx("td",{className:"repository-gutter repository-gutter-new",children:_.newLine??""}),u.jsx("td",{className:"repository-marker",children:_.kind==="add"?"+":_.kind==="del"?"−":""}),u.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:sG(cf(_.text.length>0?_.text.slice(1):_.text))}})]})},g))})})})]})}const ab=12,Nl=28,av=3,lG=5,V2=["var(--brass)","var(--aurora)","var(--warn)","var(--positive)","color-mix(in oklch, var(--brass) 70%, var(--aurora))","color-mix(in oklch, var(--aurora) 70%, var(--positive))","color-mix(in oklch, var(--warn) 72%, var(--brass))","color-mix(in oklch, var(--ink-spectral) 76%, var(--aurora))"];function Ru(e){return e*ab+6}function bo(e){return V2[e%V2.length]??"var(--ink-fog)"}function cG({node:e,laneCount:t,collapsed:n=!1}){const i=Math.max(t,1),r=n?10:0,o=i*ab+r,c=Ru(e.lane),d=Nl/2;return u.jsxs("svg",{width:o,height:Nl,viewBox:`0 0 ${o} ${Nl}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(f=>u.jsx("line",{x1:Ru(f),y1:0,x2:Ru(f),y2:Nl,stroke:bo(f),strokeWidth:1.5},`pt-${f}`)),e.connectAbove&&u.jsx("line",{x1:c,y1:0,x2:c,y2:d-av,stroke:bo(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:c,y1:d+av,x2:c,y2:Nl,stroke:bo(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(f=>u.jsx("line",{x1:Ru(f),y1:0,x2:c,y2:d,stroke:bo(f),strokeWidth:1.5,strokeLinecap:"round"},`mf-${f}`)),e.branchToLanes.map(f=>u.jsx("line",{x1:c,y1:d,x2:Ru(f),y2:Nl,stroke:bo(f),strokeWidth:1.5,strokeLinecap:"round"},`bt-${f}`)),e.isHead&&u.jsx("circle",{cx:c,cy:d,r:lG,fill:"none",stroke:bo(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:c,cy:d,r:av,fill:bo(e.lane)}),n&&u.jsx("text",{x:i*ab+2,y:d+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const ov=8;function uG(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],n=[];let i=!1,r=0;for(let o=0;o<e.length;o++){const c=e[o],d=c.fullHash,f=[...c.parents],p=[];for(let x=0;x<t.length;x++)t[x]===d&&p.push(x);let _,g=!1;const b=[];if(p.length===0){const x=t.indexOf(null);x>=0?_=x:t.length<ov?(_=t.length,t.push(null)):(i=!0,_=ov-1,t[_]=null,g=!0)}else{_=Math.min(...p);for(const x of p)x!==_&&(b.push(x),t[x]=null)}const S=[];if(f.length===0)t[_]=null;else{t[_]=g?null:f[0]??null;for(const x of f.slice(1))if(!(t.indexOf(x)>=0)){const D=t.indexOf(null);if(D>=0)t[D]=x,S.push(D);else if(t.length<ov){const j=t.length;t.push(x),S.push(j)}else i=!0}}const w=t.map((x,E)=>({h:x,i:E})).filter(({h:x,i:E})=>x!==null&&E!==_).map(({i:x})=>x);r=Math.max(r,_,...S,...w),n.push({lane:_,isHead:c.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:p.length>0,connectBelow:f.length>0&&t[_]===f[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}function cN(e,t=new Date){const n=new Date(e*1e3);if(!Number.isFinite(n.getTime()))return"—";const i=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),c=Math.round((r-o)/864e5);return c===0?`Today ${i}`:c===1?`Yesterday ${i}`:`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function K0(e){const t=[];for(const n of e.refs)if(n==="HEAD")t.push({label:"HEAD",kind:"head"});else if(n.startsWith("HEAD -> refs/heads/"))t.push({label:n.slice(19),kind:"branch"});else if(n.startsWith("HEAD -> "))t.push({label:n.slice(8),kind:"branch"});else if(n.startsWith("tag: refs/tags/"))t.push({label:n.slice(15),kind:"tag"});else if(n.startsWith("tag: "))t.push({label:n.slice(5),kind:"tag"});else if(n.startsWith("refs/remotes/")){const i=n.slice(13);i.endsWith("/HEAD")||t.push({label:i,kind:"remote"})}else n.startsWith("refs/worktrees/")?t.push({label:n.slice(15),kind:"worktree"}):n.startsWith("refs/heads/")?t.push({label:n.slice(11),kind:"branch"}):t.push({label:n,kind:"branch"});return t}const uN=140,hN=120,dN=160,Zr=4,fN=null;function hG({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const c=n-r-o;return c<i?fN:Math.max(i,Math.min(c,e-t))}function dG(e){const t=uN+Zr;return`minmax(0, 1fr) ${Zr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function fG(e){const t=dN+Zr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Zr}px minmax(0, 1fr)`}function pN(e,t,n,i,r,o=Zr){const c=n-r-o;return c<i?fN:Math.max(i,Math.min(c,e+t))}function pG(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Zr}px minmax(120px, 1fr)`}function mG(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Zr}px minmax(140px, 1fr)`}function mN({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let r=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",c),t.removeEventListener("blur",c)},c=()=>{r&&(r=!1,o(),i())},d=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),t.addEventListener("blur",c),d}const gN="fleet-console.history.logHeight",Y2="fleet-console.history.headerHeight",X2="fleet-console.history.fileListWidth",_N="fleet-console.history.filesView",gG=240,_G=214,vG=180;function yG(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function bG(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.subject.toLowerCase().includes(n)||i.authorName.toLowerCase().includes(n)||i.shortHash.toLowerCase().includes(n)||i.fullHash.toLowerCase().includes(n)||i.refs.some(r=>r.toLowerCase().includes(n))||K0(i).some(r=>r.label.toLowerCase().includes(n))):e}function SG(e){return e==="Escape"}function wG(e){return e.reduce((t,n)=>({files:t.files+1,additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{files:0,additions:0,deletions:0})}function xG(e,t,n){return e.files>0&&!t&&!n}function Z2({current:e}){return e?u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:u.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:u.jsx("path",{d:"M1.5 3.4h3l1 1.1h5v5.1a.9.9 0 01-.9.9H2.4a.9.9 0 01-.9-.9V4.3a.9.9 0 01.9-.9z",stroke:"currentColor",strokeWidth:"1.2"})})}function CG({entry:e,checkouts:t,selected:n,graphNode:i,laneCount:r,layoutCollapsed:o,onSelect:c}){const d=K0(e),f=yG(e,t);return u.jsxs("button",{type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>c(e),children:[u.jsx("span",{className:"history-commit-subject",children:e.subject}),u.jsx("span",{className:"history-commit-sha",children:e.shortHash}),u.jsx("span",{className:"history-commit-time",children:cN(e.authorAt)}),u.jsxs("span",{className:"history-commit-badges",children:[d.map(p=>{const _=p.kind==="branch"?t.find(g=>g.branch===p.label):null;return u.jsxs("span",{className:`history-badge history-badge--${p.kind}`,children:[_&&u.jsx(Z2,{current:_.isCurrent}),p.label]},`${p.kind}:${p.label}`)}),f&&u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(Z2,{current:f.isCurrent}),"detached"]})]}),u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(cG,{node:i,laneCount:r,collapsed:o})})]})}function kG({ctx:e,repoRel:t,target:n,onSelectCommit:i,onClose:r}){const[o,c]=y.useState({kind:"loading"}),[d,f]=y.useState("details"),[p,_]=y.useState(null),[g,b]=y.useState(!1),[S,w]=y.useState(()=>ob(Y2,_G)),[x,E]=y.useState(()=>ob(X2,vG)),[D,j]=y.useState(NG),z=y.useRef(null),T=y.useRef(null),N=y.useRef(null),L=y.useRef(S),H=y.useRef(x),F=y.useMemo(()=>({fullHash:n.fullHash,theaterId:e.theaterId??"",repoRel:t}),[n.fullHash,e.theaterId,t]);y.useEffect(()=>{let G=!1;return c({kind:"loading"}),e.api.fetch("repository","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,ref:n.fullHash})}).then(async P=>{if(!P.ok)throw new Error((await P.json()).error??"git_failed");return P.json()}).then(P=>{G||(c({kind:"ok",result:P}),_(P.files[0]?.path??null))}).catch(P=>{G||c({kind:"error",message:P instanceof Error?P.message:"unknown"})}),()=>{G=!0}},[e.api,e.theaterId,t,n.fullHash]),y.useEffect(()=>()=>N.current?.(),[]);const J=y.useCallback((G,P)=>{G.preventDefault();const A=P==="y"?z.current:T.current;if(!A)return;const $=P==="y"?L.current:H.current,M=P==="y"?G.clientY:G.clientX,k=P==="y"?A.getBoundingClientRect().height:A.getBoundingClientRect().width;N.current?.(),N.current=mN({documentTarget:document,windowTarget:window,onMove:B=>{const O=B,W=pN($,(P==="y"?O.clientY:O.clientX)-M,k,120,120);W!==null&&(P==="y"?(L.current=W,w(W)):(H.current=W,E(W)))},onFinish:()=>{const B=P==="y"?L.current:H.current;try{localStorage.setItem(P==="y"?Y2:X2,String(B))}catch{}N.current=null}})},[]),pe=o.kind==="loading"?u.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):o.kind==="error"?u.jsx("div",{className:"history-inspector-empty history-inspector-error",children:o.message}):(()=>{const{meta:G,files:P}=o.result,A=P.find(U=>U.path===p)??P[0]??null,$=P.reduce((U,R)=>U+R.additions,0),M=P.reduce((U,R)=>U+R.deletions,0),k=n.entry,B=(U,R)=>{_(U.path),R&&f("changes")},O=U=>{j(U);try{localStorage.setItem(_N,U)}catch{}},W=()=>{const U=navigator.clipboard?.writeText(n.fullHash);U&&U.then(()=>{b(!0),window.setTimeout(()=>b(!1),1200)}).catch(()=>{})};return d==="details"?u.jsxs("div",{ref:z,className:"history-details-tab",style:{gridTemplateRows:pG(S)},children:[u.jsx(EG,{meta:G,entry:k,fullHash:n.fullHash,copied:g,onCopy:W,onParent:U=>i({fullHash:U})}),u.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:U=>J(U,"y")}),u.jsx(J2,{files:P,selectedPath:p,additions:$,deletions:M,viewMode:D,onViewMode:O,onSelect:U=>B(U,!0)})]}):u.jsx("div",{className:"history-changes-tab",children:u.jsxs("div",{ref:T,className:"history-changes-columns",style:{gridTemplateColumns:mG(x)},children:[u.jsx(J2,{files:P,selectedPath:p,additions:$,deletions:M,viewMode:D,onViewMode:O,onSelect:U=>B(U,!1)}),u.jsx("div",{className:"history-divider",onPointerDown:U=>J(U,"x")}),A?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-repository-head",children:[u.jsx("span",{title:A.path,children:A.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":"Previous file",disabled:P.indexOf(A)===0,onClick:()=>B(P[P.indexOf(A)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":"Next file",disabled:P.indexOf(A)===P.length-1,onClick:()=>B(P[P.indexOf(A)+1],!1),children:"›"})]})]}),u.jsx(lN,{ctx:e,repoRel:t,file:A,mode:"unified",commit:F})]}):u.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return u.jsxs("div",{className:"history-inspector",onKeyDown:G=>{SG(G.key)&&(G.preventDefault(),r())},children:[u.jsxs("div",{className:"history-segmented",children:[u.jsx("button",{type:"button","aria-pressed":d==="details",onClick:()=>f("details"),children:"Details"}),u.jsxs("button",{type:"button","aria-pressed":d==="changes",onClick:()=>f("changes"),children:["Changes ",o.kind==="ok"&&u.jsx("span",{children:o.result.files.length})]}),u.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:r,children:"✕"})]}),pe]})}function EG({meta:e,entry:t,fullHash:n,copied:i,onCopy:r,onParent:o}){return u.jsxs("div",{className:"history-inspector-head",children:[u.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&u.jsx("pre",{className:"history-inspector-message",children:e.body}),u.jsxs("div",{className:"history-author",children:[u.jsx("span",{className:"history-avatar",children:LG(e.authorName)}),u.jsxs("span",{children:[u.jsx("b",{children:e.authorName}),u.jsx("small",{children:e.authorEmail})]}),u.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??cN(e.authorAt)})]}),u.jsxs("div",{className:"history-inspector-ids",children:[u.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:r,children:[n,u.jsx("span",{children:i?"copied":"copy"})]}),e.parents.map(c=>u.jsxs("button",{type:"button",className:"history-parent",onClick:()=>o(c.full),children:["parent ",c.short]},c.full))]}),t&&u.jsx("div",{className:"history-ref-chips",children:K0(t).map(c=>u.jsx("span",{className:`history-badge history-badge--${c.kind}`,children:c.label},`${c.kind}:${c.label}`))})]})}function J2({files:e,selectedPath:t,additions:n,deletions:i,viewMode:r,onViewMode:o,onSelect:c}){return u.jsxs("section",{className:"history-commit-files",children:[u.jsxs("div",{className:"history-files-title",children:[u.jsx("span",{className:"history-files-label",children:"Changed files"}),u.jsxs("span",{className:"history-files-stats",children:[e.length," ",u.jsxs("i",{children:["+",n]})," ",u.jsxs("em",{children:["−",i]})]}),u.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${r==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":r==="list",onClick:()=>o("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`repository-toggle-btn${r==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":r==="tree",onClick:()=>o("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx("div",{className:"history-files-scroll",children:r==="tree"?u.jsx(sN,{files:e,selectedPath:t,onSelect:c}):e.map(d=>u.jsx(aN,{entry:d,isSelected:d.path===t,onSelect:c},d.path))})]})}function TG({ctx:e,repoRel:t,active:n=!0,refFilter:i=null,wipFiles:r,onInspectorOpenChange:o,onClearRef:c,onWip:d}){return u.jsx(AG,{ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,onInspectorOpenChange:o,onClearRef:c,onWip:d},`${e.theaterId??""}:${t}`)}function AG({ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,onInspectorOpenChange:o,onClearRef:c,onWip:d}){const[f,p]=y.useState({kind:"loading"}),[_,g]=y.useState(null),[b,S]=y.useState(""),[w,x]=y.useState(0),[E,D]=y.useState(RG),[j,z]=y.useState(!1),T=y.useRef(null),N=y.useRef(null),L=y.useRef(E);y.useEffect(()=>{g(null)},[i]);const[H,F]=y.useState(n);y.useEffect(()=>{n&&F(!0)},[n]),y.useEffect(()=>{if(!H)return;if(!e.theaterId){p({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let $=!1;return p({kind:"loading"}),e.api.fetch("repository","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,...i?{ref:i}:{}})}).then(async M=>{if(!M.ok)throw new Error((await M.json()).error??"git_failed");return M.json()}).then(M=>{$||p({kind:"ok",commits:M.commits,checkouts:M.checkouts,truncated:M.truncated??!1})}).catch(M=>{$||p({kind:"error",message:M instanceof Error?M.message:"unknown"})}),()=>{$=!0}},[e.api,e.theaterId,H,w,i,t]),y.useEffect(()=>{o?.(n&&_!==null)},[n,o,_]),y.useEffect(()=>()=>N.current?.(),[]);const J=y.useCallback($=>{$.preventDefault();const M=T.current;if(!M)return;const k=L.current,B=$.clientY,O=M.getBoundingClientRect().height;N.current?.(),z(!0),N.current=mN({documentTarget:document,windowTarget:window,onMove:W=>{const U=pN(k,W.clientY-B,O,hN,dN,Zr);U!==null&&(L.current=U,D(U))},onFinish:()=>{try{localStorage.setItem(gN,String(L.current))}catch{}z(!1),N.current=null}})},[]),pe=y.useMemo(()=>f.kind==="ok"?bG(f.commits,b):[],[b,f]),G=f.kind==="ok"?uG(pe):null,P=y.useMemo(()=>wG(r),[r]),A=xG(P,b,i);return u.jsxs("div",{ref:T,className:`history-root${j?" is-dragging":""}`,style:_?{gridTemplateRows:fG(E)}:void 0,children:[u.jsxs("div",{className:"history-list-pane",children:[u.jsxs("div",{className:"history-toolbar",children:[u.jsxs("div",{className:"history-filter",children:[u.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:b,onChange:$=>S($.target.value)}),b&&u.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>S(""),children:"✕"})]}),i&&u.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:c,children:[i," ✕"]}),f.kind==="ok"&&u.jsx("span",{className:"history-count",children:b?`${pe.length}/${f.commits.length}`:f.commits.length})]}),u.jsxs("div",{className:"history-list",children:[A&&u.jsxs("button",{type:"button",className:"repository-wip-row",onClick:d,children:["Uncommitted changes ",u.jsxs("span",{children:[P.files," files · +",P.additions," −",P.deletions]})]}),f.kind==="loading"&&u.jsx("div",{className:"history-empty",children:"Loading…"}),f.kind==="error"&&u.jsxs("div",{className:"history-error",children:[f.message,u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>x($=>$+1),children:"Retry"})]}),f.kind==="ok"&&f.commits.length===0&&u.jsx("div",{className:"history-empty",children:"No history"}),f.kind==="ok"&&f.commits.length>0&&pe.length===0&&u.jsx("div",{className:"history-empty",children:"No matching items"}),f.kind==="ok"&&G&&pe.map(($,M)=>u.jsx(CG,{entry:$,checkouts:f.checkouts,selected:_?.fullHash===$.fullHash,graphNode:G.nodes[M],laneCount:G.activeLaneCount,layoutCollapsed:G.collapsed,onSelect:k=>g({fullHash:k.fullHash,entry:k})},$.fullHash)),f.kind==="ok"&&(f.truncated||f.commits.length>=200)&&u.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),_&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":"Resize commit log",onPointerDown:J}),u.jsx("div",{className:"history-detail-pane",children:u.jsx(kG,{ctx:e,repoRel:t,target:_,onSelectCommit:g,onClose:()=>g(null)})})]})]})}function RG(){return ob(gN,gG,hN)}function NG(){try{const e=localStorage.getItem(_N);if(e==="list"||e==="tree")return e}catch{}return"list"}function ob(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function LG(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const vN="fleet-console.diff.viewMode",yN="fleet-console.diff.listPaneWidth",bN="fleet-console.repository.source",Wp="fleet-console.repository.repo.",SN="fleet-console.repository.scanDepth",lb=1,wN=8,MG=3,OG=400,DG=248,xN=220;function jG(){try{const e=localStorage.getItem(vN);if(e==="list"||e==="tree")return e}catch{}return"list"}function IG(){try{const e=localStorage.getItem(bN);if(e==="repositories"||e==="worktrees"||e==="changes"||e==="history"||e==="branches"||e==="tags"||e==="stashes")return e}catch{}return"changes"}function BG(e){try{return localStorage.getItem(`${Wp}${e}`)??""}catch{return""}}function $G(e,t,n){try{const i=`${Wp}${e}`,r=localStorage.getItem(i);if(r===null)return"";if(t.some(o=>o.relPath===r)||n.some(o=>o.relPath===r))return r;localStorage.removeItem(i)}catch{}return""}function PG(){try{const e=Number.parseInt(localStorage.getItem(SN)??"",10);if(Number.isInteger(e)&&e>=lb&&e<=wN)return e}catch{}return MG}function zG(e){try{localStorage.setItem(SN,String(e))}catch{}}function HG(e,t){try{localStorage.setItem(`${Wp}${e}`,t)}catch{}}function FG(e){try{localStorage.removeItem(`${Wp}${e}`)}catch{}}function UG(e){try{localStorage.setItem(bN,e)}catch{}}function WG(){try{const e=localStorage.getItem(yN),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(xN,t)}catch{}return DG}function qG(e){return e.entry.status==="U"?"untracked":"unified"}function GG({ctx:e}){return u.jsx(VG,{ctx:e},e.theaterId)}function CN(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function KG(e,t){const n=(i,r)=>i.map(o=>({key:o.ref,source:r,primary:o.label,ref:o.ref,current:o.current}));return e==="branches"?[{label:"LOCAL",rows:n(t.branches,"branches")},{label:"REMOTES",rows:n(t.remotes.filter(i=>!CN(i.ref)),"branches")}]:e==="tags"?[{rows:n(t.tags,"tags")}]:[{rows:t.stashes.map(i=>({key:i.name,source:e,primary:i.subject||i.name,sub:i.name,ref:null,current:!1}))}]}function VG({ctx:e}){const[t,n]=y.useState([]),[i,r]=y.useState(!1),[o,c]=y.useState(0),[d,f]=y.useState(!1),[p,_]=y.useState(PG),g=y.useCallback(Ee=>{_(Ee),zG(Ee)},[]),[b,S]=y.useState(!1),[w,x]=y.useState([]),[E,D]=y.useState(!1),[j,z]=y.useState(0),[T,N]=y.useState(null),[L,H]=y.useState(()=>e.theaterId?BG(e.theaterId):""),F=y.useRef(L),[J,pe]=y.useState(IG),[G,P]=y.useState(null),[A,$]=y.useState({branches:[],remotes:[],tags:[],stashes:[]}),[M,k]=y.useState(!1),[B,O]=y.useState(0),[W,U]=y.useState({kind:"loading"}),[R,Y]=y.useState(0),[Z,me]=y.useState(!1),[ue,oe]=y.useState(jG),[ke,Ne]=y.useState(""),Re=tG(e.theaterId??null,L),[ot,Le]=y.useState(WG),Se=y.useRef(ot),xe=y.useRef(null),[Me,Ke]=y.useState(!1),it=y.useCallback(Ee=>{pe(Ee),UG(Ee)},[]),Ge=y.useCallback((Ee,ft)=>{e.theaterId&&(ft&&HG(e.theaterId,Ee),rv(),P(null),Ne(""),me(!1),U({kind:"loading"}),$({branches:[],remotes:[],tags:[],stashes:[]}),F.current=Ee,H(Ee),it("changes"))},[e.theaterId,it]);y.useEffect(()=>{if(!e.theaterId)return;let Ee=!1;return r(!1),S(!1),e.api.fetch("repository","repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:p})}).then(ft=>ft.json()).then(ft=>{Ee||(n(ft.repos),f(ft.truncated===!0),S(!0))}).catch(()=>{Ee||r(!0)}),()=>{Ee=!0}},[e.api,e.theaterId,o,p]),y.useEffect(()=>{if(!e.theaterId)return;let Ee=!1;const ft=L;return x([]),D(!1),N(null),e.api.fetch("repository","worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:ft})}).then(pn=>pn.json()).then(pn=>{Ee||(x(pn.worktrees),N(ft))}).catch(pn=>{if(Ee)return;if((typeof pn=="object"&&pn!==null&&"status"in pn?pn.status:null)===400&&ft!==""){FG(e.theaterId),Ge("",!1);return}D(!0)}),()=>{Ee=!0}},[e.api,e.theaterId,L,Ge,j]),y.useEffect(()=>{if(!e.theaterId||!b||T!==L)return;const Ee=$G(e.theaterId,t,w);Ee!==F.current&&Ge(Ee,!1)},[e.theaterId,L,t,b,Ge,w,T]),y.useEffect(()=>{if(!e.theaterId)return;let Ee=!1;return $({branches:[],remotes:[],tags:[],stashes:[]}),k(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:L})}).then(ft=>ft.ok?ft.json():Promise.reject()).then(ft=>{Ee||$(ft)}).catch(()=>{Ee||k(!0)}),()=>{Ee=!0}},[e.api,e.theaterId,L,B]),y.useEffect(()=>{if(!e.theaterId){U({kind:"error",message:"no_theater"});return}let Ee=!1;return U({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:L})}).then(async ft=>{if(!ft.ok){const In=(await ft.json()).error??"git_failed";Ee||U(In==="no_git_repo"||In==="git_unavailable"?{kind:"notice",reason:In}:{kind:"error",message:In});return}const pn=await ft.json();Ee||U({kind:"ok",files:pn.files})}).catch(ft=>{Ee||U({kind:"error",message:ft instanceof Error?ft.message:"unknown"})}),()=>{Ee=!0}},[R,e.theaterId,L]),y.useLayoutEffect(()=>()=>rv(),[]);const he=y.useCallback(Ee=>{e.theaterId&&nG(Ee,e.theaterId,L)},[e.theaterId,L]),Qe=y.useCallback(Ee=>{if(!e.theaterId||Ee.relPath===L){it("changes");return}Ge(Ee.relPath,!0)},[e.theaterId,L,it,Ge]),Ye=y.useCallback(()=>rv(),[]),Ht=y.useCallback(Ee=>{oe(Ee);try{localStorage.setItem(vN,Ee)}catch{}},[]),we=y.useCallback(Ee=>{Ee.preventDefault();const ft=xe.current;if(!ft)return;const pn=ft.getBoundingClientRect().width,Ci=Ee.clientX,In=Se.current;Ke(!0);const Mn=ie=>{const le=hG({startWidth:In,dx:ie.clientX-Ci,containerWidth:pn,listPaneMinWidth:xN,hunkPaneMinWidth:uN,dividerWidth:Zr});le!==null&&(Se.current=le,Le(le))},mn=()=>{document.removeEventListener("pointermove",Mn),document.removeEventListener("pointerup",mn),Ke(!1);try{localStorage.setItem(yN,String(Se.current))}catch{}};document.addEventListener("pointermove",Mn),document.addEventListener("pointerup",mn)},[]);y.useLayoutEffect(()=>(e.requestExtraWidth?.(J==="changes"&&Re||J==="history"&&Z?OG:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,Re,J,Z]);const Je=Re?qG(Re):null,st=y.useCallback(()=>Y(Ee=>Ee+1),[]),Vn=W.kind==="ok"?W.files:[],bt=t.find(Ee=>Ee.relPath===L)??w.find(Ee=>Ee.relPath===L);return u.jsxs("div",{className:"repository-unified",children:[u.jsxs("div",{className:`repository-identity${L?" is-subcontext":""}`,children:[u.jsx(kN,{}),u.jsx("strong",{children:bt?.name??"Repository"}),bt?.branch&&u.jsx("span",{children:bt.branch})]}),u.jsxs("div",{className:"repository-unified-body",children:[u.jsx(YG,{source:J,refs:A,repos:t,worktrees:w,onSource:it}),u.jsxs("div",{className:"repository-source-content",children:[J==="repositories"?i?u.jsxs("div",{className:"history-error",children:["Unable to load repositories",u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>c(Ee=>Ee+1),children:"Retry"})]}):u.jsx(XG,{repos:t,selectedRel:L,onRepository:Qe,scanDepth:p,onScanDepth:g,truncated:d}):null,J==="worktrees"?E?u.jsxs("div",{className:"history-error",children:["Unable to load worktrees",u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>z(Ee=>Ee+1),children:"Retry"})]}):u.jsx(ZG,{worktrees:w,onWorktree:Qe}):null,u.jsx("div",{className:"repository-source-fill",hidden:J!=="history",children:u.jsx(TG,{ctx:e,repoRel:L,active:J==="history",refFilter:G,wipFiles:Vn,onInspectorOpenChange:me,onClearRef:()=>P(null),onWip:()=>it("changes")},`${e.theaterId??""}:${L}`)}),J!=="repositories"&&J!=="worktrees"&&J!=="changes"&&J!=="history"?M?u.jsxs("div",{className:"history-error",children:["Unable to load refs",u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>O(Ee=>Ee+1),children:"Retry"})]}):u.jsx(JG,{source:J,refs:A,onRef:Ee=>{P(Ee),it("history")}}):null,u.jsxs("div",{hidden:J!=="changes",ref:xe,className:`repository-root${Re?" has-hunk":""}${Me?" is-dragging":""}`,style:Re?{gridTemplateColumns:dG(ot)}:void 0,children:[Re&&Je?u.jsxs("div",{className:"repository-hunk-pane",children:[u.jsxs("div",{className:"repository-hunk-head",children:[u.jsx("span",{children:Re.entry.path}),u.jsx("button",{type:"button",onClick:Ye,children:"✕"})]}),u.jsx(lN,{ctx:e,repoRel:L,file:Re.entry,mode:Je})]}):null,Re?u.jsx("div",{className:"repository-divider",onPointerDown:we,"aria-hidden":"true"}):null,u.jsxs("div",{className:"repository-list-pane",children:[u.jsxs("div",{className:"repository-toolbar",children:[u.jsxs("div",{className:"repository-filter",children:[u.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:ke,onChange:Ee=>Ne(Ee.target.value)}),ke?u.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear filter",onClick:()=>Ne(""),children:"✕"}):null]}),u.jsxs("div",{className:"repository-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${ue==="list"?" is-active":""}`,title:"List view","aria-pressed":ue==="list",onClick:()=>Ht("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`repository-toggle-btn${ue==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":ue==="tree",onClick:()=>Ht("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx(Qq,{state:W,onRetry:st,viewMode:ue,selectedPath:Re?.entry.path??null,onSelect:he,filterText:ke})]})]})]})]})]})}function qp({source:e}){const t=e==="repositories"?"M3 5h12v9H3zM5 3h8v2":e==="worktrees"?"M5 3v12M5 6h7M5 12h7":e==="changes"?"M3 4h12M3 9h12M3 14h12":e==="history"?"M4 4v10h10M7 7h6v5":e==="branches"?"M5 3v12M5 6h7M5 12h7":e==="tags"?"M3 4h8l4 4-7 7-5-5z":"M4 5h10v9H4zM6 3h6";return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function YG({source:e,refs:t,repos:n,worktrees:i,onSource:r}){const o=(c,d,f)=>u.jsxs("button",{type:"button","aria-label":d,"aria-current":e===c?"page":void 0,onClick:()=>r(c),children:[u.jsx(qp,{source:c}),u.jsx("span",{children:d}),f!==void 0&&u.jsx("i",{children:f})]},c);return u.jsxs("nav",{className:"repository-source-nav","aria-label":"Repository sources",children:[u.jsx("b",{children:"CONTEXT"}),o("repositories","Repositories",n.length),o("worktrees","Worktrees",i.length),u.jsx("b",{children:"WORKING"}),o("changes","Changes"),o("history","History"),u.jsx("b",{children:"REFS"}),o("branches","Branches",t.branches.length+t.remotes.filter(c=>!CN(c.ref)).length),o("tags","Tags",t.tags.length),o("stashes","Stashes",t.stashes.length)]})}function XG({repos:e,selectedRel:t,onRepository:n,scanDepth:i,onScanDepth:r,truncated:o}){const c=["root","nested"].map(d=>({kind:d,label:d==="root"?"THIS THEATER":"NESTED",repos:e.filter(f=>f.kind===d)})).filter(d=>d.repos.length>0);return u.jsxs("div",{className:"repository-scan-pane",children:[u.jsx("div",{className:"repository-ref-list",children:c.map(d=>u.jsxs("div",{className:"repository-ref-group",children:[u.jsx("b",{className:"repository-ref-group-label",children:d.label}),d.repos.map(f=>u.jsxs("button",{type:"button",title:f.relPath,className:`repository-ref-row${f.relPath===t?" is-current":""}`,onClick:()=>n(f),children:[u.jsx(qp,{source:"repositories"}),u.jsxs("span",{className:"repository-ref-name",children:[f.name,f.relPath===t&&" ✓"]}),f.branch&&u.jsx("span",{className:"repository-ref-sub",children:f.branch})]},f.relPath))]},d.kind))}),u.jsxs("div",{className:"repository-scan-foot",children:[u.jsx("label",{htmlFor:"repository-scan-depth",children:"Depth"}),u.jsx("select",{id:"repository-scan-depth",className:"repository-scan-depth",value:i,onChange:d=>r(Number.parseInt(d.target.value,10)),children:Array.from({length:wN-lb+1},(d,f)=>lb+f).map(d=>u.jsx("option",{value:d,children:d},d))}),u.jsxs("span",{className:"repository-scan-count",children:[e.length," found",o?" · limit reached":""]})]})]})}function ZG({worktrees:e,onWorktree:t}){return u.jsx("div",{className:"repository-ref-list",children:e.map(n=>u.jsxs("button",{type:"button",title:n.relPath,className:`repository-ref-row${n.current?" is-current":""}`,onClick:()=>t(n),children:[u.jsx(qp,{source:"worktrees"}),u.jsxs("span",{className:"repository-ref-name",children:[n.name,n.current&&" ✓"]}),n.branch&&u.jsx("span",{className:"repository-ref-sub",children:n.branch})]},n.relPath))})}function JG({source:e,refs:t,onRef:n}){return e==="repositories"||e==="worktrees"||e==="changes"||e==="history"?null:u.jsx("div",{className:"repository-ref-list",children:KG(e,t).map(i=>u.jsxs("div",{className:"repository-ref-group",children:[i.label&&u.jsx("b",{className:"repository-ref-group-label",children:i.label}),i.rows.map(r=>u.jsxs("button",{type:"button",className:`repository-ref-row${r.current?" is-current":""}`,disabled:r.ref===null,onClick:()=>{r.ref&&n(r.ref)},children:[u.jsx(qp,{source:r.source}),u.jsxs("span",{className:"repository-ref-name",children:[r.primary,r.current&&" ✓"]}),r.sub&&u.jsx("span",{className:"repository-ref-sub",children:r.sub})]},r.key))]},i.label??e))})}function kN(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),u.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const QG={id:"repository",title:"Repository",icon:()=>u.jsx(kN,{}),render:e=>u.jsx(GG,{ctx:e})},eK={id:"repository",railPanels:[QG]},tK=[eK],uf=["claude-code","codex","cursor","opencode"],nK={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},iK="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function sK({source:e,skill:t,theaterId:n,onCancel:i,onStarted:r,jobLog:o}){const[c,d]=y.useState(n?"project":"global"),[f,p]=y.useState(!0),[_,g]=y.useState(new Set(uf)),{status:b,start:S}=o,w=b==="running",x=b==="done",E=b==="error",D=y.useCallback(()=>{p(!0),g(new Set(uf))},[]),j=y.useCallback(T=>{p(!1),g(N=>{const L=new Set(N);return L.has(T)?L.delete(T):L.add(T),L})},[]),z=y.useCallback(()=>{const T=f?uf:Array.from(_);if(T.length===0)return;const N={source:e,skill:t,scope:c,agents:T};c==="project"&&n&&(N.theaterId=n),S("/plugins/skills/install",N),r(c)},[f,_,e,t,c,n,S,r]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${c==="project"?" is-active":""}`,onClick:()=>d("project"),disabled:!n||w||x,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${c==="global"?" is-active":""}`,onClick:()=>d("global"),disabled:w||x,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:D,disabled:w||x,children:"All agents"}),uf.map(T=>u.jsx("button",{type:"button",className:`skills-agent-chip${!f&&_.has(T)?" is-active":""}`,onClick:()=>j(T),disabled:w||x,children:nK[T]},T))]}),u.jsx("p",{className:"skills-permission-warning",children:iK}),!w&&!x&&!E&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:"Cancel"}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:z,disabled:!f&&_.size===0,children:"Install now"})]})]})}const rK=4e3;function EN({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:c}){const[d,f]=y.useState(!1),p=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{e==="running"&&f(!1)},[e]),y.useEffect(()=>{const E=p.current;E&&(E.scrollTop=E.scrollHeight)},[t]),y.useEffect(()=>{if(e==="done")return _.current=setTimeout(()=>{f(!1),o()},rK),()=>{_.current&&(clearTimeout(_.current),_.current=null)}},[e,o]);const g=y.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),f(!1),o()},[o]),b=y.useCallback(()=>f(E=>!E),[]);if(e==="idle")return null;const S=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",w=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",x=e==="running"?n:e==="done"?i:r;return u.jsxs("div",{className:"skills-dock",children:[d&&u.jsxs("div",{ref:p,className:"skills-dock-log",children:[t.map((E,D)=>u.jsx("div",{className:"skills-dock-log-line",children:E},D)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",r]})]}),u.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${d?" is-open":""}`,"aria-expanded":d,onClick:b,onKeyDown:E=>{E.target===E.currentTarget&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),b())},children:[u.jsx("span",{className:S,"aria-hidden":"true"}),u.jsx("span",{className:w,"aria-live":"polite",children:x}),e==="running"&&t.length>0&&u.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:E=>{E.stopPropagation(),g()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[c!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:E=>{E.stopPropagation(),c()},children:"Retry"}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:E=>{E.stopPropagation(),g()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${d?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const aK={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},cb=new Set;let hi=aK;function Ya(){for(const e of cb)e()}function oK(e){return cb.add(e),()=>{cb.delete(e)}}function Q2(){return hi}function V0(){return y.useSyncExternalStore(oK,Q2,Q2)}function hf(e){hi={...hi,activeTab:e},Ya()}function eE(e){hi={...hi,scope:e},Ya()}function lK(e){hi={...hi,filterText:e},Ya()}function cK(e){hi={...hi,searchQuery:e},Ya()}function Il(e,t){hi={...hi,searchResults:e,searchLoading:t},Ya()}function _p(e){return e??""}function ub(e,t){return e.installedContextKey===t}function lv(e,t,n){hi.installedContextKey===e&&(hi={...hi,installedList:t,installedLoading:n},Ya())}function hb(e){hi={...hi,installFormOpenId:e},Ya()}function uK(e){hi={...hi,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Ya()}const tE=750;function TN(){const[e,t]=y.useState({status:"idle",lines:[]}),n=y.useRef(null),i=y.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);y.useEffect(()=>()=>i(),[i]);const r=y.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=y.useCallback((c,d)=>{i(),t({status:"running",lines:[]}),(async()=>{const f=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)}).catch(()=>null);if(!f?.ok){t({status:"error",lines:[]});return}const{jobId:p}=await f.json();let _=0;const g=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(p)}&cursor=${_}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();_=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{g()},tE):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{g()},tE)})()},[i]);return{...e,start:o,reset:r}}const hK=300,Of=2;function dK(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function fK(e){if(e.length<Of){Il([],!1);return}Il([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Il([],!1);return}const n=await t.json();Il(n.skills??[],!1)}catch{Il([],!1)}}function pK({result:e,theaterId:t,isFormOpen:n,onInstallClick:i,onReadMore:r,onInstallStarted:o,jobLog:c}){const d={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>r(d,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:dK(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:i,children:n?"Cancel":"Install"})}),n&&u.jsx(sK,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:f=>o(e.name,f),jobLog:c})]})}function mK({theaterId:e,onReadMore:t,onInstallSuccess:n}){const{searchQuery:i,searchResults:r,searchLoading:o,installFormOpenId:c}=V0(),d=y.useRef(null),f=TN(),[p,_]=y.useState(null),g=y.useCallback(S=>{if(cK(S),d.current&&clearTimeout(d.current),S.length<Of){Il([],!1);return}d.current=setTimeout(()=>{fK(S)},hK)},[]);y.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),y.useEffect(()=>{f.status!=="done"||!p||(n(p.name,p.scope),hb(null),_(null))},[f.status,p,n]);const b=p?`Installing ${p.name}…`:"Installing…";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:i,onChange:S=>g(S.target.value),"aria-label":"Search skills registry"}),o&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!o&&i.length>=Of&&r.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',i,'".']}),!o&&i.length>0&&i.length<Of&&u.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),u.jsx("div",{className:"skills-card-list",children:r.map(S=>u.jsx(pK,{result:S,theaterId:e,isFormOpen:c===S.id,onInstallClick:()=>hb(c===S.id?null:S.id),onReadMore:t,onInstallStarted:(w,x)=>_({name:w,scope:x}),jobLog:f},S.id))})]}),u.jsx(EN,{status:f.status,lines:f.lines,runningLabel:b,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const gK=2600;function _K({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:r}){const[o,c]=y.useState(!1),d=y.useRef(null),f=y.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),p=y.useCallback(()=>{o?(f(),c(!1),i?.(e.name,e.scope)):(c(!0),d.current=setTimeout(()=>c(!1),gK))},[o,f,i,e.name,e.scope]);return y.useEffect(()=>()=>f(),[f]),u.jsxs("div",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),u.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),u.jsxs("div",{className:"skills-card-actions",children:[n&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>n(e.scope),disabled:r,children:r?"Updating…":"Update all"}),i&&u.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${o?" is-armed":""}`,onClick:p,"aria-label":o?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:o?"Remove?":"✕"})]})]})}async function vK(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function yK({theaterId:e,onReadMore:t,refreshKey:n}){const i=V0(),{scope:r,filterText:o}=i,c=_p(e),d=ub(i,c)?i.installedList:[],f=ub(i,c)&&i.installedLoading,p=TN(),_=y.useRef(null),g=y.useCallback(j=>{const z=_p(j);lv(z,[],!0),vK(j).then(T=>lv(z,T,!1)).catch(()=>lv(z,[],!1))},[]);y.useEffect(()=>{g(e)},[e,g,n]),y.useEffect(()=>{(p.status==="done"||p.status==="error")&&g(e)},[p.status,e,g]);const b=y.useCallback(j=>{const z=j;_.current=z;const T={scope:z};z==="project"&&e&&(T.theaterId=e),p.start("/plugins/skills/update",T)},[e,p]),S=y.useCallback((j,z)=>{const T={scope:z,skill:j};z==="project"&&e&&(T.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}).then(()=>g(e)).catch(()=>null)},[e,g]),w=y.useCallback(()=>{_.current&&b(_.current)},[b]),x=r==="project"&&!e?"global":r,E=d.filter(j=>j.scope!==x?!1:o?j.name.toLowerCase().includes(o.toLowerCase()):!0),D=p.status==="running"&&_.current===x;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${x==="project"?" is-active":""}`,onClick:()=>eE("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${x==="global"?" is-active":""}`,onClick:()=>eE("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:j=>lK(j.target.value),"aria-label":"Filter installed skills"}),f&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&E.length===0&&u.jsx("div",{className:"skills-empty-state",children:o?"No skills match the filter.":`No ${x} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:E.map(j=>u.jsx(_K,{skill:j,onReadMore:t,onUpdate:b,onRemove:S,isUpdating:D},`${j.scope}:${j.name}`))})]}),u.jsx(EN,{status:p.status,lines:p.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:p.reset,onRetry:w})]})}function cv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";n&&!/^(https?:|mailto:|#)/i.test(n)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function bK({content:e}){const t=y.useMemo(()=>{const r=$s(e).html,o=new DOMParser().parseFromString(r,"text/html");return cv(o.body),o.body.innerHTML},[e]),n=y.useRef(null);y.useEffect(()=>{const r=n.current;if(!r)return;cv(r);const o=new MutationObserver(()=>cv(r));return o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>o.disconnect()},[t]);const i=y.useCallback(r=>{const o=r.target.closest('[data-action="copy-code"]');if(!o)return;const c=o.closest("pre")?.getAttribute("data-code");if(!c)return;navigator.clipboard?.writeText(c);const d=o.textContent;o.textContent="Copied",window.setTimeout(()=>{o.textContent=d},1200)},[]);return u.jsx("div",{ref:n,className:"markdown-body",onClick:i,dangerouslySetInnerHTML:{__html:t}})}const SK=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),wK="Skills run with full agent permissions. Review before use.";function xK(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(SK)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function CK({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:r}){const[o,c]=y.useState(null),[d,f]=y.useState(!1),p=y.useRef(null),_=y.useRef(null),g=y.useRef(null);if(y.useEffect(()=>{e&&p.current===null&&(p.current=document.activeElement)},[e]),y.useEffect(()=>{if(!e){c(null);return}f(!0),c(null);let S=!1;return(async()=>{try{let x;if(t){const D={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(D.theaterId=n),x=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)})}else x=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n})});if(S)return;if(!x.ok){f(!1);return}const E=await x.json();S||(c(E.markdown??""),f(!1))}catch{S||f(!1)}})(),()=>{S=!0}},[e,t,n]),y.useEffect(()=>{if(!e)return;const S=w=>{w.key==="Escape"?(w.preventDefault(),i()):w.key==="Tab"&&xK(w,g.current),w.stopImmediatePropagation()};return _.current?.focus(),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0);const w=p.current;p.current=null,w?.focus?.()}},[e,i]),y.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const b=e.displayPath||e.source||null;return Va.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:u.jsxs("div",{ref:g,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),b&&u.jsx("span",{className:"skills-overlay-meta",children:b}),u.jsx("button",{ref:_,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[d&&u.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!d&&o===null&&u.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),o!==null&&u.jsx(bK,{content:o})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:wK}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),r()},children:"Install"})]})]})}),document.body)}const kK=3200;function EK({message:e,onDismiss:t}){return y.useEffect(()=>{if(!e)return;const n=setTimeout(t,kK);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function TK({ctx:e}){const t=_p(e.theaterId);return u.jsx(AK,{ctx:e},t)}function AK({ctx:e}){const{theaterId:t}=e,n=V0(),{activeTab:i}=n,r=_p(e.theaterId),[o,c]=y.useState(null),[d,f]=y.useState(null),[p,_]=y.useState(0),g=ub(n,r)?n.installedList.length:0;y.useLayoutEffect(()=>{uK(r)},[r]);const b=y.useCallback(E=>{c({skill:E,isInstalled:!0})},[]),S=y.useCallback((E,D)=>{c({skill:E,isInstalled:!1,registryId:D})},[]),w=y.useCallback((E,D)=>{f(`Installed ${E} to ${D}`),_(j=>j+1),hf("installed")},[]),x=y.useCallback(()=>{o?.registryId&&(hb(o.registryId),hf("find")),c(null)},[o]);return u.jsxs("div",{className:"skills-root",children:[u.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>hf("installed"),children:["Installed",g>0?` ${g}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>hf("find"),children:"Find"})]}),i==="installed"?u.jsx(yK,{theaterId:t,onReadMore:b,refreshKey:p}):u.jsx(mK,{theaterId:t,onReadMore:S,onInstallSuccess:w}),u.jsx(EK,{message:d,onDismiss:()=>f(null)}),u.jsx(CK,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>c(null),onInstall:x})]})}function RK(){return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M9 2L10.854 6.764L16 7.236L12.25 10.764L13.416 16L9 13.25L4.584 16L5.75 10.764L2 7.236L7.146 6.764Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}const NK={id:"skills",title:"Skills",icon:RK,render:e=>u.jsx(TK,{ctx:e})},LK={id:"skills",railPanels:[NK]},MK=[LK],AN=[...qW,...qq,...tK,...MK],OK=NN(AN),RN=y.createContext(OK),DK=RN.Provider;async function jK(){const e=[...AN],t=new Set(e.map(i=>i.id)),n=await IK();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await BK(i);if(r){if(t.has(r.id)){console.warn(`Skipping external plugin with duplicate id: ${r.id}`);continue}t.add(r.id),e.push(r)}}return NN(e)}function pc(){return y.useContext(RN)}async function IK(){try{const e=await fetch("/plugin-runtime/manifest");if(!e.ok)return console.warn(`Plugin runtime manifest unavailable: ${e.status}`),[];const t=await e.json();return Array.isArray(t.plugins)?t.plugins.filter(PK):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function BK(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return $K(n)?n:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function NN(e){const t=new Set,n=[];for(const i of e)for(const r of i.railPanels??[]){if(t.has(r.id)){console.warn(`Skipping rail panel with duplicate id: ${r.id}`);continue}t.add(r.id),n.push(r)}return{plugins:e,operationKinds:e.flatMap(i=>i.operationKinds??[]),settingsSections:e.flatMap(i=>i.settingsSections??[]),notificationKinds:e.flatMap(i=>i.notificationKinds??[]),railPanels:n}}function $K(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function PK(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.clientUrl=="string"&&Number.isInteger(t.apiVersion)}const zK=288,HK=520,Nu=12;function LN({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:r,renderKindIcon:o,onLaunchKind:c,onClose:d}){const f=y.useRef(null),p=y.useRef(null);return y.useEffect(()=>{const _=b=>{f.current?.contains(b.target)||d()},g=b=>{b.key==="Escape"&&d()};return document.addEventListener("mousedown",_),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("keydown",g)}},[d]),y.useEffect(()=>{p.current?.focus()},[]),u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:f,style:UK(e,t,n),"data-canvas-blocker":!0,children:u.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:p,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(FK,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:"Canvas controls"})})]}),u.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),i.length>0?i.map((_,g)=>u.jsxs("div",{children:[g>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:_.title}),_.kinds.map(b=>{const S=b.disabled===!0||!r;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:S,title:b.disabledReason,onClick:()=>c(_.id,b),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(_.id,b)??u.jsx(WK,{})}),u.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${_.id}:${b.id}`)})]},_.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function FK(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("path",{d:"M12 2.4v3.4M12 18.2v3.4M2.4 12h3.4M18.2 12h3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function UK(e,t,n){const i=t?Math.max(Nu,Math.min(e.x,t.width-zK-Nu)):e.x;if(n==="above")return{left:i,bottom:Math.max(Nu,e.y)};const r=t?Math.max(Nu,Math.min(e.y,t.height-HK-Nu)):e.y;return{left:i,top:r}}function WK(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function MN(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const df="directory-browser-sectors";function ON({open:e,onCancel:t,onConfirm:n}){const[i,r]=y.useState(null),[o,c]=y.useState(null),[d,f]=y.useState(null),[p,_]=y.useState(""),[g,b]=y.useState(""),[S,w]=y.useState(0),x=y.useRef(null),E=y.useRef(null),D=async(M,k)=>{c(M),f(null),_(""),w(0);try{const B=await EO(M,k);r(B)}catch(B){if(B instanceof DOMException&&B.name==="AbortError")return;f(B instanceof an?B.message:String(B))}finally{c(null)}};y.useEffect(()=>{if(!e)return;const M=new AbortController;return D(null,M.signal),()=>M.abort()},[e]),y.useEffect(()=>{e&&x.current?.focus()},[e,i?.path]);const j=i?.entries??[],z=y.useMemo(()=>{const M=p.trim().toLowerCase();return M===""?j:j.filter(k=>k.name.toLowerCase().includes(M))},[j,p]),T=y.useMemo(()=>i?qK(i):[],[i]),N=i?nE(i.path):null,L=i?.roots??[],H=L.length>1,F=z.length===0?-1:Math.min(S,z.length-1);if(y.useEffect(()=>{if(F<0)return;E.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"nearest"})},[F,i?.path]),!e)return null;const J=M=>{M.accessible&&o===null&&D(M.path)},pe=()=>{i?.parentPath!=null&&o===null&&D(i.parentPath)},G=()=>{const M=g.trim();M!==""&&o===null&&D(M)},P=i?.path??null,A=F>=0?`${df}-${F}`:void 0,$=M=>{switch(M.key){case"Escape":p!==""?_(""):t();return;case"ArrowDown":M.preventDefault(),w(k=>Math.min(k+1,Math.max(z.length-1,0)));return;case"ArrowUp":M.preventDefault(),w(k=>Math.max(k-1,0));return;case"Enter":{M.preventDefault();const k=z[F];k&&J(k);return}case"Backspace":p===""&&(M.preventDefault(),pe());return;default:return}};return Va.createPortal(u.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[u.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),u.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:$,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(VK,{})}),u.jsxs("div",{className:"directory-browser-heading",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),u.jsx("h2",{children:"Add Theater"})]}),u.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),H?u.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),u.jsx("div",{className:"directory-browser-root-chips",children:L.map(M=>{const k=N!=null&&nE(M)===N;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${k?"is-active":""}`,"aria-current":k?"location":void 0,disabled:o!==null,title:M,onClick:()=>{o===null&&D(M)},onKeyDown:B=>B.stopPropagation(),children:KK(M)},M)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:T.map((M,k)=>{const B=k===T.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[k>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${B?"is-current":""}`,"aria-current":B?"location":void 0,disabled:B||o!==null,title:M.path,onClick:()=>{D(M.path)},children:M.label})]},M.path)})}),u.jsxs("div",{className:"directory-browser-toolbar",children:[u.jsxs("div",{className:"directory-browser-filter",children:[u.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:u.jsx(XK,{})}),u.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":df,value:p,spellCheck:!1,autoComplete:"off",onChange:M=>{_(M.target.value),w(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:i?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:pe,children:[u.jsx(ZK,{}),u.jsx("span",{children:"Up"})]})]}),u.jsxs("div",{className:"directory-browser-jump",children:[u.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:"Or jump to a path — e.g. D:\\\\projects","aria-label":"Jump to absolute path",value:g,spellCheck:!1,autoComplete:"off",onChange:M=>b(M.target.value),onKeyDown:M=>{M.stopPropagation(),M.key==="Enter"&&(M.preventDefault(),G())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:g.trim()===""||o!==null,onClick:G,onKeyDown:M=>M.stopPropagation(),children:"Go"})]}),d?u.jsx("p",{className:"directory-browser-error",role:"alert",children:d}):null,u.jsx("div",{className:"directory-browser-list",id:df,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":A,ref:E,children:o!==null?u.jsxs("p",{className:"directory-browser-state is-live",children:[u.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):z.length===0?u.jsx("p",{className:"directory-browser-state",children:p!==""?"No folders match the filter.":"No folders available."}):z.map((M,k)=>u.jsxs("div",{id:`${df}-${k}`,"data-index":k,role:"option","aria-selected":k===F,"aria-disabled":!M.accessible,className:`directory-browser-sector ${k===F?"is-active":""} ${M.accessible?"":"is-locked"}`,title:M.path,onClick:()=>{w(k),J(M)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(YK,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:M.name}),M.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(JK,{})," Locked"]})]},M.path))}),i?.truncated?u.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,u.jsxs("footer",{className:"directory-browser-actions",children:[u.jsxs("div",{className:"directory-browser-target",children:[u.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),u.jsx("span",{className:"directory-browser-target-path",title:P??"",children:P??"Loading…"})]}),u.jsxs("div",{className:"directory-browser-buttons",children:[u.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),u.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:P===null||o!==null,onClick:()=>P&&n(P),children:"Add Theater"})]})]})]})]}),document.body)}function qK(e){if(GK(e)==="/"){const c=[{label:"/",path:"/"}];let d="";for(const f of e.path.split("/").filter(Boolean))d+=`/${f}`,c.push({label:f,path:d});return c}const n=/^([A-Za-z]:)\\?/.exec(e.path),i=n?`${n[1]}\\`:e.roots[0]??"C:\\",r=[{label:i,path:i}];let o=i.replace(/\\$/,"");for(const c of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${c}`,r.push({label:c,path:o});return r}function GK(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function nE(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function KK(e){return e.replace(/[\\/]+$/,"")||e}function VK(){return u.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[u.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),u.jsx("path",{d:"M10 1.6v3.2M10 15.2v3.2M1.6 10h3.2M15.2 10h3.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function YK(){return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:"M2.4 5.2c0-.7.6-1.3 1.3-1.3h2.7l1.4 1.5h6.5c.7 0 1.3.6 1.3 1.3v6.4c0 .7-.6 1.3-1.3 1.3H3.7c-.7 0-1.3-.6-1.3-1.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}function XK(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function ZK(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 12.5V4M4.5 7.5 8 4l3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function JK(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.6 7V5.4a2.4 2.4 0 0 1 4.8 0V7",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}const Y0=[{key:"crimson",label:"Crimson",color:"var(--id-crimson)"},{key:"amber",label:"Amber",color:"var(--id-amber)"},{key:"moss",label:"Moss",color:"var(--id-moss)"},{key:"teal",label:"Teal",color:"var(--id-teal)"},{key:"cerulean",label:"Cerulean",color:"var(--id-cerulean)"},{key:"indigo",label:"Indigo",color:"var(--id-indigo)"},{key:"plum",label:"Plum",color:"var(--id-plum)"},{key:"rose",label:"Rose",color:"var(--id-rose)"}],QK={red:"crimson",orange:"amber",yellow:"amber",lime:"moss",green:"moss",emerald:"teal",cyan:"teal",sky:"cerulean",blue:"cerulean",violet:"plum",purple:"plum",magenta:"rose"};function DN(e){return typeof e!="string"||e.length===0?null:Y0.some(t=>t.key===e)?e:QK[e]??null}function qa(e){const t=DN(e);return t?Y0.find(n=>n.key===t)?.color??null:null}function db(e){return typeof e.accent=="string"?e.accent:null}const iE=8,eV=268;function X0({accentKey:e,includeNone:t,onSelect:n}){const i=DN(e);return u.jsxs(u.Fragment,{children:[t?u.jsxs("button",{type:"button",className:"accent-tone-row accent-tone-row--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>n(null),children:[u.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),u.jsx("span",{className:"accent-tone-name",children:"None"})]}):null,Y0.map(r=>u.jsxs("button",{type:"button",className:"accent-tone-row",role:"menuitem","aria-label":r.label,"aria-pressed":i===r.key,onClick:()=>n(r.key),children:[u.jsx("span",{className:"accent-tone-flag",style:{background:r.color},"aria-hidden":"true"}),u.jsx("span",{className:"accent-tone-name",children:r.label})]},r.key))]})}function tV({anchor:e,accentKey:t,onSelect:n,onClose:i}){const[r,o]=y.useState(void 0);y.useLayoutEffect(()=>{const d=Math.max(8,Math.min(e.left,window.innerWidth-8)),f=e.bottom+iE,p=f+eV>window.innerHeight;o(p?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-e.top+iE)}:{position:"fixed",left:d,top:Math.round(f)})},[e]),y.useEffect(()=>{const d=f=>{f.key==="Escape"&&(f.preventDefault(),i())};return window.addEventListener("keydown",d),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",d),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const c=d=>{n(d),i()};return Va.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:r?u.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:r,onPointerDown:d=>d.stopPropagation(),children:u.jsx(X0,{accentKey:t,includeNone:!0,onSelect:c})}):null}),document.body)}const sE=8,nV=320;function rE(e){const{anchor:t,onClose:n}=e,[i,r]=y.useState(void 0);return y.useLayoutEffect(()=>{const o=Math.max(8,Math.min(t.left,window.innerWidth-208)),c=t.bottom+sE,d=c+nV>window.innerHeight;r(d?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+sE)}:{position:"fixed",left:o,top:Math.round(c)})},[t]),y.useEffect(()=>{const o=c=>{c.key==="Escape"&&(c.preventDefault(),n())};return window.addEventListener("keydown",o),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("keydown",o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[n]),Va.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:n,children:i?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:i,onPointerDown:o=>o.stopPropagation(),children:e.kind==="chip"?u.jsx(iV,{...e}):u.jsx(sV,{...e})}):null}),document.body)}function iV({operation:e,groups:t,accentKey:n,actions:i,onClose:r}){const[o,c]=y.useState(!1),[d,f]=y.useState(`Group ${t.length+1}`),p=y.useRef(!1),_=y.useRef(null);y.useEffect(()=>{o&&_.current?.select()},[o]);const g=()=>{const b=d.trim();b&&(i.onCreateGroup(b),r())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(b=>{const S=qa(b.color),w=e.groupId===b.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${w?" is-selected":""}`,role:"menuitemradio","aria-checked":w,onClick:()=>{i.onSetGroupId(w?null:b.id),r()},children:[u.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),u.jsx("span",{className:"group-context-menu-item__name",children:b.name}),w?u.jsx(rV,{}):null]},b.id)}),o?u.jsx("input",{ref:_,className:"group-context-menu-new-input",type:"text",value:d,onChange:b=>f(b.target.value),onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:b=>{b.key==="Enter"&&!p.current&&(b.preventDefault(),g()),b.key==="Escape"&&(b.preventDefault(),c(!1))},onBlur:()=>c(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>c(!0),children:u.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),u.jsx(X0,{accentKey:n,includeNone:!0,onSelect:b=>{i.onSetAccent(b),r()}})]})}function sV({group:e,actions:t,onClose:n}){const[i,r]=y.useState(e.name),[o,c]=y.useState(!1),d=y.useRef(!1),f=()=>{const p=i.trim();if(!p||p===e.name){n();return}t.onRename(p),n()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),u.jsx(X0,{accentKey:e.color,includeNone:!1,onSelect:p=>{p&&t.onSetColor(p),n()}}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),u.jsx("input",{className:"group-context-menu-new-input",type:"text",value:i,onChange:p=>r(p.target.value),onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onKeyDown:p=>{p.key==="Enter"&&!d.current&&(p.preventDefault(),f()),p.key==="Escape"&&(p.preventDefault(),n())},onBlur:f,"aria-label":"Group name"}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${o?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!o){c(!0);return}t.onUngroupAll(),n()},"aria-label":o?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:o?"Confirm ungroup all?":"Ungroup all"})]})}function rV(){return u.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:u.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const aV="fleet-console.canvas.",jN="fleet-console.formation-layout",oV=400,fb=640,pb=400,aE=40,lV=320,cV=200,uV=8,hV=0,oE=96,dV=.25,fV=1,uv=.2,lE=.5,pV=.001,Wl={x:0,y:0,zoom:1},Xl={viewport:Wl,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},mb=new Set,gb=new Set,_b=new Set,vb=new Set,yb=new Set,Js=new Map,nc=new Map;let Bt=null,Ua=null,tt=Xl,sn=null,IN=0,Oo={},es=!1,Z0=$V(),Pa=Wl,Do=null,vp=0;function J0(e){return mb.add(e),()=>{mb.delete(e)}}function Ga(){return tt}function mV(e){return Bt===e?tt:n1(e)}function Ys(){return sn?.mode==="maximized"?sn.operationId:null}function _s(){return sn?.mode==="companion"?sn.operationId:null}function cE(){return IN}function gV(e){const t=Bt===e?sn:Js.get(e)??null;return t?.mode==="companion"?t.operationId:null}function yp(){return es}function uE(){return Z0}function BN(){return Bt}function $N(){return y.useSyncExternalStore(J0,Ga,Ga)}function PN(){return y.useSyncExternalStore(YN,Ys,Ys)}function zN(){return y.useSyncExternalStore(YN,_s,_s)}function _V(e){const t=y.useSyncExternalStore(LV,dE,dE);return e===null?{}:t[e]??{}}function vV(e,t,n){const i=Oo[e]??{};i[t]!==n&&(Oo={...Oo,[e]:{...i,[t]:n}},XN())}function Gp(){return y.useSyncExternalStore(RV,yp,yp)}function HN(){return y.useSyncExternalStore(NV,uE,uE)}function FN(){return y.useSyncExternalStore(J0,fE,fE)}function ts(e){tt={viewport:e.viewport??tt.viewport,operations:e.operations??tt.operations,operationOrder:e.operationOrder??tt.operationOrder,operationAccent:e.operationAccent??tt.operationAccent,minimized:e.minimized??tt.minimized,collapsedGroups:e.collapsedGroups??tt.collapsedGroups},jV(),e1()}function UN(e){const t=tt.collapsedGroups.includes(e)?tt.collapsedGroups.filter(n=>n!==e):[...tt.collapsedGroups,e];ts({collapsedGroups:t})}function yV(e,t){if(Bt===e){UN(t);return}const n=n1(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];i1(e,{...n,collapsedGroups:i}),tt={...tt},e1()}function bV(){return y.useSyncExternalStore(J0,pE,pE)}function bb(e){t1();const t=s1(e);Pa=t,ts({viewport:t})}function WN(e){const t=s1(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||DV()){bb(t);return}Pa=t,Do===null&&(Do=window.requestAnimationFrame(QN))}function Sb(e,t){const n=Fo();ts({operations:{...tt.operations,[e]:{...r1(t,n),zIndex:n}}})}function SV(e,t,n=lV,i=cV,r=uV,o=hV,c="grid"){if(!Number.isFinite(t)||t<=0)return[];const d=Math.max(0,e.width-o*2),f=Math.max(0,e.height-o*2);if(c==="columns"){const x=Math.max(0,d-r*(t-1)),E=x/t,D=Math.min(n,E),j=Math.min(Math.max(D,E),x),z=f,T=Math.min(i,z),N=Math.min(Math.max(T,z),f);return Array.from({length:t},(L,H)=>({x:e.x+o+H*(j+r),y:e.y+o,width:j,height:N}))}if(c==="rows"){const x=d,E=Math.min(n,x),D=Math.min(Math.max(E,x),d),j=Math.max(0,f-r*(t-1)),z=j/t,T=Math.min(i,z),N=Math.min(Math.max(T,z),j);return Array.from({length:t},(L,H)=>({x:e.x+o,y:e.y+o+H*(N+r),width:D,height:N}))}const p=Math.ceil(Math.sqrt(t)),_=Math.ceil(t/p),g=Math.max(0,f-r*(_-1)),b=g/_,S=Math.min(i,b),w=Math.min(Math.max(S,b),g);return Array.from({length:t},(x,E)=>{const D=Math.floor(E/p),j=E%p,z=D===_-1?t-(_-1)*p:p,T=Math.max(0,d-r*(z-1)),N=T/z,L=Math.min(n,N),H=Math.min(Math.max(L,N),T);return{x:e.x+o+j*(H+r),y:e.y+o+D*(w+r),width:H,height:w}})}function qN(e){tt.minimized.includes(e)||(Ys()===e&&Ka(),_s()===e&&Qs(),ts({minimized:[...tt.minimized,e]}))}function wV(e){const t=new Set,i=[...tt.minimized.filter(c=>t.has(c)||!(c in tt.operations)?!1:(t.add(c),!0)),...e.filter(c=>t.has(c)||!(c in tt.operations)?!1:(t.add(c),!0))];if(JN(tt.minimized,i))return;const r=Ys(),o=_s();r&&i.includes(r)&&Ka(),o&&i.includes(o)&&Qs(),ts({minimized:i})}function bp(e){if(!tt.minimized.includes(e))return;Ys()===e&&Ka();const t=tt.minimized.filter(r=>r!==e),n=tt.operations[e];if(!n){ts({minimized:t});return}const i=Fo();ts({minimized:t,operations:{...tt.operations,[e]:{...n,zIndex:i}}})}function hv(e){ts({operationOrder:tL(e)})}function Fo(){return vp+=1,vp}function xV(e){const t=tt.operations[e];if(t)return t;const n=Object.keys(tt.operations).length,i={x:n*aE,y:n*aE,width:fb,height:pb,zIndex:Fo()};return ts({operations:{...tt.operations,[e]:i}}),i}function CV(e){const t=new Set(e),n={};let i=!1;for(const[b,S]of Object.entries(tt.operations))t.has(b)?n[b]=S:i=!0;const r=tt.minimized.filter(b=>t.has(b)),o=r.length!==tt.minimized.length,c=tt.operationOrder.filter(b=>t.has(b)),d=c.length!==tt.operationOrder.length,f=Object.fromEntries(Object.entries(tt.operationAccent).filter(([b])=>t.has(b))),p=Object.keys(f).length!==Object.keys(tt.operationAccent).length,_=Ys(),g=_s();_&&(!t.has(_)||r.includes(_))&&Ka(),g&&r.includes(g)&&Qs(),(i||o||d||p)&&ts({operations:n,minimized:r,operationOrder:c,operationAccent:f})}function kV(e){IV(),t1(),OV(),Bt=e,tt=e?n1(e):Xl;const t=e?Js.get(e)??null:null,n=!ZN(sn,t);sn=t;const i=e?nc.has(e):!1,r=es!==i;es=i,Pa=tt.viewport,vp=Math.max(vp,nL(tt.operations)),e1(),n&&Eh(),r&&ic()}function EV(e,t){const n=tt.operations[e];if(!n)return;const i=Math.max(dV,Math.min(fV,Math.min((t.width-oE)/n.width,(t.height-oE)/n.height))),r={x:t.width/2-(n.x+n.width/2)*i,y:t.height/2-(n.y+n.height/2)*i,zoom:i};t1(),Pa=r;const o=Fo(),c=tt.minimized.includes(e);ts({viewport:r,operations:{...tt.operations,[e]:{...r1(n,o),zIndex:o}},...c?{minimized:tt.minimized.filter(d=>d!==e)}:{}})}function Q0(e){const t={mode:"maximized",operationId:e};Bt&&Js.set(Bt,t),KN(t)}function Ka(){Bt&&Js.get(Bt)?.mode==="maximized"&&Js.delete(Bt),sn?.mode==="maximized"&&(sn=null,Eh())}function GN(e){Kp(e);const t=sn?.mode==="companion"?sn.returnTo:sn?.mode==="maximized"?"maximized":"underlay";KN({mode:"companion",operationId:e,returnTo:t})}function KN(e){sn?.mode==="companion"&&!(e.mode==="companion"&&e.operationId===sn.operationId)&&Kp(sn.operationId);const t=tt.minimized.filter(r=>r!==e.operationId),n=!JN(tt.minimized,t),i=!ZN(sn,e);i&&(sn=e),i&&Bt&&Js.set(Bt,e),n&&ts({minimized:t}),i&&Eh()}function TV(){if(sn?.mode!=="companion")return;const e=sn;sn=e.returnTo==="maximized"&&e.operationId in tt.operations&&!tt.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,Bt&&(sn?Js.set(Bt,sn):Js.delete(Bt)),Kp(e.operationId),Eh()}function Qs(){if(sn?.mode!=="companion")return;const e=sn.operationId;sn=null,Bt&&Js.delete(Bt),Kp(e),Eh()}function AV(){if(Bt){if(_s()!==null){Qs(),es||(nc.set(Bt,!0),es=!0,ic());return}if(es){VN();return}Ka(),Qs(),nc.set(Bt,!0),es=!0,ic()}}function dv(e){if(Bt){if(_s()!==null){hE(e),Qs(),es||(nc.set(Bt,!0),es=!0,ic());return}if(es&&Z0===e){VN();return}hE(e),es||(Ka(),Qs(),nc.set(Bt,!0),es=!0,ic())}}function VN(){Bt&&nc.delete(Bt),es&&(es=!1,ic())}function hE(e){Z0=e,PV(e),MV()}function RV(e){return vb.add(e),()=>{vb.delete(e)}}function NV(e){return yb.add(e),()=>{yb.delete(e)}}function e1(){for(const e of mb)e()}function YN(e){return gb.add(e),()=>{gb.delete(e)}}function LV(e){return _b.add(e),()=>{_b.delete(e)}}function dE(){return Oo}function XN(){for(const e of _b)e()}function Kp(e){if(!(e in Oo))return;const t={...Oo};delete t[e],Oo=t,XN()}function ic(){for(const e of vb)e()}function MV(){for(const e of yb)e()}function fE(){return tt.minimized}function pE(){return tt.collapsedGroups}function Eh(){IN+=1;for(const e of gb)e()}function OV(){Bt&&(sn?Js.set(Bt,sn):Js.delete(Bt))}function ZN(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function JN(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function QN(){const e=tt.viewport,t=Pa.x-e.x,n=Pa.y-e.y,i=Pa.zoom-e.zoom;if(Math.abs(t)<lE&&Math.abs(n)<lE&&Math.abs(i)<pV){Do=null,ts({viewport:Pa});return}ts({viewport:{x:e.x+t*uv,y:e.y+n*uv,zoom:e.zoom+i*uv}}),Do=typeof window<"u"?window.requestAnimationFrame(QN):null}function t1(){Do===null||typeof window>"u"||(window.cancelAnimationFrame(Do),Do=null)}function DV(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function jV(){!Bt||typeof window>"u"||(BV(),Ua=window.setTimeout(()=>{Ua=null,i1(Bt,tt)},oV))}function IV(){!Ua||!Bt||typeof window>"u"||(window.clearTimeout(Ua),Ua=null,i1(Bt,tt))}function BV(){!Ua||typeof window>"u"||(window.clearTimeout(Ua),Ua=null)}function n1(e){if(typeof window>"u")return Xl;try{const t=window.localStorage.getItem(eL(e));if(!t)return Xl;const n=JSON.parse(t);return zV(n)}catch{return Xl}}function i1(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(eL(e),JSON.stringify(t))}catch{}}function $V(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(jN);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function PV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jN,e)}catch{}}function eL(e){return`${aV}${e}`}function zV(e){if(!sc(e))return Xl;const t=UV(e.operations);return{viewport:s1(e.viewport),operations:t,operationOrder:tL(e.operationOrder),operationAccent:HV(e.operationAccent),minimized:FV(e.minimized,t),collapsedGroups:qV(e.collapsedGroups)}}function tL(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function HV(e){if(!sc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function FV(e,t){if(!Array.isArray(e))return[];const n=new Set,i=[];for(const r of e)typeof r!="string"||n.has(r)||!(r in t)||(n.add(r),i.push(r));return i}function s1(e){if(!sc(e))return Wl;const t=Qu(e.x,Wl.x),n=Qu(e.y,Wl.y),i=wb(e.zoom,Wl.zoom);return{x:t,y:n,zoom:i}}function UV(e){if(!sc(e))return{};const t={};for(const[n,i]of Object.entries(e))sc(i)&&(t[n]=r1(i,WV(t)));return t}function r1(e,t){return sc(e)?{x:Qu(e.x,0),y:Qu(e.y,0),width:wb(e.width,fb),height:wb(e.height,pb),zIndex:Qu(e.zIndex,t)}:{x:0,y:0,width:fb,height:pb,zIndex:t}}function WV(e){return nL(e)+1}function nL(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Qu(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function wb(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function sc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qV(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function GV(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const c=o.groupId??"__ungrouped__",d=n.querySelector(`[data-drop-zone-group-id="${c}"]`);if(!d)continue;const f=d.getBoundingClientRect();if(e<f.top||e>f.bottom)continue;const p=d.querySelector(`[data-group-section-id="${c}"]`);if(!p||e<p.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const _=Array.from(p.querySelectorAll("[data-side-bar-chip-id]"));for(const g of _){const b=g.dataset.sideBarChipId;if(!b||b===i)continue;const S=g.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const r=t[t.length-1];return{groupId:r?.groupId??null,index:r?.entryIds.length??0}}function KV(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-drop-zone-group-id]"));for(const o of r){const c=o.dataset.dropZoneGroupId;if(!c||c==="__ungrouped__"||c===i)continue;const d=t.indexOf(c);if(d===-1)continue;const f=o.getBoundingClientRect();if(e<=f.top+f.height/2)return d}return t.length}function VV(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-theater-id]"));for(const o of r){const c=o.dataset.theaterId;if(!c||c===i)continue;const d=t.indexOf(c);if(d===-1)continue;const f=o.getBoundingClientRect();if(e<=f.top+f.height/2)return d}return t.length}function YV(e,t,n,i){const r=e.filter(_=>_!==t),o=new Set(i),c=r.filter(_=>o.has(_)),d=Math.max(0,Math.min(n,c.length));if(c.length===0)return[...r,t];if(d<c.length){const _=r.indexOf(c[d]),g=[...r];return g.splice(_,0,t),g}const f=r.indexOf(c[c.length-1]),p=[...r];return p.splice(f+1,0,t),p}function XV(e,t,n,i){const r=new Set(i),o=e.filter(g=>r.has(g)),c=o.indexOf(t),d=o.filter(g=>g!==t),f=n>c?n-1:n,p=Math.max(0,Math.min(f,d.length));d.splice(p,0,t);let _=0;return e.map(g=>r.has(g)?d[_++]??g:g)}function ZV(e,t,n){if(n.length!==t.length)return[...e];const i=new Set(t);let r=0;return e.map(o=>i.has(o)?n[r++]??o:o)}function JV(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(d=>d!==t),o=n>i?n-1:n,c=Math.max(0,Math.min(o,r.length));return r.splice(c,0,t),r}function QV(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(d=>d!==t),o=n>i?n-1:n,c=Math.max(0,Math.min(o,r.length));return r.splice(c,0,t),r}function eY(e,t,n){if(e.indexOf(t)===-1)return[...e];const r=e.filter(c=>c!==t),o=Math.max(0,Math.min(n,r.length));return r.splice(o,0,t),r}function Vp(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function tY(e){const t=Vp(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function a1(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,r=y.useRef(null),o=y.useRef(!1),c=y.useRef(!1),[d,f]=y.useState(!1),[p,_]=y.useState("");y.useEffect(()=>{d&&(r.current?.focus(),r.current?.select())},[d]);const g=()=>{i?.(),c.current=!1,_(t),f(!0)},b=()=>{c.current=!0,f(!1),_("")},S=()=>{if(!o.current){o.current=!0;try{n(p)}finally{o.current=!1,c.current=!0,f(!1)}}};return{renaming:d,draftTitle:p,inputRef:r,begin:g,cancel:b,commit:S,setDraftTitle:_,handleKeyDown:E=>{if(E.key==="Enter"){E.preventDefault(),S();return}E.key==="Escape"&&(E.preventDefault(),b())},handleBlur:()=>{if(c.current){c.current=!1;return}S()}}}function iL({entry:e,index:t,isCloseArmed:n,accentValue:i,dragging:r,dragOffsetY:o,dropTarget:c,preview:d=!1,onArmClose:f,onDisarmClose:p,onClose:_,onMinimize:g,onFocus:b,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:x,onRename:E}){const D=y.useRef(!1),{operation:j,active:z,minimized:T,notificationCount:N,status:L}=e,H=nY(j),F=a1({currentTitle:H,onCommit:k=>E(j.id,k),onBegin:p}),J=["side-bar-chip",z?"side-bar-chip--active":"",T?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",c?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),pe=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),G={"--i":t,...i?{"--user-accent":i}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},P=()=>{if(p(),D.current){D.current=!1;return}b(j.id)},A=k=>{k.stopPropagation()},$=k=>{if(k.stopPropagation(),!n){f(j.id);return}p(),_(j.id)},M=k=>{k.preventDefault(),p(),x(j.id,k.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":j.id,className:J,role:"button",tabIndex:0,"aria-label":z?`${H} (focused)`:`Focus operation ${H}`,"aria-current":z?"true":void 0,title:d?"Click to open in its Theater":z?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:G,onClick:P,onContextMenu:d?void 0:M,onFocus:()=>{n||p()},onPointerDown:k=>w(k,j.id),onPointerUp:()=>{r&&(D.current=!0)},onKeyDown:k=>{if(k.target===k.currentTarget){if(!d&&k.altKey&&k.shiftKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){k.preventDefault(),S(j.id,k.key==="ArrowUp"?-1:1);return}(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),P())}},children:[u.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:u.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??u.jsx(aY,{})})}),F.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:F.inputRef,value:F.draftTitle,"aria-label":`Rename operation ${H}`,onChange:k=>F.setDraftTitle(k.target.value),onKeyDown:F.handleKeyDown,onBlur:F.handleBlur,onPointerDown:k=>k.stopPropagation(),onClick:k=>k.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:d?void 0:F.begin,children:H}),N>0?u.jsx("span",{className:"side-bar-chip-count",children:N}):null,u.jsx("span",{className:`side-bar-chip-status ${iY(L)}`,role:"img","aria-label":mE(L),title:mE(L)}),!d&&!T?u.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:A,onClick:k=>{k.stopPropagation(),p(),g(j.id)},"aria-label":`Minimize operation ${H}`,title:"Minimize operation",children:u.jsx(rY,{})}):null,d?null:u.jsx("button",{type:"button",className:pe,onPointerDown:A,onClick:$,"aria-label":n?`Confirm close operation ${H}`:`Close operation ${H}`,title:n?"Confirm close":"Close operation",children:n?"Close?":u.jsx(sY,{})})]})}function nY(e){return e.title}function iY(e){const t=Vp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function mE(e){return tY(e)}function sY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function rY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function aY(){return u.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function sL({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:c,onContextMenu:d,onPointerDragStart:f}){const p=y.useRef(!1),_=qa(e.color),g=["side-bar-group-header",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={..._?{"--grp-color":_}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=E=>{E.preventDefault(),d(e.id,E.currentTarget.getBoundingClientRect())},w=E=>{E.target instanceof Element&&E.target.closest("button")||f(E,e.id)},x=()=>{i&&(p.current=!0)};return u.jsxs("div",{className:g,style:b,onContextMenu:S,onPointerDown:w,onPointerUp:x,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>c(e.id),"aria-expanded":!n,"aria-label":n?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:n?"Expand":"Collapse",children:u.jsx(oY,{collapsed:n})}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function oY({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:u.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const rL="fleet-console.operations.side-width",aL="fleet-console.operations.side-collapsed",oL="fleet-console.operations.theater-collapsed",Yp=280,gE=Yp,xb=new Set,Cb=new Set;let jo={width:hY(),collapsed:dY()},Df=fY();function lL(){return y.useSyncExternalStore(pY,kb,kb)}function lY(){return y.useSyncExternalStore(gY,_E,_E)}function cY(e){const t=Math.max(Yp,Math.min(cL(),e));if(jo.width!==t){jo={...jo,width:t};try{typeof window<"u"&&localStorage.setItem(rL,String(t))}catch{}uL()}}function o1(e){if(jo.collapsed!==e){jo={...jo,collapsed:e};try{typeof window<"u"&&localStorage.setItem(aL,e?"1":"0")}catch{}uL()}}function uY(e,t){const n=new Set(Df);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==Df.join("\0")){Df=i;try{typeof window<"u"&&localStorage.setItem(oL,JSON.stringify(i))}catch{}mY()}}function cL(){return typeof window<"u"?Math.max(Yp,window.innerWidth-480):800}function hY(){try{if(typeof window>"u")return gE;const e=localStorage.getItem(rL);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Yp,Math.min(cL(),t))}}catch{}return gE}function dY(){try{return typeof window<"u"&&localStorage.getItem(aL)==="1"}catch{return!1}}function fY(){try{if(typeof window>"u")return[];const e=localStorage.getItem(oL),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function uL(){for(const e of xb)e()}function kb(){return jo}function pY(e){return xb.add(e),()=>xb.delete(e)}function mY(){for(const e of Cb)e()}function _E(){return Df}function gY(e){return Cb.add(e),()=>Cb.delete(e)}function hL(e,t){const n=e.find(r=>r.id===t.pluginId)?.kinds.filter(r=>r.type===t.type)??[],i=t.payload.launchKindId;if(typeof i=="string"){const r=n.find(o=>o.id===i);if(r)return r}return n.length===1?n[0]:null}const _Y=1500,vY=6,vE=34,yE=18;function yY({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:c,catalog:d,canLaunch:f,addingTheater:p,theaterError:_,renderKindIcon:g,onLaunchKind:b,onResetView:S,onClose:w,onMinimize:x,onFocus:E,onSetAccent:D,onRename:j,onSetGroupId:z,onCreateGroup:T,onSetGroupColor:N,onRenameGroup:L,onReorderGroups:H,onReorderTheaters:F,onUngroupAll:J,onSelectTheater:pe,onAddTheater:G,onCancelAddTheater:P,onForgetTheater:A}){const $=y.useRef(null),M=y.useRef(null),k=lL(),{width:B,collapsed:O}=k,W=y.useRef(O),U=$N(),R=HN(),Y=Gp(),Z=y.useRef(null),[me,ue]=y.useState(null),[oe,ke]=y.useState(null),Ne=y.useRef(null),Re=y.useRef([]),ot=y.useRef([]),Le=y.useRef([]),Se=y.useRef([]),xe=y.useRef([]),Me=y.useRef(z),Ke=y.useRef(H),it=y.useRef(F),[Ge,he]=y.useState(null),[Qe,Ye]=y.useState(null),[Ht,we]=y.useState(!1),[Je,st]=y.useState(!1),Vn=bV(),bt=lY(),{operationStatus:Ee}=er();y.useLayoutEffect(()=>{!W.current&&O&&MN($.current,".command-band-sidebar-toggle"),W.current=O},[O]);const ft=n.filter(re=>re.theaterId===t),pn=i.filter(re=>re.theaterId===t),Ci=new Set(r),In=new Set(Vn),Mn=Xb(ft,U.operationOrder).map(re=>{const ht=hL(d,re),Vt=ht?g(re.pluginId,ht):null;return{operation:re,active:o===re.id,minimized:Ci.has(re.id),notificationCount:c[re.id]?1:0,status:Ee[re.id],icon:Vt}}),mn=dL(Mn,pn,U.operationOrder),ie=mn.some(re=>re.group!==null),le=mn.flatMap(re=>re.groupId?[re.groupId]:[]),Pe=mn.flatMap(re=>In.has(re.groupId??"")?[]:re.entries),De=Mn.map(re=>re.operation.id),Ue=y.useCallback(()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},[]),Mt=y.useCallback(()=>{Ue(),ue(null)},[Ue]),Ni=y.useCallback(re=>{Ue(),ue(re),Z.current=window.setTimeout(()=>{Z.current=null,ue(null)},_Y)},[Ue]);y.useEffect(()=>Ue,[Ue]),y.useEffect(()=>{me!==null&&(Mn.some(re=>re.operation.id===me)||Mt())},[me,Mn,Mt]);const Ot=Ge?.kind==="chip"?Mn.find(re=>re.operation.id===Ge.operationId)?.operation??null:null,Bn=Ge?.kind==="group"?i.find(re=>re.id===Ge.groupId)??null:null,Gt=Ge?.kind==="theater"?e.find(re=>re.id===Ge.theaterId)??null:null,K=(re,ht)=>{const Vt=Pe.findIndex(gn=>gn.operation.id===re);if(Vt===-1)return;const xt=Math.max(0,Math.min(Pe.length-1,Vt+ht));if(xt===Vt)return;const rt=Pe.map(gn=>gn.operation.id),xn=eY(rt,re,xt);hv(ZV(De,rt,xn))},de=mn.map(re=>({groupId:re.groupId,entryIds:re.entries.map(ht=>ht.operation.id)}));y.useEffect(()=>{Re.current=Mn,ot.current=De,Le.current=de,Se.current=le,xe.current=e.map(re=>re.id),Me.current=z,Ke.current=H,it.current=F});const ye=re=>{Ne.current=re,ke(re)},He=oe?.pointerId??null;y.useEffect(()=>{if(He===null)return;const re=xt=>{if(xt.pointerId!==He)return;const rt=Ne.current;if(!rt)return;if(xt.buttons===0){ye(null);return}const xn=Math.hypot(xt.clientX-rt.startX,xt.clientY-rt.startY);if(!rt.dragging&&xn<vY)return;if(rt.dragging&&xt.preventDefault(),TY(xt.clientY,M.current),rt.kind==="chip"){const je=GV(xt.clientY,Le.current,M.current,rt.sourceId);ye({...rt,currentY:xt.clientY,dragging:!0,dropIndex:je.index,dropGroupId:je.groupId});return}if(rt.kind==="theater"){const je=VV(xt.clientY,xe.current,M.current,rt.sourceTheaterId);ye({...rt,currentY:xt.clientY,dragging:!0,dropIndex:je});return}const gn=KV(xt.clientY,Se.current,M.current,rt.sourceGroupId);ye({...rt,currentY:xt.clientY,dragging:!0,dropIndex:gn})},ht=xt=>{if(xt.pointerId!==He)return;const rt=Ne.current;if(ye(null),!rt?.dragging)return;if(rt.kind==="theater"){const Lt=QV(xe.current,rt.sourceTheaterId,rt.dropIndex);if(Lt.join("\0")===xe.current.join("\0"))return;it.current(Lt);return}if(rt.kind==="group"){const Lt=JV(Se.current,rt.sourceGroupId,rt.dropIndex);if(Lt.join("\0")===Se.current.join("\0"))return;Ke.current(Lt);return}const{sourceId:xn,sourceGroupId:gn,dropIndex:je,dropGroupId:q}=rt,se=Le.current,Ae=ot.current;if(q!==gn){const be=se.find(Fe=>Fe.groupId===q)?.entryIds??[];hv(YV(Ae,xn,je,be)),Me.current(xn,q);return}const ct=se.find(Lt=>Lt.groupId===gn)?.entryIds??[],Pt=ct.indexOf(xn);if(Pt===-1||je===Pt)return;const tn=XV(Ae,xn,je,ct);hv(tn)},Vt=xt=>{xt.pointerId===He&&ye(null)};return window.addEventListener("pointermove",re),window.addEventListener("pointerup",ht),window.addEventListener("pointercancel",Vt),()=>{window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",ht),window.removeEventListener("pointercancel",Vt)}},[He]);const Ft=(re,ht)=>{if(re.button!==0||re.target instanceof Element&&re.target.closest("button"))return;he(null),Mt();const xt=Mn.find(rt=>rt.operation.id===ht)?.operation.groupId??null;ye({kind:"chip",sourceId:ht,sourceGroupId:xt,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,currentY:re.clientY,dragging:!1,dropIndex:De.indexOf(ht),dropGroupId:xt})},Dt=(re,ht)=>{re.button===0&&(re.target instanceof Element&&re.target.closest("button")||le.includes(ht)&&(he(null),Mt(),ye({kind:"group",sourceGroupId:ht,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,currentY:re.clientY,dragging:!1,dropIndex:le.indexOf(ht)})))},$e=(re,ht)=>{if(re.button!==0||re.target instanceof Element&&re.target.closest("button"))return;const Vt=e.map(xt=>xt.id);Vt.includes(ht)&&(he(null),Mt(),ye({kind:"theater",sourceTheaterId:ht,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,currentY:re.clientY,dragging:!1,dropIndex:Vt.indexOf(ht)}))},Oe=y.useCallback(re=>{re.preventDefault();const ht=re.clientX,Vt=k.width;st(!0);const xt=xn=>{const gn=xn.clientX-ht;cY(Vt+gn)},rt=()=>{st(!1),document.removeEventListener("pointermove",xt),document.removeEventListener("pointerup",rt),document.removeEventListener("pointercancel",rt)};document.addEventListener("pointermove",xt),document.addEventListener("pointerup",rt),document.addEventListener("pointercancel",rt)},[k.width]),Xe=()=>{o1(!O)},on=()=>{Ye(null),he(null),we(!0)},St=()=>{we(!1),P()},Yn=re=>{we(!1),G(re)},Hs=re=>{re.defaultPrevented||(re.preventDefault(),he(null),Ye({anchor:{x:re.clientX,y:re.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},ns=y.useCallback(()=>{const re=Ge?.kind==="theater"?Ge.returnFocus:null;he(null),re?.focus()},[Ge]),pi=(re,ht)=>{re.stopPropagation(),ht!==t&&pe(ht),he(null);const Vt=re.currentTarget.getBoundingClientRect();Ye({anchor:{x:Vt.right+8,y:Vt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Kt=re=>{uY(re,!bt.includes(re))};return u.jsxs("aside",{className:`operations-side-bar ${O?"is-closed":"is-expanded"}`,ref:$,"data-sidebar-state":O?"closed":"expanded","data-resizing":Je?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${B}px`},inert:O,onContextMenu:Hs,children:[u.jsxs("div",{className:"side-bar-theater-add-row",children:[u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:on,disabled:p,"aria-label":"Add Theater",title:p?"Adding Theater":"Add Theater",children:[u.jsx(l1,{}),u.jsx("span",{children:"Add Theater"})]}),u.jsxs("div",{className:"side-bar-formation-group",role:"group","aria-label":"Formation view",children:[u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>S(),disabled:t===null,"aria-label":"Reset canvas view",title:"Reset canvas view",children:u.jsx(SY,{})}),u.jsx("span",{className:"side-bar-formation-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>dv("grid"),disabled:t===null,"aria-pressed":Y&&R==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:u.jsx(bY,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>dv("columns"),disabled:t===null,"aria-pressed":Y&&R==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:u.jsx(wY,{})}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>dv("rows"),disabled:t===null,"aria-pressed":Y&&R==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:u.jsx(xY,{})})]})]}),!O&&_?u.jsx("p",{className:"side-bar-theater-error",children:_}):null,u.jsx("ol",{className:"operations-side-bar-chips",ref:M,"aria-label":"Operations",children:e.map((re,ht)=>{const Vt=re.id===t,xt=n.filter(se=>se.theaterId===re.id).length,rt=bt.includes(re.id),xn=oe?.kind==="theater"&&oe.sourceTheaterId===re.id&&oe.dragging,gn=xn&&oe?.kind==="theater"?oe.currentY-oe.startY:0,je=oe?.kind==="theater"&&oe.dragging&&oe.sourceTheaterId!==re.id&&oe.dropIndex===ht,q=oe?.kind==="theater"&&oe.dragging&&oe.sourceTheaterId!==re.id&&ht===e.length-1&&oe.dropIndex===e.length;if(!Vt){const se=mV(re.id),Ae=CY({theaterId:re.id,operations:n,operationOrder:se.operationOrder,minimizedSet:new Set(se.minimized),activeOperationId:null,operationNotifications:c,operationStatus:Ee,catalog:d,renderKindIcon:g});return u.jsx(kY,{theater:re,entries:rt?[]:Ae,groups:i.filter(lt=>lt.theaterId===re.id),collapsedGroups:new Set(se.collapsedGroups),operationAccent:se.operationAccent,operationCount:xt,collapsed:rt,dragging:xn,dropBefore:je,dropAfter:q,dragOffsetY:gn,onSelectTheater:pe,onFocus:E,onToggleCollapsed:Kt,onOpenActions:(lt,ct)=>{Ye(null),he({kind:"theater",theaterId:re.id,anchor:lt,returnFocus:ct})},onOpenLaunch:pi,onContextMenu:lt=>{Ye(null),he({kind:"theater",theaterId:re.id,anchor:lt})},onPointerDragStart:$e},re.id)}return u.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",je?"side-bar-theater-section--drop-before":"",q?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":re.id,children:[u.jsx(fL,{theater:re,operationCount:xt,active:!0,collapsed:rt,dragging:xn,dropTarget:je,dragOffsetY:gn,onSelectTheater:pe,onToggleCollapsed:Kt,onOpenActions:(se,Ae)=>{Ye(null),he({kind:"theater",theaterId:re.id,anchor:se,returnFocus:Ae})},onOpenLaunch:pi,onContextMenu:se=>{Ye(null),he({kind:"theater",theaterId:re.id,anchor:se})},onPointerDragStart:$e}),rt?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${re.label} operations`,children:mn.map(se=>{const Ae=se.groupId!==null&&In.has(se.groupId),lt=se.group?qa(se.group.color):null,ct=lt?{"--grp-color":lt}:void 0,Pt=se.groupId?le.indexOf(se.groupId):-1,tn=oe?.kind==="group"&&oe.sourceGroupId===se.groupId&&oe.dragging,Lt=oe?.kind==="group"&&oe.dragging&&se.groupId!==null&&oe.sourceGroupId!==se.groupId&&oe.dropIndex===Pt,be=oe?.kind==="group"&&oe.dragging&&se.groupId!==null&&oe.sourceGroupId!==se.groupId&&Pt===le.length-1&&oe.dropIndex===le.length,Fe=[se.groupId?"side-bar-group-section":"side-bar-ungrouped-section",Lt?"side-bar-group-section--drop-before":"",be?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":se.groupId??"__ungrouped__",className:Fe,style:ct,children:[se.group?u.jsx(sL,{group:se.group,count:se.entries.length,collapsed:Ae,dragging:tn,dragOffsetY:tn?oe.currentY-oe.startY:0,dropTarget:Lt,onToggle:UN,onContextMenu:(Be,Et)=>he({kind:"group",groupId:Be,anchor:Et}),onPointerDragStart:Dt}):ie&&se.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,Ae?null:u.jsx("ol",{className:["side-bar-group-chips",oe?.kind==="chip"&&oe.dragging&&oe.dropGroupId===se.groupId&&oe.dropGroupId!==oe.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":se.groupId??"__ungrouped__","aria-label":se.group?se.group.name:"Ungrouped",children:se.entries.map(Be=>{const Et=Mn.indexOf(Be),rn=se.entries.indexOf(Be),Xn=U.operationAccent[Be.operation.id]??db(Be.operation),Li=Xn?qa(Xn):null;return u.jsx(iL,{entry:Be,index:Et,isCloseArmed:me===Be.operation.id,accentValue:Li,dragging:oe?.kind==="chip"&&oe.sourceId===Be.operation.id&&oe.dragging,dragOffsetY:oe?.kind==="chip"&&oe.sourceId===Be.operation.id&&oe.dragging?oe.currentY-oe.startY:0,dropTarget:oe?.kind==="chip"&&oe.dragging===!0&&oe.dropGroupId===se.groupId&&oe.dropGroupId===oe.sourceGroupId&&oe.dropIndex===rn&&oe.sourceId!==Be.operation.id,onArmClose:Ni,onDisarmClose:Mt,onClose:w,onMinimize:x,onFocus:E,onKeyboardMove:K,onPointerDragStart:Ft,onOpenAccent:(ki,Yt)=>he({kind:"chip",operationId:ki,anchor:Yt}),onRename:j},Be.operation.id)})})]},se.groupId??"__ungrouped__")})})]},re.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Oe,onDoubleClick:Xe,"aria-hidden":"true"}),Qe?Va.createPortal(u.jsx(LN,{anchor:Qe.anchor,viewportBounds:Qe.viewportBounds,placement:"cursor",catalog:d,canLaunch:f,renderKindIcon:g,onLaunchKind:(re,ht)=>{Ye(null),b(re,ht)},onClose:()=>Ye(null)},`${Qe.anchor.x}:${Qe.anchor.y}`),document.body):null,Ge?.kind==="chip"&&Ot?u.jsx(rE,{kind:"chip",operation:Ot,groups:i.filter(re=>re.theaterId===Ot.theaterId),accentKey:U.operationAccent[Ot.id]??db(Ot),anchor:Ge.anchor,actions:{onSetAccent:re=>D(Ot.id,re),onSetGroupId:re=>z(Ot.id,re),onCreateGroup:re=>T(Ot.theaterId,re,Ot.id)},onClose:()=>he(null)}):Ge?.kind==="group"&&Bn?u.jsx(rE,{kind:"group-header",group:Bn,anchor:Ge.anchor,actions:{onSetColor:re=>N(Bn.id,re),onRename:re=>L(Bn.id,re),onUngroupAll:()=>J(Bn.id)},onClose:()=>he(null)}):Ge?.kind==="theater"&&Gt?u.jsx(EY,{theater:Gt,groupCount:i.filter(re=>re.theaterId===Gt.id).length,anchor:Ge.anchor,onCreateGroup:re=>{T(Gt.id,re),ns()},onForgetTheater:()=>{A(Gt.id),ns()},onClose:ns}):null,u.jsx(ON,{open:Ht,onCancel:St,onConfirm:Yn}),O?null:u.jsx(YD,{})]})}function bY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function SY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M4.4 7.2A4 4 0 1 1 4 9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function xY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function dL(e,t,n){const i=[...t].sort((d,f)=>d.order-f.order||d.createdAt-f.createdAt),r=i.map(d=>({groupId:d.id,group:d,entries:[]})),o={groupId:null,group:null,entries:[]},c=new Map(i.map(d=>[d.id,d]));for(const d of e){const f=d.operation.groupId??null;f!==null&&c.has(f)?r.find(_=>_.groupId===f)?.entries.push(d):o.entries.push(d)}return[...r,o]}function CY({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:r,operationNotifications:o,operationStatus:c,catalog:d,renderKindIcon:f}){return Xb(t.filter(p=>p.theaterId===e),n).map(p=>{const _=hL(d,p),g=_?f(p.pluginId,_):null;return{operation:p,active:r===p.id,minimized:i.has(p.id),notificationCount:o[p.id]?1:0,status:c[p.id],icon:g}})}function fL({theater:e,operationCount:t,active:n,collapsed:i,dragging:r,dropTarget:o,dragOffsetY:c,onSelectTheater:d,onToggleCollapsed:f,onOpenActions:p,onOpenLaunch:_,onContextMenu:g,onPointerDragStart:b}){const S=y.useRef(!1),w=["side-bar-theater-header",n?"is-active":"",r?"side-bar-theater-header--dragging":"",o?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),x=r?{"--drag-dy":`${Math.round(c)}px`}:void 0,E=N=>{N.preventDefault(),g(N.currentTarget.getBoundingClientRect())},D=N=>{N.target===N.currentTarget&&(N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),d(e.id)))},j=N=>{N.target instanceof Element&&N.target.closest("button")||b(N,e.id)},z=()=>{r&&(S.current=!0)},T=()=>{if(S.current){S.current=!1;return}d(e.id)};return u.jsxs("div",{role:"button",tabIndex:0,className:w,style:x,onClick:T,onKeyDown:D,onContextMenu:E,onPointerDown:j,onPointerUp:z,"aria-current":n?"true":void 0,"aria-expanded":!i,title:e.label,children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:pL(e.label)}),u.jsx("span",{className:"side-bar-theater-name",children:e.label}),u.jsx("span",{className:"side-bar-theater-count",children:t}),u.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":i?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!i,title:i?"Expand":"Collapse",onClick:N=>{N.stopPropagation(),f(e.id)},children:u.jsx(AY,{collapsed:i})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:N=>{N.stopPropagation(),p(N.currentTarget.getBoundingClientRect(),N.currentTarget)},children:u.jsx(RY,{})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:N=>_(N,e.id),children:u.jsx(l1,{})})]})]})}function kY({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,operationCount:o,collapsed:c,dragging:d,dropBefore:f,dropAfter:p,dragOffsetY:_,onSelectTheater:g,onFocus:b,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:x,onContextMenu:E,onPointerDragStart:D}){const j=dL(t,n),z=j.some(T=>T.group!==null);return u.jsxs("li",{className:["side-bar-theater-section",f?"side-bar-theater-section--drop-before":"",p?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[u.jsx(fL,{theater:e,operationCount:o,active:!1,collapsed:c,dragging:d,dropTarget:f,dragOffsetY:_,onSelectTheater:g,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:x,onContextMenu:E,onPointerDragStart:D}),!c&&j.length>0?u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:j.map(T=>{const N=T.groupId!==null&&i.has(T.groupId),L=T.group?qa(T.group.color):null;return u.jsxs("li",{className:T.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:L?{"--grp-color":L}:void 0,children:[T.group?u.jsx(sL,{group:T.group,count:T.entries.length,collapsed:N,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:H=>yV(e.id,H),onContextMenu:()=>{},onPointerDragStart:()=>{}}):z&&T.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,N?null:u.jsx("ol",{className:"side-bar-group-chips","aria-label":T.group?T.group.name:"Ungrouped",children:T.entries.map((H,F)=>{const J=r[H.operation.id]??db(H.operation),pe=J?qa(J):null;return u.jsx(iL,{entry:H,index:F,isCloseArmed:!1,accentValue:pe,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:b,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},H.operation.id)})})]},T.groupId??"__ungrouped__")})}):null]})}function EY({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:r,onClose:o}){const[c,d]=y.useState(!1),[f,p]=y.useState(`Group ${t+1}`),_=y.useRef(!1),g=y.useRef(null),b=y.useRef(null),[S,w]=y.useState(n.bottom+6);y.useLayoutEffect(()=>{const E=b.current?.getBoundingClientRect().height??0,D=window.innerHeight-E-8;w(Math.max(8,Math.min(n.bottom+6,D)))},[n,c]),y.useEffect(()=>{c&&g.current?.select()},[c]),y.useEffect(()=>{const E=D=>{D.key==="Escape"&&(D.preventDefault(),o())};return window.addEventListener("keydown",E),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",E),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const x=()=>{const E=f.trim();E&&i(E)};return Va.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:u.jsxs("div",{ref:b,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:n.left,top:S},onPointerDown:E=>E.stopPropagation(),children:[c?u.jsx("input",{ref:g,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:f,onChange:E=>p(E.target.value),onCompositionStart:()=>{_.current=!0},onCompositionEnd:()=>{_.current=!1},onKeyDown:E=>{E.key==="Enter"&&!_.current&&(E.preventDefault(),x()),E.key==="Escape"&&(E.preventDefault(),d(!1))},onBlur:()=>d(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>d(!0),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(l1,{})}),u.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),u.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:r,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(LY,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function TY(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+vE?t.scrollTop-=yE:e>n.bottom-vE&&(t.scrollTop+=yE)}function AY({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?u.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):u.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function RY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function l1(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function pL(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>NY(i)):mL(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function NY(e){return mL(e).slice(0,1)}function mL(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function LY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}let gL=!1;const Eb=new Set;function MY(){return y.useSyncExternalStore(OY,bE,bE)}function bE(){return gL}function _L(e){gL=DY(e)?e.fullscreen:!1;for(const t of Eb)t()}function SE(){_L({fullscreen:!1})}function OY(e){return Eb.add(e),()=>Eb.delete(e)}function DY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Object.keys(t).length===1&&typeof t.fullscreen=="boolean"}const vL="(display-mode: fullscreen)",jY=480,IY=480,BY=()=>!0;function $Y(){return typeof window<"u"&&window.matchMedia(vL).matches}function PY(e=BY){const t=MY(),[n,i]=y.useState($Y),r=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||r&&t,c=y.useRef(o);c.current=o;const d=y.useRef(!1),f=y.useRef(null),[p,_]=y.useState(o),[g,b]=y.useState(!0),[S,w]=y.useState(!1),x=y.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null)},[]),E=y.useCallback(T=>{x(),!(!c.current||d.current)&&(f.current=setTimeout(()=>{f.current=null,c.current&&!d.current&&e()&&b(!1)},T))},[e,x]),D=y.useCallback(()=>{x(),c.current&&b(!0)},[x]),j=y.useCallback(()=>E(IY),[E]),z=y.useCallback(()=>{const T=!d.current;d.current=T,w(T),T&&(x(),b(!0))},[x]);return y.useEffect(()=>{const T=window.matchMedia(vL),N=()=>i(T.matches);return N(),T.addEventListener("change",N),()=>T.removeEventListener("change",N)},[]),y.useLayoutEffect(()=>(x(),_(o),b(!0),o&&!d.current&&E(jY),x),[x,o,E]),{isFullscreen:p,isVisible:g,isPinned:S,reveal:D,hideAfterLeave:j,togglePin:z}}function zY({operationsViewVisible:e}){const t=er(),n=pc(),i=lL(),r=J5(),o=FY(),c=`${o}${o==="⌘"?"":"+"}B`,d=`${o}${o==="⌘"?"⌥":"+Alt+"}B`,f=t.theaters.find(Se=>Se.id===t.activeTheaterId)??null,p=t.operations.find(Se=>Se.id===t.activeOperationId)??null,_=p?n.plugins.find(Se=>Se.id===p.pluginId):null,g=typeof p?.payload.cliId=="string"?p.payload.cliId:null,b=typeof p?.payload.cliLabel=="string"?p.payload.cliLabel:g,S=p?_?.operationKinds?.find(Se=>Se.type===p.type)??null:null,w=p&&_?.renderLaunchIcon?_.renderLaunchIcon({id:g??p.type,type:p.type,title:S?.title??p.type}):null,x=y.useRef(null),E=y.useRef(null),D=y.useRef(null),j=y.useRef(null),z=y.useRef({edge:!1,band:!1}),T=y.useRef(null),[N,L]=y.useState(!1),[H,F]=y.useState(null),[J,pe]=y.useState(null),[G,P]=y.useState(!1),[A,$]=y.useState(null),[M,k]=y.useState(null),B=()=>{F(null),pe(null),P(!1),$(null),k(null)},O=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",W=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",U=y.useCallback(()=>{const Se=document.activeElement;return!(Se instanceof Node&&(D.current?.contains(Se)||j.current?.contains(Se)))&&!z.current.edge&&!z.current.band},[]),R=PY(U),Y=a1({currentTitle:p?.title??"",onCommit:Se=>{const xe=aC(T.current,t.activeOperationId);T.current=null,xe&&T5(xe,Se).then(()=>Qi(null)).then(ms).catch(()=>{})}});y.useEffect(()=>{!Y.renaming||aC(T.current,t.activeOperationId)||(T.current=null,Y.cancel())},[Y,t.activeOperationId]),y.useEffect(()=>{if(!N)return;const Se=new AbortController;return F(null),pe(null),P(!0),wO(Se.signal).then(F).catch(xe=>{Se.signal.aborted||pe(xe instanceof Error?xe.message:"Unable to load environment details.")}).finally(()=>{Se.signal.aborted||P(!1)}),()=>Se.abort()},[N]),y.useEffect(()=>{if(!N)return;const Se=Me=>{const Ke=Me.target;!(Ke instanceof Node)||x.current?.contains(Ke)||E.current?.contains(Ke)||(L(!1),B())},xe=Me=>{Me.key==="Escape"&&(L(!1),B(),x.current?.focus())};return document.addEventListener("pointerdown",Se),document.addEventListener("keydown",xe),()=>{document.removeEventListener("pointerdown",Se),document.removeEventListener("keydown",xe)}},[N]),y.useEffect(()=>{t.channel!=="local"&&(L(!1),F(null),pe(null),P(!1),$(null),k(null))},[t.channel]);const Z=Se=>{navigator.clipboard.writeText(Se).then(()=>{$(Se),k(null)}).catch(()=>{k(Se),$(null)})},me=()=>{p&&(T.current=p.id,Y.begin())},ue=()=>{U()&&R.hideAfterLeave()},oe=Se=>{const xe=Se.relatedTarget;(!(xe instanceof Node)||!D.current?.contains(xe)&&!j.current?.contains(xe))&&!z.current.edge&&!z.current.band&&R.hideAfterLeave()},ke=()=>{z.current.edge=!0,R.reveal()},Ne=()=>{z.current.edge=!1,ue()},Re=()=>{z.current.band=!0,R.reveal()},ot=()=>{z.current.band=!1,ue()},Le=R.isFullscreen&&!R.isVisible;return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:j,type:"button",className:`command-band-edge-reveal${R.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:ke,onPointerLeave:Ne,onFocus:R.reveal,onBlur:oe,onKeyDown:Se=>{Se.key==="Tab"&&R.reveal()}}),u.jsxs("header",{ref:D,className:`command-band${e?" is-operations":" is-utility"}${R.isFullscreen?" is-fullscreen":""}${R.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`},"aria-hidden":Le||void 0,inert:Le||void 0,onPointerEnter:Re,onPointerLeave:ot,onFocus:R.reveal,onBlur:oe,children:[u.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[u.jsx(XD,{className:"command-band-brand"}),t.channel==="local"?u.jsxs("div",{className:"command-band-environment",children:[u.jsxs("button",{ref:x,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":N,onClick:()=>{B(),L(Se=>!Se)},children:[u.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),u.jsx("span",{className:"command-band-local-chip-label",children:O?W:"Local"})]}),N?u.jsx("div",{ref:E,children:u.jsx(HY,{environment:H,error:J,loading:G,copiedValue:A,copyFailedValue:M,desktopShell:O,onCopy:Z})}):null]}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>o1(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,children:u.jsx(wE,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:H5,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:u.jsx(UY,{})})]}),u.jsx("div",{className:"command-band-center",children:e&&f?u.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${f.label}`,children:[u.jsxs("span",{className:"command-band-theater-segment",children:[u.jsx("span",{className:"command-band-theater-mark",children:pL(f.label)}),f.label]}),p?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),Y.renaming?u.jsx("input",{ref:Y.inputRef,className:"command-band-rename-input",value:Y.draftTitle,"aria-label":`${p.title} 이름 변경`,onChange:Se=>Y.setDraftTitle(Se.target.value),onKeyDown:Y.handleKeyDown,onBlur:Y.handleBlur}):u.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:me,title:"Double-click to rename",children:p.title}),b?u.jsxs("span",{className:"command-band-operation-attribute",title:S?.title??b,children:[w?u.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:w}):null,b]}):null]}):null]}):null}),u.jsxs("div",{className:"command-band-right",children:[R.isFullscreen?u.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:R.togglePin,"aria-label":"Pin command band","aria-pressed":R.isPinned,title:R.isPinned?"Unpin command band":"Pin command band",children:u.jsx(WY,{})}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:X5,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${d})`,children:u.jsx(wE,{side:"right"})}):null]})]})]})}function HY({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:r,desktopShell:o,onCopy:c}){if(n)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:"Loading environment details…"});if(t)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:t});if(!e)return null;const d=[["Channel",e.channel],["Version",e.version],["Reachable on",`127.0.0.1:${e.effectivePort}`],["Data root",e.dataDir],["Runtime lock",e.lockFile],...o?[["Desktop data",`${e.dataDir}/desktop`]]:[]];return u.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:[u.jsx("div",{className:"command-band-environment-title",children:"Environment"}),d.map(([f,p])=>u.jsxs("div",{className:"command-band-environment-row",children:[u.jsx("span",{children:f}),u.jsx("code",{children:p}),u.jsx("button",{type:"button",onClick:()=>c(p),children:i===p?"Copied":r===p?"Copy failed":"Copy"})]},f)),u.jsx("div",{className:"command-band-environment-footer",children:"Development and published channels keep separate data roots."})]})}function FY(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function UY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function wE({side:e}){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function WY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const qY=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function GY({state:e}){const[t,n]=y.useState(!1),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),c=e.theaters.length>0;if(y.useEffect(()=>{if(e.onboardingOpen)return i.current=document.activeElement,r.current?.focus(),()=>{const _=i.current;i.current=null,_?.focus?.()}},[e.onboardingOpen]),y.useEffect(()=>{if(!e.onboardingOpen)return;const _=g=>{t||(g.key==="Escape"?(g.preventDefault(),cu()):g.key==="Tab"&&KY(g,o.current),g.stopImmediatePropagation())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const d=()=>{n(!0)},f=()=>{n(!1)},p=async _=>{n(!1),$5();try{const g=await E5(_),b=await k5(g);P5(b)}catch(g){Fv(g instanceof Error?g.message:String(g))}};return u.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[u.jsx("button",{type:"button",className:"commissioning-scrim",onClick:cu,"aria-label":"Close setup guide"}),u.jsxs("section",{className:"commissioning-card",ref:o,children:[u.jsxs("header",{className:"commissioning-header",children:[u.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),u.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),u.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),u.jsxs("ol",{className:"commissioning-steps",children:[u.jsxs("li",{className:`commissioning-step commissioning-step--primary ${c?"is-complete":"is-current"}`,children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:c?"✓":"01"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Register a Theater"}),u.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),c?u.jsx(th,{ref:_=>{r.current=_},className:"commissioning-primary-action",to:"/operations",onClick:cu,children:"Go to Operations →"}):u.jsx("button",{ref:_=>{r.current=_},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:d,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?u.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Open an Operation"}),u.jsx("p",{children:"An Operation is a live terminal session running an Agent CLI. Start one from the Operations tab to begin a working session."}),u.jsx(th,{className:"commissioning-secondary-link",to:"/operations",onClick:cu,children:"Go to Operations"})]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Monitor Carriers"}),u.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),u.jsxs("footer",{className:"commissioning-footer",children:[u.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),u.jsx("button",{type:"button",className:"commissioning-skip",onClick:cu,children:"Skip for now"})]})]}),u.jsx(ON,{open:t,onCancel:f,onConfirm:p})]})}function KY(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(qY)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}const VY="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",xE="operation-search-listbox",yL="__unassigned__";function YY({state:e}){const t=cc(),[n,i]=y.useState(""),[r,o]=y.useState(0),c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),p=y.useRef(new Map),_=y.useMemo(()=>RD(e),[e]),g=y.useMemo(()=>WO(_,n),[_,n]),b=y.useMemo(()=>qO(g),[g]),S=y.useMemo(()=>R5(n),[n]),w=CE(r,g.length),x=g[w]?kE(g[w].operationId):void 0;if(y.useEffect(()=>{if(!e.operationSearchOpen)return;f.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const j=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>c.current?.focus(),0),()=>{document.body.style.overflow=j,f.current?.focus()}},[e.operationSearchOpen]),y.useEffect(()=>{if(!e.operationSearchOpen){i(""),o(0);return}o(0)},[e.operationSearchOpen,n]),y.useEffect(()=>{if(!e.operationSearchOpen)return;const j=g[w];j&&p.current.get(j.operationId)?.scrollIntoView({block:"nearest"})},[w,g,e.operationSearchOpen]),!e.operationSearchOpen)return null;const E=j=>{f.current=null,ih(j),t("/operations"),u_()},D=j=>{if(j.key==="Escape"){j.preventDefault(),u_();return}if(j.key==="ArrowDown"||j.key==="ArrowUp"){j.preventDefault(),o(z=>CE(z+(j.key==="ArrowDown"?1:-1),g.length));return}if(j.key==="Enter"){const z=g[w];if(!z)return;j.preventDefault(),E(z.operationId);return}j.key==="Tab"&&QY(j,d.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:j=>{j.target===j.currentTarget&&u_()},children:u.jsxs("section",{ref:d,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:D,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(eX,{}),u.jsx("input",{ref:c,id:"operation-search-input",type:"search",value:n,onChange:j=>i(j.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":xE,"aria-activedescendant":x,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:xE,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:b.length>0?b.map(j=>{const z=ZY(j.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":z,children:[u.jsx("h2",{id:z,className:"operation-search-section-heading",children:fv(j.theaterLabel,S)}),j.entries.map(T=>{const N=g.indexOf(T),L=N===w;return u.jsxs("button",{id:kE(T.operationId),ref:H=>{H?p.current.set(T.operationId,H):p.current.delete(T.operationId)},type:"button",className:`operation-search-result ${L?"is-active":""}`,role:"option","aria-selected":L,onMouseEnter:()=>o(N),onClick:()=>E(T.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:fv(T.operationName,S)}),u.jsx("small",{children:XY(T)})]}),u.jsx("span",{className:"operation-search-theater",children:fv(T.theaterLabel,S)})]},T.operationId)})]},j.theaterId??yL)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function CE(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function XY(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function ZY(e){return`operation-search-heading-${bL(e??yL)}`}function kE(e){return`operation-search-option-${bL(e)}`}function bL(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function fv(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=JY(e,t,i);if(!r){n.push(e.slice(i));break}r.start>i&&n.push(e.slice(i,r.start)),n.push(u.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),i=r.end}return n}function JY(e,t,n){const i=e.toLocaleLowerCase();let r=null;for(const o of t){const c=i.indexOf(o,n);c!==-1&&(!r||c<r.start)&&(r={start:c,end:c+o.length})}return r}function QY(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(VY)).filter(o=>o.offsetParent!==null);if(n.length===0)return;const i=n[0],r=n[n.length-1];if(e.shiftKey&&document.activeElement===i){e.preventDefault(),r?.focus();return}!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i?.focus())}function eX(){return u.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"m14.2 14.2 3 3M8.9 15.2a6.3 6.3 0 1 1 0-12.6 6.3 6.3 0 0 1 0 12.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function tX({open:e,title:t,message:n,tone:i="info",onDismiss:r}){return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),n?u.jsx("p",{className:"app-toast-message",children:n}):null]}),r?u.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function SL(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await wL(t),xL(await t.json(),t.status)}async function nX(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await wL(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new an(n.status,"Invalid global settings mutation response");return{state:xL(i.state,n.status)}}async function wL(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new an(e.status,t)}function xL(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!iX(n.consoleStaticPort)||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!sX(n.language))throw new an(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,theme:n.theme,uiFont:eD(n.uiFont),language:n.language}}function iX(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function sX(e){return e==="auto"||e==="en"||e==="ko"}const Tb=new Set;let mh={loading:!1,state:null,savingField:null,error:null};function c1(){return y.useSyncExternalStore(aX,Sp,Sp)}function Sp(){return mh}function rX(e){Io({loading:!1,state:e,error:null})}function aX(e){return Tb.add(e),()=>{Tb.delete(e)}}async function oX(e){Io({loading:!0,error:null});try{const t=await SL(e);Io({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Io({loading:!1,error:CL(t)})}}async function rc(e,t){if(mh.savingField!==null)return!1;const n=mh.state,i=n?{...n,[e]:t}:null;Io({state:i,savingField:e,error:null});try{const r=await nX({[e]:t});return Io({state:r.state,savingField:null,error:null}),!0}catch(r){return Io({state:n,savingField:null,error:CL(r)}),!1}}function Io(e){mh={...mh,...e};for(const t of Tb)t()}function CL(e){return e instanceof Error?e.message:String(e)}let Zl=null,Gu=0;function kL(e){Zl?.abort();const t=new AbortController,n=++Gu;return Zl=t,oD(),xO({...e,signal:t.signal}).then(i=>{n===Gu&&lD(i)}).catch(i=>{t.signal.aborted||n!==Gu||cD(i instanceof Error?i.message:String(i))}).finally(()=>{n===Gu&&(Zl=null)})}function lX(){Zl!==null&&(Zl.abort(),Zl=null,Gu+=1)}function EL(e,t=cX()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function cX(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const TL=[{id:"fleet-cli",label:"Fleet CLI"},{id:"fleet-console",label:"Fleet Console"},{id:"fleet-desktop",label:"Fleet Desktop"},{id:"fleet-plugin",label:"Fleet Plugin"},{id:"fleet-core",label:"Fleet Core"}],pv={id:"overview",label:"Overview"},uX={id:"all-updates",label:"All updates"},hX={id:"other-updates",label:"Other updates"};function AL(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=TL.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[pv,uX]:t?[pv,...n,hX]:[pv,...n]}function dX(e,t){return t==="overview"?[]:e.sections.map(n=>({...n,items:n.items.filter(i=>t==="all-updates"||t==="other-updates"?i.product===void 0:i.product===t)})).filter(n=>n.items.length>0)}function fX(e){const t=TL.flatMap(i=>{const r=e.sections.flatMap(o=>o.items.filter(c=>c.product===i.id));return r.length===0?[]:[{id:i.id,label:i.label,count:r.length,summary:r[0].text}]}),n=e.sections.flatMap(i=>i.items.filter(r=>r.product===void 0));return n.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:n.length,summary:n[0].text}]}function pX(e,t){return AL(e).some(n=>n.id===t)}const mX=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Lu=10;function gX({state:e}){const t=y.useRef(null),n=y.useRef([]),i=y.useRef(null),r=y.useRef(null),o=y.useRef(new Map),[c,d]=y.useState("overview"),f=c1(),p=EL(f.state?.language??"auto"),_=e.selectedReleaseNoteKey??Ll(e.releaseNotes[0]?.version??"",0),g=e.releaseNotes.findIndex((F,J)=>Ll(F.version,J)===_),b=e.releaseNotes[g]??e.releaseNotes[0],S=b?Ll(b.version,g>=0?g:0):"",w=b?AL(b):[];y.useEffect(()=>{d("overview")},[S]),y.useEffect(()=>{b&&!pX(b,c)&&d("overview")},[c,b]),y.useEffect(()=>{const F=J=>{const pe=J.target instanceof HTMLElement?J.target:null;if(!pe||pe.closest(".whatsnew-card"))return;const G=n.current.filter(P=>P!==pe&&P.isConnected);n.current=[...G.slice(-4),pe]};return document.addEventListener("focusin",F,!0),()=>document.removeEventListener("focusin",F,!0)},[]);const x=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!x&&t.current===null&&(t.current=document.activeElement),y.useEffect(()=>{if(!e.whatsNewOpen||x)return;const F=J=>{J.key==="Escape"?(J.preventDefault(),Hd()):bX(J,r.current,d)?J.preventDefault():J.key==="Tab"&&yX(J,r.current),J.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",F,!0),()=>{window.removeEventListener("keydown",F,!0);const J=t.current?.isConnected?t.current:[...n.current].reverse().find(pe=>pe.isConnected);t.current=null,J?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||b===void 0)return null;const E=()=>{kL({force:!0,locale:p})},D=async F=>{await rc("language",F)},j=Math.max(1,Math.ceil(e.releaseNotes.length/Lu)),z=Math.min(j-1,Math.floor((g>=0?g:0)/Lu)),T=z*Lu,N=e.releaseNotes.slice(T,T+Lu),L=F=>{const J=z+F;if(J<0||J>=j)return;const pe=J*Lu,G=e.releaseNotes[pe];G&&cC(Ll(G.version,pe))},H=F=>{d(F),requestAnimationFrame(()=>o.current.get(F)?.focus())};return u.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[u.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Hd,"aria-label":"Close What's new"}),u.jsxs("section",{className:"whatsnew-card",ref:r,children:[u.jsxs("header",{className:"whatsnew-header",children:[u.jsxs("div",{className:"whatsnew-heading-row",children:[u.jsx("h2",{id:"whatsnew-title",children:"What's new"}),u.jsxs("span",{className:"whatsnew-version-badge",children:["v",b.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[b.date?u.jsxs("time",{className:"whatsnew-date",dateTime:b.date,children:["Released ",b.date]}):u.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),u.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:Hd,"aria-label":"Close What's new",children:"x"}),u.jsxs("div",{className:"whatsnew-body",children:[u.jsxs("div",{className:"whatsnew-version-selector",children:[u.jsx("select",{"aria-label":"Release version",value:S,onChange:F=>cC(F.currentTarget.value),children:N.map((F,J)=>{const pe=T+J;return u.jsxs("option",{value:Ll(F.version,pe),children:[F.version==="Unreleased"?"Unreleased":`v${F.version}`,F.date?` · ${F.date}`:""]},Ll(F.version,pe))})}),j>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>L(-1),disabled:z===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[z+1," / ",j]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>L(1),disabled:z>=j-1,"aria-label":"Older versions",children:"›"})]}):null,u.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(F=>u.jsx("button",{type:"button",className:p===F?"is-active":"","aria-pressed":p===F,disabled:f.savingField==="language",onClick:()=>{D(F)},children:F==="en"?"EN":"한국어"},F))}),u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:E,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),u.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(F=>u.jsx("button",{ref:J=>{J?o.current.set(F.id,J):o.current.delete(F.id)},id:`whatsnew-tab-${F.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":F.id,"aria-selected":c===F.id,"aria-controls":"whatsnew-tab-panel",tabIndex:c===F.id?0:-1,onClick:()=>d(F.id),children:F.label},F.id))}),e.releaseNotesError?u.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,u.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${c}`,children:c==="overview"?u.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:fX(b).map(F=>u.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>H(F.id),children:[u.jsx("span",{className:"whatsnew-overview-label",children:F.label}),u.jsxs("span",{className:"whatsnew-overview-count",children:[F.count," ",F.count===1?"update":"updates"]}),u.jsx("span",{className:"whatsnew-overview-summary",children:F.summary})]},F.id))}):dX(b,c).map((F,J)=>u.jsx(_X,{section:F,index:J},F.heading))})]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Hd,children:"Close"})})]})]})}function _X({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[u.jsx("h3",{children:u.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),u.jsx("ul",{children:e.items.map((r,o)=>u.jsx("li",{children:u.jsx(vX,{item:r})},`${r.text}:${o}`))})]})}function vX({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,n)=>u.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),u.jsx("span",{children:e.text})]})}function Ll(e,t){return`${e}:${t}`}function yX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(mX)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function bX(e,t,n){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const i=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!i||!t)return!1;const r=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=r.indexOf(i);if(o<0||r.length===0)return!1;const c=e.key==="Home"?0:e.key==="End"?r.length-1:(o+(e.key==="ArrowRight"?1:-1)+r.length)%r.length,d=r[c],f=d.dataset.tabId;return f?(n(f),d.focus(),!0):!1}function RL(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function SX(e,t=window){const n=i=>{if(!(K5()||RL(t.document))){if((i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"){i.preventDefault(),i.stopImmediatePropagation(),e.toggleOperationSearch();return}if((i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&i.altKey&&!i.shiftKey&&(i.metaKey||i.key.toLowerCase()==="b")){i.preventDefault(),i.stopImmediatePropagation(),e.toggleRailChrome();return}(i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&!i.altKey&&!i.shiftKey&&(i.preventDefault(),i.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)}function Xp(e=()=>{}){return{...i5(e),notifications:{emit:n=>vD(n),dismiss:n=>kD(n)},status:{set:(n,i)=>_D(n,i),clear:n=>B5(n)}}}async function wX(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await xX(t),CX(await t.json(),t.status).routes}async function xX(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new an(e.status,t)}function CX(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new an(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>kX(i,t))}}function kX(e,t){const n=e;if(!n||typeof n!="object"||typeof n.method!="string"||typeof n.path!="string"||typeof n.summary!="string"||typeof n.category!="string"||typeof n.gate!="string")throw new an(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const Ab=new Set;let Rb={loading:!1,state:null,error:null};function EX(){return y.useSyncExternalStore(TX,EE,EE)}function EE(){return Rb}function TX(e){return Ab.add(e),()=>{Ab.delete(e)}}async function AX(e){mv({loading:!0,error:null});try{const t=await wX(e);mv({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;mv({loading:!1,error:RX(t)})}}function mv(e){Rb={...Rb,...e};for(const t of Ab)t()}function RX(e){return e instanceof Error?e.message:String(e)}function NX(){const e=EX(),[t,n]=y.useState(!0),i=y.useMemo(()=>OX(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return y.useEffect(()=>{const c=new AbortController;return AX(c.signal),()=>c.abort()},[]),u.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[u.jsx("div",{className:`backend-api-control settings-disclosure-control ${t?"is-expanded":""}`,children:u.jsxs("div",{className:"settings-disclosure-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),u.jsx("p",{className:"global-settings-help",children:r>0?`${r} loopback route${r===1?"":"s"} across ${o} categor${o===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),u.jsx("div",{className:"settings-disclosure-actions",children:u.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":t,onClick:()=>n(c=>!c),children:t?"Hide":"Show"})})]})}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?u.jsxs("div",{className:"backend-api-groups",children:[i.length>0?i.map(c=>u.jsx(LX,{group:c},c.category)):null,e.state&&i.length===0?u.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,u.jsx("p",{className:"global-settings-foot",children:"Console backend routes are fetched from GET /api/v1/settings/api-catalog, so newly registered routes appear here automatically. The Codex/Fleet Wiki API surface is not included."})]})}function LX({group:e}){return u.jsxs("div",{className:"backend-api-group",children:[u.jsxs("div",{className:"backend-api-group-head",children:[u.jsx("span",{children:e.category}),u.jsx("span",{children:e.entries.length})]}),u.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>u.jsx(MX,{entry:t},`${t.method}:${t.path}`))})]})}function MX({entry:e}){return u.jsxs("div",{className:"backend-api-row",children:[u.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),u.jsx("code",{className:"backend-api-path",children:e.path}),u.jsx("span",{className:"backend-api-summary",children:e.summary}),u.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function OX(e){const t=new Map;for(const n of e){const i=n.category.trim()||"Uncategorized",r=t.get(i);r?r.push(n):t.set(i,[n])}return Array.from(t.entries()).map(([n,i])=>({category:n,entries:i}))}const DX=[{id:"instrument",label:"Instrument",swatch:["oklch(16.5% 0.016 245)","oklch(80% 0.085 78)","oklch(77% 0.085 200)"]},{id:"maritime",label:"Maritime",swatch:["oklch(20% 0.045 248)","oklch(78% 0.13 75)","oklch(82% 0.13 195)"]},{id:"carbon",label:"Carbon",swatch:["oklch(18% 0.007 255)","oklch(76% 0.115 62)","oklch(80% 0.105 205)"]}],jX=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],IX=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],BX=1024,$X=65535,TE=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function PX(){const e=c1(),t=e.state,n=e.savingField!==null,[i,r]=y.useState("general"),o=zs(),c=cc(),d=pc(),f=FX(d.plugins),p=UX(f),_=g=>{r(g),c({pathname:"/settings",search:g==="general"?"":`?section=${encodeURIComponent(g)}`})};return y.useEffect(()=>{const g=new AbortController;return oX(g.signal),()=>g.abort()},[]),y.useEffect(()=>{const g=new URLSearchParams(o.search).get("section"),b=new Set([...TE.map(w=>w.id),...f.map(w=>w.id)]),S=g&&b.has(g)?g:"general";r(S),g&&g!==S&&c({pathname:"/settings",search:""},{replace:!0})},[o.search,c,f]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Console"}),u.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?"Saving…":""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[u.jsx("p",{className:"global-settings-nav-group",children:"Console"}),TE.map(g=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${g.id===i?"is-active":""}`,"aria-pressed":g.id===i,onClick:()=>_(g.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:g.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:g.eyebrow})]},g.id)),f.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),p.map(g=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:g.pluginLabel}),g.sections.map(b=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>_(b.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:b.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:b.pluginLabel})]},b.id))]},g.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:HX(i,t,n,f)},i)]})]})}function zX({render:e}){return u.jsx(u.Fragment,{children:e()})}function HX(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?u.jsx(Ff,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:u.jsx(zX,{render:r.render})}):u.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return u.jsxs(u.Fragment,{children:[u.jsx(qX,{state:t,saving:n}),u.jsx(GX,{state:t,saving:n}),u.jsx(KX,{state:t,saving:n})]});case"backend-api":return u.jsx(NX,{})}}function FX(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:WX(t.id),sectionTitle:n.title,render:n.render})))}function UX(e){const t=[];for(const n of e){const i=t.at(-1);if(i?.pluginId===n.pluginId){t[t.length-1]={...i,sections:[...i.sections,n]};continue}t.push({pluginId:n.pluginId,pluginLabel:n.pluginLabel,sections:[n]})}return t}function WX(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function qX({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(Sp().savingField!==null)return;const o=n;Kf(r),rc("theme",r).then(c=>{c||Kf(o)})};return u.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),u.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),u.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:DX.map(r=>{const o=r.id===n;return u.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>i(r.id),children:[u.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:r.swatch.map(c=>u.jsx("i",{style:{background:c}},c))}),u.jsx("span",{className:"theme-card-label",children:r.label}),u.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:o?u.jsx(XX,{}):null})]},r.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function GX({state:e,saving:t}){const n=e?.uiFont??Ku,[i,r]=y.useState([]),[o,c]=y.useState(!0),[d,f]=y.useState(null);y.useEffect(()=>{const g=new AbortController;return nT({signal:g.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),f(null)}).catch(b=>{g.signal.aborted||(r([]),f(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{g.signal.aborted||c(!1)}),()=>g.abort()},[]);const p=g=>{if(Sp().savingField!==null)return;const b=n;zv(g),rc("uiFont",g).then(S=>{S||zv(b)})},_=g=>{const b=g.source==="builtin"?{source:"builtin",id:g.id,size:n.size}:{source:"system",familyName:g.familyName,size:n.size};p(b)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),u.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),u.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||n.source==="builtin"&&n.id==="manrope"&&n.size===ql.defaultValue,onClick:()=>p(Ku),children:"Reset to Fleet default"})]}),u.jsx(eT,{builtIns:Gf.map(({id:g,label:b,family:S,aliases:w,description:x})=>({id:g,label:b,family:S,aliases:w,description:x})),installedFonts:i,selected:n.source==="builtin"?{source:"builtin",id:n.id}:{source:"system",familyName:n.familyName},selectedSystemFont:n.source==="system"?n.familyName:null,fallbackStack:L5(Ku),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:ql,loading:o,error:d,disabled:!e||t,onSelectionChange:_,onSizeCommit:g=>p({...n,size:g})}),u.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function KX({state:e,saving:t}){const n=er();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsxs(u.Fragment,{children:[u.jsx(YX,{state:e,saving:t,consoleState:n}),u.jsx(VX,{state:e,saving:t})]}):u.jsx("p",{className:"global-settings-help",children:"Loading settings."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function VX({state:e,saving:t}){return u.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),u.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),u.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:IX.map(n=>{const i=e.language===n.id;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,disabled:t,onClick:()=>{rc("language",n.id)},children:n.label},n.id)})}),u.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function YX({state:e,saving:t,consoleState:n}){const[i,r]=y.useState(e.consoleStaticPort?.toString()??""),o=n.effectivePort,c=n.portMode==="static"&&!n.portHonored,d=n.requestedPort,f=e.consolePortMode==="static"&&e.consoleStaticPort!==null,p=i.trim(),_=Number(p),g=p.length>0,b=g&&AE(_),S=e.consolePortMode==="static"&&g&&!b;return y.useEffect(()=>{r(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),u.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",children:"Dynamic lets the OS pick a free loopback port each time the console starts. Static pins a port you choose so the console URL stays the same across restarts."})]}),u.jsxs("div",{className:"console-port-control",children:[u.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:jX.map(w=>{const x=e.consolePortMode===w.id;return u.jsx("button",{type:"button","aria-pressed":x,className:`segmented-option ${x?"is-active":""}`,disabled:t,onClick:()=>{rc("consolePortMode",w.id)},children:w.label},w.id)})}),u.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:u.jsxs("div",{className:"console-port-reveal-inner",children:[u.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),u.jsx("input",{id:"console-static-port-input",className:`console-port-input ${S?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:i,disabled:t,"aria-invalid":S,"aria-describedby":"console-static-port-hint",onChange:w=>{const x=w.target.value;r(x);const E=Number(x.trim());AE(E)&&rc("consoleStaticPort",E)}}),u.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${S?"is-invalid":""}`,children:"1024–65535"})]})}),u.jsxs("div",{className:`console-port-effective ${c?"is-fallback":""}`,"aria-live":"polite",children:[u.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),u.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",u.jsx("span",{children:o||"..."}),c?" · Dynamic":""]})]})]}),c&&d?u.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",u.jsx("strong",{children:d})," was unavailable — the console fell back to a ",u.jsx("strong",{children:"Dynamic"})," port and is running on ",u.jsxs("strong",{children:["127.0.0.1:",o||"..."]}),"."," ",f?u.jsxs(u.Fragment,{children:["Next restart will try ",u.jsx("strong",{children:e.consoleStaticPort}),"."]}):u.jsx(u.Fragment,{children:"Next restart will use a dynamic port."})]}):null,u.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function AE(e){return Number.isInteger(e)&&e>=BX&&e<=$X}function XX(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ZX(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function gh(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function JX(e,t){return{...ZX(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const RE=256,NE=176,gv=12,ff=220,NL="fleet-console.map.radarCollapsed";function QX({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:r,onJump:o}){const c=y.useRef(null),d=y.useRef(!1),f=y.useRef(null),[p,_]=y.useState(eZ),g=Gp();if(y.useEffect(()=>{if(g){f.current===null&&(f.current=p,_(!0));return}f.current!==null&&(_(f.current),f.current=null)},[p,g]),r.width<=0||r.height<=0||i.zoom<=0)return null;const b=[...Object.entries(e).map(([k,B])=>({id:k,x:B.x,y:B.y,width:B.width,height:B.height})),...Object.entries(t).map(([k,B])=>({id:k,x:B.geometry.x,y:B.geometry.y,width:B.geometry.width,height:B.geometry.height}))];if(b.length===0)return null;const S=()=>{_(k=>{const B=!k;return g||tZ(B),B})};if(p)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:u.jsx(iZ,{})});const w=RE-gv*2,x=NE-gv*2,E={x:-i.x/i.zoom,y:-i.y/i.zoom,width:r.width/i.zoom,height:r.height/i.zoom};let D=Math.min(E.x,...b.map(k=>k.x)),j=Math.min(E.y,...b.map(k=>k.y)),z=Math.max(E.x+E.width,...b.map(k=>k.x+k.width)),T=Math.max(E.y+E.height,...b.map(k=>k.y+k.height));D-=ff,j-=ff,z+=ff,T+=ff;const N=z-D,L=T-j,H=Math.min(w/N,x/L),F=(w-N*H)/2,J=(x-L*H)/2,pe=k=>F+(k-D)*H,G=k=>J+(k-j)*H,P=k=>{const B=c.current?.getBoundingClientRect();if(!B)return;const O=k.clientX-B.left,W=k.clientY-B.top;o({x:D+(O-F)/H,y:j+(W-J)/H})},A=k=>{k.stopPropagation(),d.current=!0,k.currentTarget.setPointerCapture(k.pointerId),P(k)},$=k=>{d.current&&(k.stopPropagation(),P(k))},M=k=>{d.current=!1;try{k.currentTarget.releasePointerCapture(k.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:RE,height:NE},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:u.jsx(nZ,{})}),u.jsxs("div",{ref:c,className:"canvas-minimap-inner",style:{inset:gv},onPointerDown:A,onPointerMove:$,onPointerUp:M,onPointerCancel:M,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[b.map(k=>u.jsx("div",{className:"canvas-minimap-operation",style:{left:pe(k.x),top:G(k.y),width:Math.max(2,k.width*H),height:Math.max(2,k.height*H),...n?.[k.id]?{"--user-accent":n[k.id]}:{}}},k.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:pe(E.x),top:G(E.y),width:E.width*H,height:E.height*H}})]})]})}function eZ(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(NL)==="true"}catch{return!1}}function tZ(e){if(!(typeof window>"u"))try{window.localStorage.setItem(NL,String(e))}catch{}}function nZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function iZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),u.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function sZ({viewport:e}){return u.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[u.jsx("div",{className:"operations-canvas-sea"}),u.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}const rZ=["n","ne","e","se","s","sw","w","nw"],_v=320,vv=200,aZ=1500;function oZ({operation:e,active:t,geometry:n,zoom:i,status:r,minimized:o=!1,maximized:c=!1,renderHidden:d=!1,focusLayerTarget:f=!1,topEdge:p=!1,interactionDisabled:_=!1,accentKey:g=null,children:b,onActivate:S,onClose:w,onMinimize:x,onMaximize:E,onRename:D,onSetAccent:j,onGeometryChange:z,onGeometryCommit:T,onRenderHiddenFocus:N}){const L=y.useRef(null),H=y.useRef(null),F=y.useRef(null),J=y.useRef(null),pe=y.useRef(null),G=y.useRef(!1),[P,A]=y.useState(null),[$,M]=y.useState(!1),k=e.title,B=a1({currentTitle:e.title,onBegin:()=>{R()},onCommit:we=>{D(we),G.current=!0}}),O=g?qa(g):null,W=["canvas-operation",t?"is-active":"",o?"is-minimized":"",c?"is-maximized":"",p?"is-top-edge":"",cZ(r)].filter(Boolean).join(" ");y.useEffect(()=>()=>{pe.current!==null&&window.clearTimeout(pe.current)},[]),y.useEffect(()=>{if(B.renaming||!G.current)return;G.current=!1;const we=window.requestAnimationFrame(()=>H.current?.focus());return()=>window.cancelAnimationFrame(we)},[B.renaming]),y.useLayoutEffect(()=>{if(!d||typeof document>"u")return;const we=P!==null;we&&A(null),(we||L.current?.contains(document.activeElement))&&N?.()},[P,d,N]);const U=()=>{pe.current!==null&&(window.clearTimeout(pe.current),pe.current=null)},R=()=>{U(),M(!1)},Y=()=>{U(),M(!0),pe.current=window.setTimeout(()=>{pe.current=null,M(!1)},aZ)},Z=we=>{R(),!(c||_)&&we.button===0&&(we.preventDefault(),we.stopPropagation(),S(),F.current={pointerId:we.pointerId,startX:we.clientX,startY:we.clientY,geometry:n,latest:n},we.currentTarget.setPointerCapture(we.pointerId))},me=we=>{if(c||_)return;const Je=F.current;if(!Je||Je.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const st={...Je.geometry,x:Je.geometry.x+(we.clientX-Je.startX)/i,y:Je.geometry.y+(we.clientY-Je.startY)/i};Je.latest=st,z(st)},ue=we=>{if(c||_){F.current=null;return}const Je=F.current;!Je||Je.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),F.current=null,we.currentTarget.releasePointerCapture(we.pointerId),T(Je.latest))},oe=(we,Je)=>{c||_||(Je.preventDefault(),Je.stopPropagation(),S(),J.current={direction:we,pointerId:Je.pointerId,startX:Je.clientX,startY:Je.clientY,geometry:n,latest:n},Je.currentTarget.setPointerCapture(Je.pointerId))},ke=we=>{if(c||_)return;const Je=J.current;if(!Je||Je.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const st=lZ(Je.geometry,Je.direction,(we.clientX-Je.startX)/i,(we.clientY-Je.startY)/i);Je.latest=st,z(st)},Ne=we=>{if(c||_){J.current=null;return}const Je=J.current;!Je||Je.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),J.current=null,we.currentTarget.releasePointerCapture(we.pointerId),T(Je.latest))},Re=we=>{we.stopPropagation()},ot=we=>{we.stopPropagation(),R()},Le=we=>{we.stopPropagation(),S()},Se=we=>{we.stopPropagation()},xe=()=>{R();const we=typeof document<"u"?document.activeElement:null;we instanceof HTMLElement&&L.current?.contains(we)&&we.blur(),x()},Me=()=>{R(),E?.()},Ke=we=>{R(),S(),A(we)},it=we=>{we.stopPropagation(),R(),S()},Ge=()=>{if(!$){Y();return}R(),w()},he=we=>{we.stopPropagation(),B.begin()},Qe=we=>{we.key!=="Enter"&&we.key!=="F2"||(we.preventDefault(),we.stopPropagation(),B.begin())},Ye=we=>{we.key==="Escape"&&(G.current=!0),B.handleKeyDown(we)},Ht={left:Math.round(n.x),top:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height),zIndex:n.zIndex,...d?{visibility:"hidden",pointerEvents:"none"}:{},...O?{"--user-accent":O}:{}};return u.jsxs("article",{ref:L,className:W,style:Ht,onPointerDown:S,"data-canvas-operation":!0,"data-focus-layer-target":f?"true":void 0,"aria-label":`Operation ${k}`,"aria-hidden":d||void 0,tabIndex:f?-1:void 0,inert:o||d?!0:void 0,children:[O?u.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!c&&!_?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:Z,onPointerMove:me,onPointerUp:ue,onPointerCancel:ue,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:Z,onPointerMove:me,onPointerUp:ue,onPointerCancel:ue,"data-canvas-blocker":!0,children:[O?u.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,B.renaming?u.jsx("input",{ref:B.inputRef,className:"canvas-operation-identity-input",value:B.draftTitle,"aria-label":`Rename operation ${k}`,onChange:we=>B.setDraftTitle(we.target.value),onKeyDown:Ye,onBlur:B.handleBlur,onPointerDown:ot}):u.jsx("button",{ref:H,type:"button",className:"canvas-operation-identity-name",onPointerDown:ot,onDoubleClick:he,onKeyDown:Qe,"aria-label":`Rename operation ${k}`,title:`${k} — Double-click, Enter, or F2 to rename`,children:k}),j?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:Re,onClick:we=>Ke(we.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${k}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:LE(r),"aria-hidden":"true"})}):u.jsx("span",{className:LE(r),onPointerDown:it,"aria-hidden":"true"}),u.jsxs("div",{className:"canvas-operation-window-controls",children:[u.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:Re,onClick:xe,"aria-label":`Minimize operation ${k}`,title:"Minimize operation",children:u.jsx(uZ,{})}),E?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:Re,onClick:Me,"aria-label":c?`Restore operation ${k}`:`Maximize operation ${k}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(dZ,{}):u.jsx(hZ,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${$?"is-armed-close":""}`,onPointerDown:Re,onClick:Ge,"aria-label":$?`Confirm close operation ${k}`:`Close operation ${k}`,title:$?"Confirm close":"Close operation",children:$?"Close?":u.jsx(fZ,{})})]})]}),u.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:k}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:Le,onWheel:Se,"data-canvas-blocker":!0,children:b}),!c&&!_&&rZ.map(we=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${we}`,onPointerDown:Je=>oe(we,Je),onPointerMove:ke,onPointerUp:Ne,onPointerCancel:Ne,"data-canvas-blocker":!0,"aria-hidden":"true"},we)),P&&j?u.jsx(tV,{anchor:P,accentKey:g,onSelect:j,onClose:()=>A(null)}):null]})}function lZ(e,t,n,i){let{x:r,y:o,width:c,height:d}=e;return t.includes("e")&&(c+=n),t.includes("s")&&(d+=i),t.includes("w")&&(r+=n,c-=n),t.includes("n")&&(o+=i,d-=i),c<_v&&(t.includes("w")&&(r-=_v-c),c=_v),d<vv&&(t.includes("n")&&(o-=vv-d),d=vv),{...e,x:r,y:o,width:c,height:d}}function cZ(e){const t=Vp(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function LE(e){const t=Vp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"tenant-beacon is-idle"}function uZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function hZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 6V3.5H6M10 3.5h2.5V6M12.5 10v2.5H10M6 12.5H3.5V10",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function dZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6.2 3.5v2.7H3.5M9.8 3.5v2.7h2.7M12.5 9.8H9.8v2.7M3.5 9.8h2.7v2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function fZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function pZ({rect:e,viewport:t}){const n=JX(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const mZ=.25,gZ=2,_Z=200,vZ=150,ME=5,yZ=.0018;function bZ({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:r,onCreate:o,onConsumePointerDown:c,onClick:d}){const f=y.useRef(null),p=y.useRef(e),[_,g]=y.useState(null),[b,S]=y.useState(!1),[w,x]=y.useState(!1);y.useEffect(()=>{p.current=e},[e]),y.useEffect(()=>{const L=F=>{F.key==="Shift"&&x(!0),!SZ(F.target)&&F.code==="Space"&&(F.preventDefault(),S(!0))},H=F=>{F.key==="Shift"&&x(!1),F.code==="Space"&&S(!1)};return window.addEventListener("keydown",L),window.addEventListener("keyup",H),()=>{window.removeEventListener("keydown",L),window.removeEventListener("keyup",H)}},[]);const E=L=>{if(t||OE(L.target)||L.button!==0&&L.button!==1)return;if(L.preventDefault(),n){c?.();return}const H=bv(L),F=L.shiftKey&&L.button===0&&!b?"create":"pan";f.current={pointerId:L.pointerId,mode:F,startScreen:H,currentScreen:H,startViewport:p.current},L.currentTarget.setPointerCapture(L.pointerId),F==="create"&&g(yv(H,H,p.current))},D=L=>{const H=f.current;if(!H||H.pointerId!==L.pointerId)return;L.preventDefault();const F=bv(L);if(f.current={...H,currentScreen:F},H.mode==="pan"){i({...H.startViewport,x:H.startViewport.x+F.x-H.startScreen.x,y:H.startViewport.y+F.y-H.startScreen.y});return}g(yv(H.startScreen,F,p.current))},j=L=>{N(L,!0)},z=L=>{N(L,!1)},T=L=>{if(t||OE(L.target))return;L.preventDefault();const H=bv(L),F=p.current,J=wZ(F.zoom*Math.exp(-L.deltaY*yZ),mZ,gZ),pe=gh(H,F);r({x:H.x-pe.x*J,y:H.y-pe.y*J,zoom:J})},N=(L,H)=>{const F=f.current;if(!F||F.pointerId!==L.pointerId||(f.current=null,L.currentTarget.releasePointerCapture(L.pointerId),g(null),!H))return;const J=Math.abs(F.currentScreen.x-F.startScreen.x),pe=Math.abs(F.currentScreen.y-F.startScreen.y);if(J<ME&&pe<ME){d?.();return}if(F.mode!=="create")return;const G=yv(F.startScreen,F.currentScreen,p.current),P={x:G.x,y:G.y,width:Math.max(G.width,_Z),height:Math.max(G.height,vZ)};o(P,F.currentScreen)};return{rubberBand:_,spaceActive:b,shiftActive:w,onPointerDown:E,onPointerMove:D,onPointerUp:j,onPointerCancel:z,onWheel:T}}function yv(e,t,n){const i=gh(e,n),r=gh(t,n),o=Math.min(i.x,r.x),c=Math.min(i.y,r.y);return{x:o,y:c,width:Math.abs(i.x-r.x),height:Math.abs(i.y-r.y)}}function bv(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function OE(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function SZ(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function wZ(e,t,n){return Math.min(n,Math.max(t,e))}const xZ="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",CZ=560,kZ=360,EZ=12;function TZ({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:c,onFocus:d,onRename:f,onSetAccent:p}){const _=y.useRef(null),g=$N(),b=HN(),S=Gp(),w=PN(),x=zN(),E=_V(x),D=y.useRef(null),j=FN(),z=e.activeOperationId,[T,N]=y.useState(null),L=pc(),[H,F]=y.useState({width:0,height:0}),J=OZ(),pe=!e.activeTheaterId||e.addingTheater;y.useEffect(()=>{const he=_.current;if(!he||typeof ResizeObserver>"u")return;const Qe=()=>F({width:he.clientWidth,height:he.clientHeight});Qe();const Ye=new ResizeObserver(Qe);return Ye.observe(he),()=>Ye.disconnect()},[]);const G=bZ({viewport:g.viewport,disabled:pe||S||x!==null,onViewportChange:bb,onZoom:WN,onCreate:he=>{if(N(null),e.activeTheaterId&&n){const Qe=DZ(t);if(!Qe)return;const Ye={...NZ(he),zIndex:Fo()};o(Qe.pluginId,Qe.kind,Ye)}},consumePointerDown:T!==null,onConsumePointerDown:()=>{N(null)},onClick:RZ}),P=(he,Qe)=>{const Ye=T?.canvasPoint;N(null),Ye&&r(he,Qe,Ye)},A=he=>{if(he.target instanceof Element&&he.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;he.preventDefault();const Qe=_.current?.getBoundingClientRect();if(!Qe)return;const Ye={x:he.clientX-Qe.left,y:he.clientY-Qe.top};N({anchor:Ye,canvasPoint:gh(Ye,g.viewport)})},$=new Set(j);y.useEffect(()=>{e.activeOperationId&&$.has(e.activeOperationId)&&Bi(null)},[j,e.activeOperationId]);const M=Object.fromEntries(Object.entries(g.operations).filter(([he])=>!$.has(he))),k=(e.operations??[]).filter(he=>he.theaterId===e.activeTheaterId),B=L.operationKinds,W=w!==null&&k.some(he=>he.id===w&&!$.has(he.id))?w:null,U=x===null?void 0:k.find(he=>he.id===x&&!$.has(he.id)),R=U?B.find(he=>he.pluginId===U.pluginId&&he.type===U.type):void 0;x===null&&(D.current=null),U&&R?.companions?.length&&(D.current={operation:U,descriptor:R});const Y=!U&&D.current?.operation.id===x?D.current:null,Z=U??Y?.operation,ue=(R??Y?.descriptor)?.companions??[],oe=ue.filter(he=>E[he.id]??!he.defaultHidden),ke=ue.filter(he=>!oe.includes(he)).map(he=>he.id),Ne=Z&&ue.length>0?Z.id:null,Re=U&&R?.companions?.length?U.id:null,ot=Z&&!k.some(he=>he.id===Z.id)?[...k,Z]:k,Le=ot.length>0;y.useEffect(()=>{if(x===null||Re!==null)return;const he=setTimeout(()=>{D.current=null,Qs()},1500);return()=>clearTimeout(he)},[x,Re]);const Se=z5(k,e.groups.filter(he=>he.theaterId===e.activeTheaterId),g.operationOrder,[]).filter(he=>!$.has(he.id)).map(he=>he.id),xe=S?SV({x:0,y:0,width:H.width,height:H.height},Se.length,void 0,void 0,void 0,void 0,b):[],Me=new Map(Se.map((he,Qe)=>[he,xe[Qe]])),Ke=W||Ne||S?1:g.viewport.zoom,it=MZ(g.operations)+1,Ge=oe.length+1;return u.jsxs("main",{className:`operations-canvas ${G.spaceActive?"is-panning":""} ${G.shiftActive?"is-creating":""} ${J?"is-glance":""} ${W?"is-panel-maximized":""} ${Ne?"is-companion-layout":""} ${S?"is-formation-view":""}`,onPointerDown:G.onPointerDown,onPointerMove:G.onPointerMove,onPointerUp:G.onPointerUp,onPointerCancel:G.onPointerCancel,onWheel:G.onWheel,onContextMenu:A,ref:_,tabIndex:-1,children:[u.jsx(sZ,{viewport:g.viewport}),u.jsx("div",{style:{transform:W||Ne||S?"none":`translate(${Math.round(g.viewport.x)}px, ${Math.round(g.viewport.y)}px) scale(${g.viewport.zoom})`},className:"operations-canvas-world",children:ot.map(he=>{const Qe=g.operations[he.id]??he.geometry??Sv(he),Ye=W===he.id,Ht=Ne===he.id,we=(W!==null||Ne!==null)&&!Ye&&!Ht,Je=Me.get(he.id),st=Ye?LZ(H,it):Ht?DE(H,0,Ge,it):Je?{...Qe,...Je}:Qe,Vn=!Ye&&!Ht&&!Je&&g.viewport.y+st.y*Ke<EZ*Ke;return jZ(he,{active:z===he.id,keyboardFocusRequestId:e.keyboardFocusRequest?.operationId===he.id?e.keyboardFocusRequest.requestId:0,geometry:st,topEdge:Vn,operationKindRegistry:B,status:e.operationStatus[he.id],theme:e.activeTheme,viewportZoom:Ke,minimized:$.has(he.id),maximized:Ye,companion:Ht,companions:Ht?oe:[],companionGeometries:Ht?oe.map((bt,Ee)=>DE(H,Ee+1,Ge,it)):[],hiddenCompanionPanelIds:Ht?ke:[],formation:S,focusLayerHidden:we,onRenderHiddenFocus:()=>{const bt=_.current?.querySelector("[data-focus-layer-target='true']");if(bt){bt.focus();return}_.current?.focus()},accentKey:g.operationAccent[he.id]??IE(he),onActivate:()=>{Bi(he.id),!Ye&&!Ht&&!S&&Sb(he.id,g.operations[he.id]??he.geometry??Sv(he))},onClose:()=>{e.activeOperationId===he.id&&Bi(null),W===he.id&&Ka(),Ne===he.id&&Qs(),c(he.id)},onMinimize:()=>{e.activeOperationId===he.id&&Bi(null),qN(he.id)},onMaximize:()=>{Ye?Ka():(Bi(he.id),Q0(he.id))},onRename:bt=>{f(he.id,bt)},onSetAccent:bt=>{p(he.id,bt)},onGeometryChange:bt=>{!Ye&&!Ht&&!S&&Sb(he.id,bt)},onGeometryCommit:bt=>{!Ye&&!Ht&&!S&&BZ(he.id,Ga().operations[he.id]??bt)}})})}),Le?null:u.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[u.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),u.jsx("p",{children:e.activeTheaterId?xZ:"Add a Theater from the top bar to start operations."})]}),G.rubberBand?u.jsx(pZ,{rect:G.rubberBand,viewport:g.viewport}):null,T?u.jsx(LN,{anchor:T.anchor,viewportBounds:AZ(_.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:P,onClose:()=>N(null)},`${T.anchor.x}:${T.anchor.y}`):null,u.jsx(QX,{operations:M,pluginOperations:Object.fromEntries(k.filter(he=>!$.has(he.id)).map(he=>[he.id,{theaterId:he.theaterId,geometry:g.operations[he.id]??he.geometry??Sv(he)}])),accents:Object.fromEntries(k.flatMap(he=>{const Qe=g.operationAccent[he.id]??IE(he),Ye=Qe?qa(Qe):null;return Ye?[[he.id,Ye]]:[]})),viewport:g.viewport,canvasSize:H,onJump:he=>bb({x:H.width/2-he.x*g.viewport.zoom,y:H.height/2-he.y*g.viewport.zoom,zoom:g.viewport.zoom})})]})}function AZ(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function RZ(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Bi(null)}function NZ(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Sv(e){return e.geometry??{x:0,y:0,width:CZ,height:kZ,zIndex:0}}function LZ(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function DE(e,t,n,i){const r=Math.max(1,n),o=8,c=Math.max(0,(e.width-o*(r-1))/r);return{x:t*(c+o),y:0,width:c,height:Math.max(0,e.height),zIndex:i}}function MZ(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function OZ(){const[e,t]=y.useState(!1),n=y.useRef(new Set);return y.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=d=>{!jE(d)||d.repeat||d.ctrlKey||d.metaKey||RL()||(n.current.add(d.code),t(!0))},o=d=>{jE(d)&&(n.current.delete(d.code),t(n.current.size>0))},c=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",r),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",c)}},[]),e}function jE(e){return e.code==="AltLeft"||e.code==="AltRight"}function DZ(e){const t=e.flatMap(n=>n.kinds.filter(i=>i.disabled!==!0).map(i=>({pluginId:n.id,kind:i})));return t.find(({kind:n})=>n.type==="shell")??t[0]??null}function IE(e){return typeof e.accent=="string"?e.accent:null}function jZ(e,t){const n=t.operationKindRegistry.find(d=>d.pluginId===e.pluginId&&d.type===e.type),i=t.geometry;if(!n?.render)return null;const r=Xp(()=>{Qi(null).then(ms).catch(()=>{})}),o=d=>{d?(Bi(e.id),GN(e.id)):TV()},c=(d,f)=>{vV(e.id,d,f)};return u.jsxs(y.Fragment,{children:[u.jsx(oZ,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:u.jsx(Ff,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(BE,{active:t.active,keyboardFocusRequestId:t.keyboardFocusRequestId,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:c,render:n.render})})}),t.companions.map((d,f)=>u.jsx(IZ,{descriptor:d,geometry:t.companionGeometries[f],children:u.jsx(Ff,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin companion failed to render."}),children:u.jsx(BE,{active:t.active,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:c,render:d.render})})},d.id))]},e.id)}function BE({active:e,keyboardFocusRequestId:t,capabilities:n,geometry:i,operation:r,theme:o,viewportZoom:c,onActivate:d,onClose:f,onGeometryChange:p,onRequestCompanions:_,companionsOpen:g,hiddenCompanionPanelIds:b,onSetCompanionPanelVisible:S,render:w}){return w({operationId:r.id,theaterId:r.theaterId,pluginId:r.pluginId,type:r.type,operation:r,geometry:i,active:e,...t===void 0?{}:{keyboardFocusRequestId:t},zoom:c,theme:o,api:n.api,lifecycle:n.lifecycle,terminal:n.terminal,notifications:n.notifications,operations:n.operations,preferences:n.preferences,settings:n.settings,status:n.status,onActivate:d,onClose:f,onGeometryChange:p,onRequestCompanions:_,companionsOpen:g,hiddenCompanionPanelIds:b,onSetCompanionPanelVisible:S})}function IZ({descriptor:e,geometry:t,children:n}){const i={left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),zIndex:t.zIndex};return u.jsxs("article",{className:"canvas-operation canvas-companion-frame",style:i,"data-canvas-operation":!0,"aria-label":`Companion ${e.title}`,children:[e.hideCaption?null:u.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[u.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),u.jsx("span",{className:"canvas-companion-caption-title",children:e.title})]}),u.jsx("div",{className:"canvas-operation-terminal canvas-companion-body",onPointerDown:r=>r.stopPropagation(),onWheel:r=>r.stopPropagation(),"data-canvas-blocker":!0,children:n})]})}async function BZ(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function LL(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(n=>n.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function ML(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function OL(e,t){const n=[],i=[];for(const r of e)t.has(r.operationId)?i.push(r):n.push(r);return{hidden:n,visible:i}}function Nb(e){const t=new Map;for(const n of[...e].sort((i,r)=>r.lastRaisedSeq-i.lastRaisedSeq)){const i=n.theaterId??"__unknown__",r=t.get(i)??{theaterId:n.theaterId,theaterLabel:n.theaterLabel,notifications:[]};r.notifications.push(n),t.set(i,r)}return[...t.values()].sort((n,i)=>{const r=n.notifications[0]?.lastRaisedSeq??0;return(i.notifications[0]?.lastRaisedSeq??0)-r})}function DL(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const $Z={ended:"Ended","input-waiting":"Waiting for input"},PZ={id:"alerts",title:"Alerts",icon:()=>u.jsx(HZ,{}),render:()=>u.jsx(zZ,{})};function zZ(){const e=er(),t=cc(),[n,i]=y.useState(!1),r=y.useMemo(()=>ML(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=LL(e),c=OL(r,o).hidden,d=DL(c,e.notificationPreferences),f=Nb(d),p=Nb(c),_=Lb(f,"input-waiting"),g=Lb(f,"ended"),b=f.length===0,S=y.useCallback(w=>{ih(w.operationId),t("/operations")},[t]);return u.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[u.jsxs("div",{className:"alerts-panel-toolbar",children:[u.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[_>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:_}):null,g>0?u.jsx("span",{className:"notification-tally is-ended",children:g}):null,b?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${n?" is-active":""}`,onClick:()=>i(w=>!w),"aria-expanded":n,"aria-label":"Notification settings",title:"Notification settings",children:u.jsx(qZ,{})})]}),n?u.jsx(FZ,{groups:p}):null,b?u.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):u.jsx("div",{className:"notification-dock-deck",children:f.map(w=>u.jsxs("section",{className:"notification-cluster-group",children:[u.jsxs("header",{className:"notification-cluster-group-head",children:[u.jsx("span",{className:"notification-cluster-theater",children:w.theaterLabel}),u.jsx("span",{className:"notification-cluster-group-count",children:w.notifications.length})]}),u.jsx("ul",{className:"notification-cluster-roster",children:w.notifications.map(x=>u.jsxs("li",{className:`notification-row is-${x.kind}`,children:[u.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),u.jsxs("span",{className:"notification-row-body",children:[u.jsx("span",{className:"notification-row-op",children:x.operationLabel}),u.jsx("span",{className:"notification-row-state",children:$Z[x.kind]})]}),u.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>S(x),"aria-label":`Open ${w.theaterLabel} ${x.operationLabel}`,children:"Open"})]},x.operationId))})]},w.theaterId??"__unknown__"))})]})}function HZ(){const e=er();Z5();const t=y.useMemo(()=>ML(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=LL(e),i=OL(t,n).hidden,r=DL(i,e.notificationPreferences),o=Nb(r),c=o.reduce((p,_)=>p+_.notifications.length,0),d=Lb(o,"input-waiting"),f=c===0?"muted":d>0?"awaiting":"ended";return u.jsxs("span",{className:`alerts-icon is-${f}`,"aria-hidden":"true",children:[u.jsx(WZ,{}),c>0?u.jsx("span",{className:"alerts-icon-badge",children:c}):null]})}function FZ({groups:e}){const t=er(),n=UZ(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return u.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:i=>ED(i.currentTarget.checked)}),u.jsx("span",{children:"Mute all"})]}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:i=>TD(i.currentTarget.checked)}),u.jsx("span",{children:"Do not disturb"})]}),n.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,n.map(i=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:i.theaterId?t.notificationPreferences.mutedTheaterIds[i.theaterId]===!0:!1,onChange:()=>{i.theaterId&&AD(i.theaterId)}}),u.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function UZ(e,t,n){const i=new Map;for(const r of e)r.theaterId&&i.set(r.theaterId,r);for(const r of Object.keys(t))i.has(r)||i.set(r,{theaterId:r,theaterLabel:n.find(o=>o.id===r)?.label??r,notifications:[]});return[...i.values()]}function Lb(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function WZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[u.jsx("path",{d:"M8 2a4.5 4.5 0 0 0-4.5 4.5v2.25L2 10.5v.75h12v-.75l-1.5-1.75V6.5A4.5 4.5 0 0 0 8 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function qZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[u.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class u1 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function GZ(e,t){const i=new URLSearchParams().toString();return Xa(Kn(e,`/search${i?`?${i}`:""}`))}async function KZ(e,t,n){return Xa(Kn(e,`/entry/${encodeURIComponent(t)}`))}async function jL(e,t="pending"){return Xa(Kn(e,`/drydock?status=${encodeURIComponent(t)}`))}async function VZ(e,t){return Xa(Kn(e,`/drydock/${encodeURIComponent(t)}`))}async function YZ(e){return Xa(Kn(e,"/schema"))}async function XZ(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return Xa(Kn(e,n))}async function ZZ(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),lJ(Kn(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function JZ(e){return Xa(Kn(e,"/conflicts"))}async function QZ(e,t){return Xa(Kn(e,`/conflicts/${encodeURIComponent(t)}`))}async function eJ(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),IL(Kn(e,`/cowork/options?${i}`))}async function $E(e,t,n){return Za(Kn(e,"/cowork/sessions"),{entryId:t,...n})}async function tJ(e,t){try{return await IL(Kn(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof u1&&n.status===404)return null;throw n}}async function wv(e,t,n){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function nJ(e,t,n){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function PE(e,t,n){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function iJ(e,t,n){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function sJ(e,t){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function rJ(e,t,n){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function aJ(e,t){return Za(Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function oJ(e,t,n,i){const r=new EventSource(`${Kn(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=c=>{try{const d=JSON.parse(c.data);if(!cJ(d))return;i(d,Number(c.lastEventId)||0)}catch{}};for(const c of["session","transcript","tool","done","error"])r.addEventListener(c,o);return()=>r.close()}function Kn(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function Xa(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await $L(e,t));return t.json()}async function lJ(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await $L(e,n));return n.json()}async function IL(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await BL(t);return t.json()}async function Za(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await BL(n);return n.json()}async function BL(e){const t=await e.json().catch(()=>null);return new u1(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function cJ(e){if(!e||typeof e!="object")return!1;const t=e;return["session","transcript","tool","done","error"].includes(t.type??"")&&(t.session===void 0||t.session!==null&&typeof t.session=="object")}async function $L(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const Mb=new Set;let jf=0;const Jl={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function Bl(){return Jl}function PL(e){return Mb.add(e),()=>Mb.delete(e)}function zE(e){jf+=1,If({currentWorkspaceId:e,schemaCatalog:null})}async function wp(){const e=Jl.currentWorkspaceId,t=jf;If({loading:!0,error:null});try{const[n,i,r]=await Promise.all([GZ(e),jL(e,"pending").catch(()=>null),YZ(e).catch(()=>null)]);if(Jl.currentWorkspaceId!==e||jf!==t)return;If({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:r,loading:!1})}catch(n){if(Jl.currentWorkspaceId!==e||jf!==t)return;If({loading:!1,error:uJ(n)})}}function If(e){Object.assign(Jl,e);for(const t of Mb)t(Jl)}function uJ(e){return e instanceof Error?e.message:String(e)}const hJ=120;function $i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function dJ(e,t){if(!t)return $i(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?$i(e):$i(e.slice(0,n))+`<mark>${$i(e.slice(n,n+t.length))}</mark>`+$i(e.slice(n+t.length))}function fJ(e){return`<span class="codex-nav-tag">${$i(e)}</span>`}function pJ(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(fJ).join(""),o=$i(e.status??"current"),c=$i(e.updated??"");return`<button
|
|
230
|
-
class="codex-nav-entry${n?" is-current":""}"
|
|
231
|
-
data-entry-id="${$i(e.id)}"
|
|
232
|
-
type="button"
|
|
233
|
-
${n?'aria-current="page"':""}
|
|
234
|
-
title="${$i(e.title)}"
|
|
235
|
-
>
|
|
236
|
-
<span class="t">${dJ(e.title,i?"":t)}</span>
|
|
237
|
-
${r?`<span class="tg">${r}</span>`:""}
|
|
238
|
-
<span class="meta">${o} · ${c}</span>
|
|
239
|
-
</button>`}function mJ(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(i=>i.title.toLowerCase().includes(n)||i.tags.some(r=>r.toLowerCase().includes(n)))}function gJ(e,t){let n="",i=null,r="entries",o=null;e.innerHTML=`
|
|
240
|
-
<div class="codex-navigator">
|
|
241
|
-
<div class="codex-nav-modes" role="tablist" aria-label="Codex catalog">
|
|
242
|
-
<button type="button" role="tab" data-mode="entries" aria-selected="true">Entries</button>
|
|
243
|
-
<button type="button" role="tab" data-mode="schema" aria-selected="false">Schema</button>
|
|
244
|
-
</div>
|
|
245
|
-
<div class="codex-nav-search">
|
|
246
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
|
|
247
|
-
<input
|
|
248
|
-
class="codex-nav-search-input"
|
|
249
|
-
type="search"
|
|
250
|
-
placeholder="Search entries"
|
|
251
|
-
autocomplete="off"
|
|
252
|
-
spellcheck="false"
|
|
253
|
-
aria-label="Search Codex entries"
|
|
254
|
-
/>
|
|
255
|
-
</div>
|
|
256
|
-
<div class="codex-nav-quick-row">
|
|
257
|
-
<button class="codex-nav-quick" data-action="drydock" type="button">
|
|
258
|
-
Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
|
|
259
|
-
</button>
|
|
260
|
-
<button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
|
|
261
|
-
</div>
|
|
262
|
-
<div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
|
|
263
|
-
<div class="codex-navigator-scroll">
|
|
264
|
-
<div class="codex-nav-list" id="codex-nav-list"></div>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
`;const c=e.querySelector(".codex-nav-search-input"),d=e.querySelector("#codex-nav-list"),f=e.querySelector("#codex-nav-eyebrow"),p=e.querySelector("#codex-nav-drydock-badge");function _(w){if(e.querySelectorAll("[data-mode]").forEach(E=>E.setAttribute("aria-selected",String(E.dataset.mode===r))),c.hidden=r==="schema",r==="schema"){const E=w.schemaCatalog;f.textContent=`Schema · ${E?.templates.length??0} templates`,d.innerHTML=E?`
|
|
268
|
-
<button class="codex-nav-entry" type="button" ${E.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">Workspace schema</span><span class="meta">${E.schema.exists?$i(E.schema.ref):"Unavailable"}</span></button>
|
|
269
|
-
${E.templates.map(D=>`<button class="codex-nav-entry" type="button" data-template-id="${$i(D.id)}"><span class="t">${$i(D.id)}</span><span class="meta">${$i(D.ref)}</span></button>`).join("")}`:'<div class="codex-nav-empty">Schema catalog unavailable.</div>',p.textContent=String(w.pendingPatchCount);return}const x=mJ(w.index,n);if(f.textContent=`Entries · ${x.length}`,p.textContent=String(w.pendingPatchCount),p.hidden=w.pendingPatchCount===0,w.loading&&w.index.length===0){d.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(w.error){d.innerHTML=`<div class="codex-nav-error" role="alert">${$i(w.error)}</div>`;return}if(x.length===0){d.innerHTML=`<div class="codex-nav-empty">${n?"No entries match.":"No entries."}</div>`;return}d.innerHTML=x.map(E=>pJ(E,n,E.id===i)).join("")}function g(w){const x=w.target;if(!(x instanceof Element))return;const E=x.closest("[data-mode]");if(E?.dataset.mode==="entries"||E?.dataset.mode==="schema"){r=E.dataset.mode,_(Bl());return}if(x.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const j=x.closest("[data-template-id]");if(j?.dataset.templateId){t.onRequest({kind:"schema",templateId:j.dataset.templateId});return}const z=x.closest("[data-entry-id]");if(z?.dataset.entryId){i=z.dataset.entryId,_(Bl()),t.onRequest({kind:"entry",id:i});return}const T=x.closest("[data-action]");if(T?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(T?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function b(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=c.value,_(Bl())},hJ)}e.addEventListener("click",g),c.addEventListener("input",b);const S=PL(w=>_(w));return _(Bl()),{destroy(){S(),e.removeEventListener("click",g),c.removeEventListener("input",b),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(w){n="",i=null,c&&(c.value=""),_(Bl())}}}function _J(e,t){t.initialTheaterId&&zE(t.initialTheaterId);const n=gJ(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=PL(()=>{});wp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){zE(o),wp(),n.setTheater(o)}}}function wt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function mr(e){return wt(e).replace(/"/g,""")}function vJ(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${wt(i)}</span>`).join(""),n=bJ(e);return`
|
|
270
|
-
<div class="meta-chips">
|
|
271
|
-
${t}
|
|
272
|
-
${n}
|
|
273
|
-
<span class="chip">Updated ${wt(yJ(e.updated))}</span>
|
|
274
|
-
</div>
|
|
275
|
-
`}function zL(e){return e.map(t=>`<span class="chip chip-muted">${wt(t)}</span>`).join("")}function yJ(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function bJ(e){const t=SJ(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${mr(t.title)}">${wt(t.label)}</span>`:""}function SJ(e,t=new Date){const n=e.status,i=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return n==="deprecated"||n==="superseded"?{label:n,tone:"deprecated",title:i?`${n} · stale`:n}:i?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:n==="current"||n==="draft"?{label:n,tone:"neutral",title:n}:null}const wJ="active";function xv(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${mr(t.id)}" data-toc-id="${mr(t.id)}">${wt(t.text)}</a>`).join("")}function HE(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],r=new Set(t.map(p=>p.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(p=>r.has(p.id));if(i.length===0||o.length===0)return()=>{};const c=e.closest(".codex-reading-sheet-read"),d=new Set,f=new IntersectionObserver(p=>{for(const g of p){const b=g.target instanceof HTMLElement?g.target.id:"";b&&(g.isIntersecting?d.add(b):d.delete(b))}const _=xJ(o,d)??CJ(o,c)??o[0]?.id??null;FE(i,_)},{root:c,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const p of o)f.observe(p);return FE(i,o[0]?.id??null),()=>f.disconnect()}function xJ(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function CJ(e,t){const n=t?t.getBoundingClientRect().top:0;let i=null;for(const r of e)if(r.getBoundingClientRect().top-n<=80)i=r.id;else break;return i}function FE(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(wJ,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function xp(e){return`/entry/${encodeURIComponent(e)}`}const HL=1<<20;function kJ(e,t){const n=e.replace(/\r\n/g,`
|
|
276
|
-
`).split(`
|
|
277
|
-
`),i=t.replace(/\r\n/g,`
|
|
278
|
-
`).split(`
|
|
279
|
-
`),r=n.length+1,o=i.length+1;if(r*o>HL)return i.map((_,g)=>({text:_,changed:n[g]!==_}));const c=Array.from({length:r},()=>new Uint16Array(o));for(let _=n.length-1;_>=0;_-=1)for(let g=i.length-1;g>=0;g-=1)c[_][g]=n[_]===i[g]?c[_+1][g+1]+1:Math.max(c[_+1][g],c[_][g+1]);const d=[];let f=0,p=0;for(;p<i.length;)f<n.length&&n[f]===i[p]?(d.push({text:i[p],changed:!1}),f+=1,p+=1):f<n.length&&c[f+1][p]>=c[f][p+1]?f+=1:(d.push({text:i[p],changed:!0}),p+=1);return d}function EJ(e,t){const n=UE(e),i=UE(t),r=n.length+1,o=i.length+1,c=[];if(r*o>HL){const _=Math.max(n.length,i.length);for(let g=0;g<_;g+=1){const b=n[g],S=i[g];S!==void 0&&S===b?c.push({markdown:S,kind:"same"}):(b!==void 0&&c.push({markdown:b,kind:"removed"}),S!==void 0&&c.push({markdown:S,kind:"added"}))}return WE(c)}const d=Array.from({length:r},()=>new Uint16Array(o));for(let _=n.length-1;_>=0;_-=1)for(let g=i.length-1;g>=0;g-=1)d[_][g]=n[_]===i[g]?d[_+1][g+1]+1:Math.max(d[_+1][g],d[_][g+1]);let f=0,p=0;for(;f<n.length||p<i.length;)f<n.length&&p<i.length&&n[f]===i[p]?(c.push({markdown:i[p],kind:"same"}),f+=1,p+=1):f<n.length&&(p>=i.length||d[f+1][p]>=d[f][p+1])?(c.push({markdown:n[f],kind:"removed"}),f+=1):(c.push({markdown:i[p],kind:"added"}),p+=1);return WE(c)}function UE(e){const t=[];let n=[],i=null;for(const r of e.replace(/\r\n/g,`
|
|
280
|
-
`).split(`
|
|
281
|
-
`)){const o=r.trim();if(!i&&o===""){n.length&&(t.push(n.join(`
|
|
282
|
-
`)),n=[]);continue}if(n.push(r),i)o.startsWith(i)&&(i=null);else{const c=o.match(/^(`{3,}|~{3,})/);c&&(i=c[1])}}return n.length&&t.push(n.join(`
|
|
283
|
-
`)),t}function WE(e){const t=[];for(const n of e){const i=t[t.length-1];i&&i.kind===n.kind?t[t.length-1]={markdown:`${i.markdown}
|
|
284
|
-
|
|
285
|
-
${n.markdown}`,kind:i.kind}:t.push(n)}return t}const FL="fleet.codex.cowork.settings",TJ="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",AJ=32;function RJ(e){let t=!1,n=null,i=null,r=0,o={clis:[],models:[],efforts:[]},c=DJ(),d=[],f="",p="",_="",g=null,b="",S="idle",w=!1,x=null,E=!1,D=!1,j=!1,z=null,T=!1,N=!1,L=!1,H=null,F="",J="",pe="published",G=null,P=null;const A=()=>n?((!P||P.base!==n.baseDraft||P.draft!==n.draft)&&(P={base:n.baseDraft,draft:n.draft,lines:kJ(n.baseDraft,n.draft)}),P.lines):[],$=e.body.innerHTML,M=document.createElement("div");M.className="cowork-anchor";const k=document.createElement("div");k.className="cowork-dock-zone";const B=document.createElement("div");B.className="cowork-tip",B.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(M,k,B);const O=()=>{if(t)return;const ie=!!n&&n.state!=="closed",le=ie?T?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(le!==pe){if(pe=le,!ie){e.body.innerHTML=$;return}e.body.innerHTML=T?`<div class="cowork-rendered-diff" aria-label="Draft changes">${LJ(kv(n.baseDraft),kv(n.draft))}</div>`:$s(kv(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:Pe=>xp(Pe)}).html}},W=()=>{if(t)return;if(!x){M.innerHTML="";return}const ie=e.article.getBoundingClientRect().width||0,le=E?Math.min(340,ie*.86)/2+8:56,Pe=Math.min(Math.max(x.left,le),Math.max(ie-le,le)),De=`style="top:${x.top}px;left:${Pe}px"`;M.innerHTML=E?`<div class="cowork-composer" ${De} role="dialog" aria-label="Add a comment">
|
|
286
|
-
<blockquote>${wt(GE(x.quote,140))}</blockquote>
|
|
287
|
-
<textarea class="cowork-composer-input" rows="2" placeholder="What should change here?" aria-label="Comment"></textarea>
|
|
288
|
-
<div class="cowork-composer-actions">
|
|
289
|
-
<button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">Cancel</button>
|
|
290
|
-
<button type="button" class="cowork-solid" data-cowork-action="add-comment">Add</button>
|
|
291
|
-
</div>
|
|
292
|
-
</div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${De}><span aria-hidden="true">✦</span>Comment</button>`,E&&M.querySelector(".cowork-composer-input")?.focus()},U=()=>{if(t)return;const ie=!!n&&n.state!=="closed"&&n.state!=="applied";k.classList.add("is-open");const le=L||ie&&n.state==="running"&&S!=="complete"&&S!=="stopped";e.body.classList.toggle("is-cowork-running",le);const Pe=ie&&n.baseDraft!==n.draft,De=Pe?A().filter(Ue=>Ue.changed).length:0;ke(`
|
|
293
|
-
${R(le)}
|
|
294
|
-
${D?Ne():""}
|
|
295
|
-
${j?Re():""}
|
|
296
|
-
${Pe&&!le?ot(De):""}
|
|
297
|
-
<div class="cowork-bar${le?" is-running":""}" data-cowork-form>
|
|
298
|
-
${le?'<span class="cowork-glow" aria-hidden="true"></span>':""}
|
|
299
|
-
<button type="button" class="cowork-chip${D?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${D}" aria-label="Annotations" ${le?"disabled":""}><span aria-hidden="true">✦</span>${d.length}</button>
|
|
300
|
-
<input class="cowork-dock-input" name="prompt" value="${mr(F)}" placeholder="${d.length?"Add an instruction (optional)…":"Ask AI to revise this entry…"}" aria-label="Instruction" ${le?"disabled":""}>
|
|
301
|
-
<button type="button" class="cowork-chip cowork-chip--config${j?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${j}" aria-label="Agent settings" ${le?"disabled":""}>${wt(c.cli||"agent")}</button>
|
|
302
|
-
${le?'<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="Stop"><span aria-hidden="true"></span></button>':'<button type="button" class="cowork-send" data-cowork-action="send" aria-label="Send to AI">↑</button>'}
|
|
303
|
-
</div>
|
|
304
|
-
${J?`<p class="cowork-error" role="alert">${wt(J)}</p>`:""}`)},R=ie=>{if(!(ie||S!=="idle"))return"";const Pe=ie?"running":S,De=ie?"Editing entry":S==="complete"?"Revision complete":"Revision stopped",Ue=!!(b||f||ie);return`<section class="cowork-revision-stream is-${Pe}${w?" is-collapsed":""}" aria-label="Cowork revision stream">
|
|
305
|
-
${ie?'<span class="cowork-revision-scan" aria-hidden="true"></span>':""}
|
|
306
|
-
<header class="cowork-revision-head"><span class="cowork-revision-mark" aria-hidden="true">✳</span><span class="cowork-revision-copy"><strong>Cowork</strong><small>${De}</small></span>${Ue?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!w}" aria-label="${w?"Expand":"Collapse"} Cowork stream"><span aria-hidden="true"></span></button>`:""}</header>
|
|
307
|
-
${Ue?`<div class="cowork-revision-content" aria-hidden="${w}"><div class="cowork-revision-content-inner">
|
|
308
|
-
${b||f?`<div class="cowork-revision-body">
|
|
309
|
-
${b?`<p class="cowork-revision-instruction">${wt(b)}</p>`:""}
|
|
310
|
-
${f?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${_}</div></div>`:""}
|
|
311
|
-
</div>`:""}
|
|
312
|
-
${ie?'<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>Writing revision</strong></span></footer>':""}
|
|
313
|
-
</div></div>`:""}
|
|
314
|
-
</section>`},Y=()=>{g!==null&&window.clearTimeout(g),g=null},Z=()=>{p!==f&&(p=f,_=f?$s(f).html:"")},me=()=>{Z();const ie=k.querySelector(".cowork-revision-output");if(!ie){U();return}ie.innerHTML=_;const le=ie.closest(".cowork-revision-output-scroll");le&&(le.scrollTop=le.scrollHeight)},ue=()=>{g===null&&(g=window.setTimeout(()=>{g=null,t||me()},AJ))},oe=()=>{Y(),Z()},ke=ie=>{if(ie===G)return;G=ie;const le=document.activeElement,Pe=le instanceof HTMLInputElement&&le.name==="prompt"&&k.contains(le)?"prompt":le instanceof HTMLTextAreaElement&&le.dataset.coworkComment&&k.contains(le)?`comment:${le.dataset.coworkComment}`:null;if(k.innerHTML=ie,Pe==="prompt"){const De=k.querySelector(".cowork-dock-input");De?.focus(),De?.setSelectionRange(De.value.length,De.value.length)}else if(Pe?.startsWith("comment:")){const De=k.querySelector(`[data-cowork-comment="${CSS.escape(Pe.slice(8))}"]`);De?.focus(),De?.setSelectionRange(De.value.length,De.value.length)}},Ne=()=>`
|
|
315
|
-
<div class="cowork-popover cowork-panel" role="region" aria-label="Annotations">
|
|
316
|
-
${d.length===0?'<p class="cowork-empty">Select text in the document to add a comment.</p>':d.map(ie=>`
|
|
317
|
-
<article class="cowork-card is-${ie.status}">
|
|
318
|
-
<blockquote>${wt(GE(ie.quote,160))}</blockquote>
|
|
319
|
-
<textarea data-cowork-comment="${mr(ie.id)}" aria-label="Comment" placeholder="Add a comment" ${ie.status==="sent"?"disabled":""}>${wt(ie.comment)}</textarea>
|
|
320
|
-
<footer><span class="cowork-card-status">${ie.status==="sent"?"Sent":ie.status==="done"?"Done":"Ready"}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${mr(ie.id)}" aria-label="Delete annotation">×</button></footer>
|
|
321
|
-
</article>`).join("")}
|
|
322
|
-
</div>`,Re=()=>`
|
|
323
|
-
<div class="cowork-popover cowork-config" role="region" aria-label="Agent settings">
|
|
324
|
-
${Cv("CLI","cli",o.clis,c.cli)}${Cv("Model","model",o.models,c.model)}${Cv("Effort","effort",o.efforts,c.effort)}
|
|
325
|
-
</div>`,ot=ie=>z?`<div class="cowork-review is-confirm"><span>${z==="apply"?"Apply these changes to the entry?":"Discard this draft?"}</span><button type="button" class="cowork-solid${z==="discard"?" cowork-solid--danger":""}" data-cowork-action="${z==="apply"?"apply-confirm":"discard-confirm"}">${z==="apply"?"Apply":"Discard"}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">Back</button></div>`:`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${ie>0?`${ie} changed line${ie===1?"":"s"}`:"Removed content"}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${T?"View draft":"View diff"}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">Apply</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">Discard</button></div>`,Le=()=>{if(!t){for(const ie of[...e.body.querySelectorAll("mark.cowork-mark")]){const le=ie.parentNode;if(le){for(;ie.firstChild;)le.insertBefore(ie.firstChild,ie);le.removeChild(ie)}}if(e.body.normalize(),!T)for(const ie of d)ie.quote&&Se(ie)}},Se=ie=>{const le=[],Pe=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let Ot=Pe.nextNode();Ot;Ot=Pe.nextNode())le.push(Ot);let De="";const Ue=[];for(const Ot of le)Ue.push(De.length),De+=Ot.data;const Mt=De.indexOf(ie.quote);if(Mt<0)return;const Ni=Mt+ie.quote.length;for(let Ot=0;Ot<le.length;Ot+=1){const Bn=Ue[Ot],Gt=Bn+le[Ot].data.length,K=Math.max(Mt,Bn),de=Math.min(Ni,Gt);if(K>=de)continue;const ye=document.createRange();ye.setStart(le[Ot],K-Bn),ye.setEnd(le[Ot],de-Bn);const He=document.createElement("mark");He.className="cowork-mark",He.dataset.annotationId=ie.id;try{ye.surroundContents(He)}catch{}}},xe=ie=>{const le=d.find(Mt=>Mt.id===ie.dataset.annotationId);if(!le){B.hidden=!0;return}B.textContent=le.comment.trim()||"No comment yet",B.hidden=!1;const Pe=ie.getBoundingClientRect(),De=e.article.getBoundingClientRect(),Ue=B.offsetWidth/2+8;B.style.top=`${Math.max(Pe.top-De.top-6,0)}px`,B.style.left=`${Math.min(Math.max(Pe.left+Pe.width/2-De.left,Ue),Math.max(De.width-Ue,Ue))}px`},Me=()=>{O(),U(),Le()},Ke=async()=>{o=await eJ(e.theaterId,c.cli,c.model||void 0);const ie=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",le=o.defaultEffort&&o.efforts.includes(o.defaultEffort)?o.defaultEffort:o.efforts[0]??"";c={cli:o.clis.includes(c.cli)?c.cli:o.clis[0]??"",model:o.models.includes(c.model)?c.model:ie,effort:o.efforts.includes(c.effort)?c.effort:le},Ev(c)},it=async ie=>{n=ie;const le=ie.annotations.map(MJ),Pe=new Set(le.map(De=>De.id));d=[...le,...d.filter(De=>!Pe.has(De.id))],(ie.cli||ie.model||ie.effort)&&(c={cli:ie.cli??c.cli,model:ie.model??c.model,effort:ie.effort??c.effort},Ev(c));try{await Ke()}catch{}if(!t){if(n&&(n.cli!==c.cli||n.model!==c.model||n.effort!==c.effort))try{n=await wv(e.theaterId,n.id,c)}catch{}t||(he(),Me())}},Ge=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const ie=await $E(e.theaterId,e.entryId,c);return await it(ie),ie};U(),Ke().then(U).catch(()=>{}),(async()=>{try{const ie=await tJ(e.theaterId,e.entryId);!t&&ie&&await it(ie)}catch{}})();function he(){n&&(i?.(),i=oJ(e.theaterId,n.id,r,(ie,le)=>{if(le&&le<=r)return;r=Math.max(r,le);const Pe=n?.state==="running";if(ie.session&&(n=ie.session),ie.type==="transcript"&&ie.text&&n?.state==="running"){f=S==="running"?f+ie.text:ie.text,S="running",ue();return}ie.type==="done"&&(oe(),(!H?.cancelled||H.submitted)&&(S=Pe||N||S==="stopped"||!!f||!!b?"complete":"idle",d=d.map(Ue=>Ue.status==="sent"?{...Ue,status:"done"}:Ue),N&&(N=!1,n&&n.baseDraft!==n.draft&&(T=!0)))),(ie.type==="error"||ie.type==="session"&&Pe&&n?.state!=="running")&&(oe(),S="stopped",N=!1,d=d.map(De=>De.status==="sent"?{...De,status:"pending"}:De)),ie.type==="error"&&ie.text&&(J=ie.text),Me()}))}async function Qe(ie,le){d=[...d,{id:OJ(),quote:ie,comment:le,status:"pending"}],x=null,E=!1,W(),U(),Le();try{await Ge(),await st(()=>nJ(e.theaterId,n.id,ie)),await Ht()}catch{}}async function Ye(ie){d=d.filter(le=>le.id!==ie),U(),Le(),B.hidden=!0;try{await Ht()}catch{}}async function Ht(){n&&await st(()=>PE(e.theaterId,n.id,d.map(qE)))}async function we(){if(L||n?.state==="running")return;const ie=d.filter(Ue=>Ue.status!=="done"),le=F.trim(),Pe=le||(ie.length?TJ:"");if(!Pe)return;const De={cancelled:!1,submitted:!1};H=De,L=!0,d=ie.map(Ue=>({...Ue,status:"sent"})),Y(),f="",p="",_="",b=le,S="running",w=!1,F="",D=!1,j=!1,U(),Le();try{if(await Ge(),De.cancelled||H!==De||(await st(()=>PE(e.theaterId,n.id,d.map(qE))),De.cancelled||H!==De))return;De.submitted=!0,await st(()=>iJ(e.theaterId,n.id,Pe)),N=!0}catch{!De.cancelled&&H===De&&(N=!1,S="idle",d=d.map(Ue=>Ue.status==="sent"?{...Ue,status:"pending"}:Ue))}finally{!De.cancelled&&H===De&&(L=!1,H=null,U())}}async function Je(){if(!n)return;const ie=n.id;try{J="",await aJ(e.theaterId,ie)}catch(le){J=le instanceof Error?le.message:"Cowork request failed.",U();return}i?.(),i=null,r=0,d=[],Y(),f="",p="",_="",b="",S="idle",w=!1,z=null,T=!1;try{await it(await $E(e.theaterId,e.entryId,c))}catch{n=null,Me()}}async function st(ie){try{J="",n=await ie(),Me()}catch(le){throw J=le instanceof u1&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(le.code)?"This entry changed or is busy. Your draft is safe; reopen the entry before applying.":le instanceof Error?le.message:"Cowork request failed.",Me(),le}}const Vn=ie=>{if(E||n?.state==="running"||ie.target instanceof Node&&M.contains(ie.target))return;const le=window.getSelection(),Pe=le?.toString().trim()??"";if(!Pe||!le||le.rangeCount===0||!e.body.contains(le.anchorNode))return;const De=le.getRangeAt(0).getBoundingClientRect(),Ue=e.article.getBoundingClientRect();x={quote:Pe,top:De.bottom-Ue.top+8,left:Math.min(Math.max(De.left+De.width/2-Ue.left,0),Math.max(Ue.width,0))},W()},bt=ie=>{if(ie.target instanceof Element){if(ie.target.closest(".cowork-pill")){ie.preventDefault();return}!M.contains(ie.target)&&x&&(x=null,E=!1,W())}},Ee=ie=>{if(ie.target instanceof Element&&ie.target.closest(".cowork-revision-output")){ie.stopPropagation();return}if(ie.key==="Escape"){x||E?(x=null,E=!1,W()):(D||j||z)&&(D=!1,j=!1,z=null,U());return}const le=ie.target;ie.key==="Enter"&&!ie.shiftKey&&le instanceof HTMLTextAreaElement&&le.classList.contains("cowork-composer-input")&&(ie.preventDefault(),ft()),ie.key==="Enter"&&le instanceof HTMLInputElement&&le.name==="prompt"&&(ie.preventDefault(),we())},ft=()=>{const ie=M.querySelector(".cowork-composer-input")?.value.trim()??"";x&&Qe(x.quote,ie)},pn=ie=>{if(!(ie.target instanceof Element))return;const le=ie.target.closest(".cowork-revision-output");le&&ie.stopPropagation();const Pe=ie.target.closest('[data-action="copy-code"]');if(Pe){const Mt=Pe.closest("pre")?.getAttribute("data-code");if(!Mt)return;NJ(Pe,Mt);return}if(le)return;const De=ie.target.closest("[data-cowork-action]");if(!De)return;const Ue=De.dataset.coworkAction;if(Ue==="comment"&&(E=!0,W()),Ue==="cancel-comment"&&(x=null,E=!1,W()),Ue==="add-comment"&&ft(),Ue==="toggle-panel"&&(D=!D,j=!1,U()),Ue==="toggle-config"&&(j=!j,D=!1,U()),Ue==="toggle-revision"){w=!w;const Mt=De.closest(".cowork-revision-stream");Mt?.classList.toggle("is-collapsed",w),De.setAttribute("aria-expanded",String(!w)),De.setAttribute("aria-label",`${w?"Expand":"Collapse"} Cowork stream`),Mt?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(w))}if(Ue==="send"&&we(),Ue==="cancel-run"&&L&&H&&!H.submitted){H.cancelled=!0,L=!1,N=!1,S="stopped",d=d.map(Mt=>Mt.status==="sent"?{...Mt,status:"pending"}:Mt),U(),Le();return}Ue==="toggle-diff"&&(T=!T,Me()),Ue==="delete-annotation"&&De.dataset.annotationId&&Ye(De.dataset.annotationId),Ue==="apply-arm"&&(z="apply",U()),Ue==="discard-arm"&&(z="discard",U()),Ue==="confirm-back"&&(z=null,U()),Ue==="apply-confirm"&&n&&(z=null,st(()=>rJ(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Ue==="discard-confirm"&&Je(),Ue==="cancel-run"&&n&&st(()=>sJ(e.theaterId,n.id)).then(()=>{S="stopped",d=d.map(Mt=>Mt.status==="sent"?{...Mt,status:"pending"}:Mt),U()}).catch(()=>{})},Ci=ie=>{const le=ie.target instanceof Element?ie.target.closest("mark.cowork-mark"):null;le?xe(le):B.hidden||(B.hidden=!0)},In=()=>{B.hidden=!0},Mn=ie=>{const le=ie.target;if(le instanceof Element&&le.closest(".cowork-revision-output")){ie.stopPropagation();return}if(le instanceof HTMLInputElement&&le.name==="prompt"){F=le.value;return}if(le instanceof HTMLTextAreaElement&&le.dataset.coworkComment){const Pe=le.dataset.coworkComment;d=d.map(De=>De.id===Pe?{...De,comment:le.value,status:"pending"}:De)}},mn=ie=>{const le=ie.target;if(le instanceof Element&&le.closest(".cowork-revision-output")){ie.stopPropagation();return}if(le instanceof HTMLSelectElement&&["cli","model","effort"].includes(le.name)){if(c=le.name==="cli"?{cli:le.value,model:"",effort:""}:{...c,[le.name]:le.value},Ev(c),!n){le.name!=="effort"&&Ke().then(U).catch(()=>{});return}le.name!=="effort"?Ke().then(()=>st(()=>wv(e.theaterId,n.id,c))).then(U).catch(Pe=>{J=Pe instanceof Error?Pe.message:"Cowork request failed.",U()}):st(()=>wv(e.theaterId,n.id,c)).catch(()=>{});return}le instanceof HTMLTextAreaElement&&le.dataset.coworkComment&&Ht().catch(()=>{})};return e.article.addEventListener("mouseup",Vn),e.article.addEventListener("mousedown",bt),e.article.addEventListener("keydown",Ee),e.article.addEventListener("click",pn),e.article.addEventListener("input",Mn),e.article.addEventListener("change",mn),e.article.addEventListener("mouseover",Ci),e.article.addEventListener("mouseleave",In),{destroy(){t=!0,Y(),i?.(),e.article.removeEventListener("mouseup",Vn),e.article.removeEventListener("mousedown",bt),e.article.removeEventListener("keydown",Ee),e.article.removeEventListener("click",pn),e.article.removeEventListener("input",Mn),e.article.removeEventListener("change",mn),e.article.removeEventListener("mouseover",Ci),e.article.removeEventListener("mouseleave",In),M.remove(),k.remove(),B.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function Cv(e,t,n,i){return`<label class="cowork-selector"><span>${e}</span><select name="${t}" ${n.length?"":"disabled"}>${n.map(r=>`<option value="${mr(r)}" ${r===i?"selected":""}>${wt(r)}</option>`).join("")}</select></label>`}function NJ(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function LJ(e,t){return EJ(e,t).map(n=>{const i=$s(n.markdown,{resolveWikiLink:r=>xp(r)}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function qE(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||"Please revise this passage."}}function MJ(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function kv(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function GE(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function OJ(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function DJ(){try{const e=JSON.parse(localStorage.getItem(FL)??"{}");return{cli:typeof e.cli=="string"?e.cli:"claude",model:typeof e.model=="string"?e.model:"",effort:typeof e.effort=="string"?e.effort:"medium"}}catch{return{cli:"claude",model:"",effort:"medium"}}}function Ev(e){try{localStorage.setItem(FL,JSON.stringify(e))}catch{}}const UL={create_wiki:"+",update_wiki:"↻"},WL={create_wiki:"Create",update_wiki:"Update"};function jJ(e,t){let n=!1,i=0,r=null,o=null,c=t,d="idle",f=null,p=null,_=null;zp(e);function g(T){const N=T.target;if(!(N instanceof Element))return;const L=N.closest("[data-patch-id]");if(L){T.preventDefault();const J=L.dataset.patchId||void 0;c.onPatchOpen?.(J);return}const H=N.closest("[data-entry-id]");if(H?.dataset.entryId){T.preventDefault(),c.onRelatedClick(H.dataset.entryId);return}const F=N.closest("[data-drydock-action]");if(F){T.preventDefault(),b(F.dataset.drydockAction);return}}function b(T){if(T){if(T==="back"){c.onPatchOpen?.(void 0);return}if(T==="approve"){d="approving",f=null,w();return}if(T==="approve-confirm"){S("approve",void 0);return}if(T==="reject"){d="rejecting",f=null,w();return}if(T==="reject-submit"){const N=e.querySelector("#queue-reject-reason")?.value.trim();if(!N){f="Rejection reason is required.",w();return}S("reject",N);return}if(T==="cancel"){d="idle",f=null,w();return}}}async function S(T,N){if(_){d="submitting",f=null,w();try{await ZZ(c.theaterId,_,T,N),c.onDecided?.()}catch(L){d=T==="approve"?"approving":"rejecting",f=L instanceof Error?L.message:String(L),w()}}}function w(){const T=e.querySelector("[data-decision-bar-wrap]");T&&(T.innerHTML=qL(d,f))}e.addEventListener("click",g);function x(){o?.destroy(),o=null,r?.(),r=null}async function E(T){if(!n){pf(e,t.tocContainer),x();try{const N=await KZ(c.theaterId,T);if(n)return;const{index:L}=Bl(),{html:H,toc:F}=$s(N.body,{omitDuplicateTitle:N.frontmatter.title,resolveWikiLink:G=>xp(G)});e.innerHTML=`
|
|
326
|
-
<article class="document">
|
|
327
|
-
<header class="document-header">
|
|
328
|
-
${IJ(N.frontmatter.title)}
|
|
329
|
-
<h1>${wt(N.frontmatter.title)}</h1>
|
|
330
|
-
${vJ(N.frontmatter)}
|
|
331
|
-
</header>
|
|
332
|
-
<div class="markdown-body" id="codex-reader-body">
|
|
333
|
-
${H}
|
|
334
|
-
</div>
|
|
335
|
-
${BJ(N.frontmatter.id,N.frontmatter.tags,L)}
|
|
336
|
-
</article>
|
|
337
|
-
`,t.tocContainer.innerHTML=xv(F);const J=e.querySelector("article");J&&F.length>0&&(r=HE(J,F,t.tocContainer));const pe=e.querySelector("#codex-reader-body");J&&pe&&(o=RJ({theaterId:c.theaterId,entryId:T,title:N.frontmatter.title,article:J,body:pe,onApplied:()=>{E(T)}}))}catch(N){n||mf(e,t.tocContainer,N)}}}async function D(T){if(!n){pf(e,t.tocContainer),x(),p=null,_=null,d="idle",f=null;try{if(T){const N=await VZ(c.theaterId,T);if(n)return;p=N.meta,_=T;const{html:L,toc:H}=$s(N.wikiEntry.body,{omitDuplicateTitle:N.wikiEntry.title,resolveWikiLink:J=>xp(J)});e.innerHTML=zJ(N,L),t.tocContainer.innerHTML=xv(H);const F=e.querySelector("article");F&&H.length>0&&(r=HE(F,H,t.tocContainer))}else{const N=await jL(c.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=$J(N.items,"Review queue — Pending patches")}}catch(N){n||mf(e,t.tocContainer,N)}}}async function j(T){if(!n){pf(e,t.tocContainer),x();try{if(T){const N=await QZ(c.theaterId,T);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=UJ(N)}else{const N=await JZ(c.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=WJ(N)}}catch(N){n||mf(e,t.tocContainer,N)}}}async function z(T){const N=++i,L=c.theaterId;pf(e,t.tocContainer),x();try{const H=await XZ(L,T);if(n||N!==i||L!==c.theaterId)return;const{html:F,toc:J}=$s(H.content);e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>Schema</span></li><li><span aria-current="page">${wt(T??"Workspace schema")}</span></li></ol></nav><h1>${wt(T??"Workspace schema")}</h1><span class="queue-dl-mono">${wt(H.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${F}</div></article>`,t.tocContainer.innerHTML=xv(J)}catch(H){!n&&N===i&&L===c.theaterId&&mf(e,t.tocContainer,H)}}return t.kind==="entry"&&t.initialEntryId?E(t.initialEntryId):t.kind==="drydock"?D(t.subId):t.kind==="conflicts"?j(t.subId):t.kind==="schema"&&z(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",g),x(),o?.destroy()},async setEntry(T){await E(T)},async navigateSub(T){t.kind==="drydock"?await D(T):t.kind==="conflicts"?await j(T):t.kind==="schema"&&await z(T)},refreshCallbacks(T){c={...c,...T}}}}function pf(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function mf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${wt(i)}</div>`,t.innerHTML=""}function IJ(e){return`
|
|
338
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
339
|
-
<ol>
|
|
340
|
-
<li><span>Codex</span></li>
|
|
341
|
-
<li><span aria-current="page">${wt(e)}</span></li>
|
|
342
|
-
</ol>
|
|
343
|
-
</nav>
|
|
344
|
-
`}function BJ(e,t,n){const i=new Set(t),r=n.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(c=>i.has(c))})).filter(o=>o.matchingTags.length>0).sort((o,c)=>c.matchingTags.length-o.matchingTags.length||o.entry.title.localeCompare(c.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return r.length===0?"":`
|
|
345
|
-
<section class="related-list">
|
|
346
|
-
<h2>Related entries</h2>
|
|
347
|
-
<div class="related-items">
|
|
348
|
-
${r.map(o=>`<button class="related-card" type="button" data-entry-id="${mr(o.entry.id)}">
|
|
349
|
-
<strong>${wt(o.entry.title)}</strong>
|
|
350
|
-
<span>${zL(o.matchingTags)}</span>
|
|
351
|
-
</button>`).join("")}
|
|
352
|
-
</div>
|
|
353
|
-
</section>
|
|
354
|
-
`}function $J(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
355
|
-
<article class="document">
|
|
356
|
-
<header class="document-header">
|
|
357
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
358
|
-
<ol>
|
|
359
|
-
<li><span>Codex</span></li>
|
|
360
|
-
<li><span aria-current="page">Review queue</span></li>
|
|
361
|
-
</ol>
|
|
362
|
-
</nav>
|
|
363
|
-
<h1>${wt(t)}</h1>
|
|
364
|
-
</header>
|
|
365
|
-
<div class="queue-row-list">
|
|
366
|
-
${e.map(PJ).join("")}
|
|
367
|
-
</div>
|
|
368
|
-
</article>
|
|
369
|
-
`}function PJ(e){const t=e.op??"create_wiki",n=UL[t]??"?",i=WL[t]??"Patch",r=e.target??e.id,c=[qJ(e.meta.createdAt)].filter(Boolean);return`
|
|
370
|
-
<button class="queue-row" type="button" data-patch-id="${mr(e.id)}" aria-label="${mr(i+": "+r)}">
|
|
371
|
-
<span class="queue-row-badge" aria-hidden="true">
|
|
372
|
-
<span class="op-badge">${n}</span>
|
|
373
|
-
</span>
|
|
374
|
-
<span class="queue-row-body">
|
|
375
|
-
<span class="queue-row-target">${wt(r)}</span>
|
|
376
|
-
${e.summary?`<span class="queue-row-summary">${wt(e.summary)}</span>`:""}
|
|
377
|
-
${c.length>0?`<span class="queue-row-meta">${c.map(wt).join(" · ")}</span>`:""}
|
|
378
|
-
</span>
|
|
379
|
-
</button>
|
|
380
|
-
`}function zJ(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,c=n.frontmatter.op,d=UL[c]??"?",f=WL[c]??"Patch",p=o?"기존 문서 대체":"신규 문서 생성",_=i.status==="pending";return`
|
|
381
|
-
<article class="document">
|
|
382
|
-
<header class="document-header">
|
|
383
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
384
|
-
<ol>
|
|
385
|
-
<li><span>Codex</span></li>
|
|
386
|
-
<li><span>Review queue</span></li>
|
|
387
|
-
<li><span aria-current="page">${wt(f)}</span></li>
|
|
388
|
-
</ol>
|
|
389
|
-
</nav>
|
|
390
|
-
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
391
|
-
<h1><span class="op-badge">${d}</span> ${wt(r.title)}</h1>
|
|
392
|
-
<p class="eyebrow">${wt(n.frontmatter.target)} · v${r.version} · ${wt(p)}</p>
|
|
393
|
-
${HJ(n.frontmatter.proposer,r.tags)}
|
|
394
|
-
</header>
|
|
395
|
-
<div class="markdown-body" id="codex-reader-body">
|
|
396
|
-
${t}
|
|
397
|
-
</div>
|
|
398
|
-
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
399
|
-
${_?qL("idle",null):FJ(i)}
|
|
400
|
-
</div>
|
|
401
|
-
</article>
|
|
402
|
-
`}function HJ(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${wt(e)}</span>`),t.length>0&&n.push(zL(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function qL(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
403
|
-
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
404
|
-
<div class="queue-action-buttons">
|
|
405
|
-
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
406
|
-
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
407
|
-
</div>
|
|
408
|
-
${t?`<p class="queue-action-error">${wt(t)}</p>`:""}
|
|
409
|
-
`:e==="rejecting"?`
|
|
410
|
-
<div class="queue-reject-form">
|
|
411
|
-
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
412
|
-
<div class="queue-action-buttons">
|
|
413
|
-
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
414
|
-
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
415
|
-
</div>
|
|
416
|
-
${t?`<p class="queue-action-error">${wt(t)}</p>`:""}
|
|
417
|
-
</div>
|
|
418
|
-
`:`
|
|
419
|
-
<div class="queue-action-buttons">
|
|
420
|
-
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
421
|
-
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
422
|
-
</div>
|
|
423
|
-
`}function FJ(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${wt(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function UJ(e){return`
|
|
424
|
-
<article class="document">
|
|
425
|
-
<header class="document-header">
|
|
426
|
-
<nav class="breadcrumb" aria-label="Entry location">
|
|
427
|
-
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
428
|
-
</nav>
|
|
429
|
-
<h1>${wt(e.id)}</h1>
|
|
430
|
-
<p class="eyebrow">Conflict · ${wt(e.meta?.status??"open")}</p>
|
|
431
|
-
</header>
|
|
432
|
-
<div class="markdown-body">
|
|
433
|
-
${e.current?`<h2>Current</h2><pre><code>${wt(e.current)}</code></pre>`:""}
|
|
434
|
-
${e.proposed?`<h2>Proposed</h2><pre><code>${wt(e.proposed)}</code></pre>`:""}
|
|
435
|
-
</div>
|
|
436
|
-
</article>
|
|
437
|
-
`}function WJ(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
438
|
-
<article class="document">
|
|
439
|
-
<header class="document-header">
|
|
440
|
-
<h1>Conflicts</h1>
|
|
441
|
-
</header>
|
|
442
|
-
<div class="markdown-body">
|
|
443
|
-
<ul class="queue-list">
|
|
444
|
-
${e.map(t=>`<li class="queue-item">
|
|
445
|
-
<strong>${wt(t.title||t.id)}</strong>
|
|
446
|
-
<span class="eyebrow">${wt(t.status)}</span>
|
|
447
|
-
</li>`).join("")}
|
|
448
|
-
</ul>
|
|
449
|
-
</div>
|
|
450
|
-
</article>
|
|
451
|
-
`}function qJ(e){try{const n=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(n<1)return"< 1h ago";if(n<24)return`${Math.floor(n)}h ago`;const i=n/24;return i<7?`${Math.floor(i)}d ago`:i<30?`${Math.floor(i/7)}w ago`:`${Math.floor(i/30)}mo ago`}catch{return""}}let To=null,_h=null,GL=null,za=null,Ao=null,Ba=null,Bf=null,Tv=null,$f,Ob=0;function KE(e){GL=e}function GJ(e,t){const n=YJ();n.parentElement!==e&&e.appendChild(n),_h||(_h=_J(n,{initialTheaterId:t,onRequest:i=>GL?.(i)}))}function KJ(e){_h?.setTheater(e)}function KL(e,t,n){const i=XJ(),r=ZJ(),o=i.parentElement,c=n.kind==="entry"&&Bf==="entry"&&n.initialEntryId===Tv;o&&o!==e&&(Ob=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!Ba||Bf!==n.kind?(Ba?.destroy(),Ba=jJ(i,{...n,tocContainer:r}),Bf=n.kind,$f=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==Tv?Ba.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==$f&&($f=n.subId,Ba.navigateSub(n.subId)),Tv=n.kind==="entry"?n.initialEntryId??null:null,Ba.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=c?Ob:0;requestAnimationFrame(()=>{e.scrollTop=d})}function VJ(){const e=za?.parentElement;e&&(Ob=e.scrollTop)}function VL(){Ba?.destroy(),Ba=null,Bf=null,$f=void 0,za?.parentElement&&za.parentElement.removeChild(za),Ao?.parentElement&&Ao.parentElement.removeChild(Ao)}function VE(){VL(),_h?.destroy(),_h=null,To?.parentElement&&To.parentElement.removeChild(To)}function YJ(){return To||(To=document.createElement("div"),To.className="codex-host"),To}function XJ(){return za||(za=document.createElement("div"),za.className="codex-reader-host"),za}function ZJ(){return Ao||(Ao=document.createElement("div"),Ao.className="codex-toc-host"),Ao}const JJ={id:"codex",title:"Codex",icon:()=>u.jsx(iQ,{}),render:e=>u.jsx(QJ,{theaterId:e.theaterId})};function QJ({theaterId:e}){const t=er(),n=y.useRef(null),i=y.useRef(null),r=y.useRef(null),o=y.useRef(""),[c,d]=y.useState(null),f=t.codexReader,p=f!==null,_=t.codexReaderExpanded,g=t.theaters.find(D=>D.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=c?.contextKey===S&&c.hasWiki?c.id:null,x=w!==null,E=f?`${f.kind}:${f.kind==="entry"?f.entryId:f.kind==="drydock"?f.patchId??"":f.kind==="conflicts"?f.id??"":f.templateId??""}`:null;return y.useEffect(()=>{if(o.current=S,h_(),!e){d({contextKey:S,hasWiki:!1,id:null});return}tQ(e).then(D=>{o.current===S&&d({contextKey:S,...D})}).catch(()=>{o.current===S&&d({contextKey:S,hasWiki:!1,id:null})})},[S,e]),y.useEffect(()=>{c?.contextKey===S&&!c.hasWiki&&VE()},[S,c]),y.useEffect(()=>()=>VE(),[]),y.useEffect(()=>{if(!x||!w)return;const D=n.current;if(D)return GJ(D,w),KE(j=>{j.kind==="entry"?hr({kind:"entry",entryId:j.id}):j.kind==="drydock"?hr({kind:"drydock",patchId:j.patchId}):j.kind==="conflicts"?hr({kind:"conflicts",id:j.id}):j.kind==="schema"&&hr({kind:"schema",templateId:j.templateId})}),()=>{KE(null)}},[x,w,p]),y.useEffect(()=>{x&&w&&KJ(w)},[x,w]),y.useEffect(()=>{if(!x||!w||!p||_||!i.current||!r.current||!f)return;const D=f.kind,j=D==="drydock"?f.patchId:D==="conflicts"?f.id:D==="schema"?f.templateId:void 0;KL(i.current,r.current,{initialEntryId:D==="entry"?f.entryId:"",kind:D,subId:j,theaterId:w,onRelatedClick:z=>hr({kind:"entry",entryId:z}),onClose:()=>h_(),onPatchOpen:z=>hr({kind:"drydock",patchId:z}),onDecided:()=>{wp(),hr({kind:"drydock",patchId:void 0})}})},[x,w,p,_,E]),y.useEffect(()=>{p||VL()},[p]),x?p?u.jsxs("div",{className:"codex-rail-host is-split",children:[u.jsxs("div",{className:"codex-doc-pane",children:[u.jsxs("div",{className:"codex-doc-pane-head",children:[u.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:Sf,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:h_,children:"✕"})]}),u.jsx("div",{ref:i,className:"codex-doc-scroll"}),u.jsx("div",{ref:r,className:"codex-doc-toc-inline"})]}),u.jsx("div",{ref:n,className:"codex-nav-pane"})]}):u.jsx("div",{ref:n,className:"codex-rail-host"}):u.jsx(eQ,{activeTheater:g,hasTheaters:b})}function eQ({activeTheater:e,hasTheaters:t}){return t?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),u.jsx("h1",{children:e?.label||"This Theater"}),u.jsx("p",{children:"Fleet Wiki data could not be loaded for this Theater."})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),u.jsx("h1",{children:"Add a Theater"}),u.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function tQ(e){const t=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!t.ok)throw new Error("codex_workspace_unavailable");return nQ(await t.json())}function nQ(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("invalid_codex_workspace");const t=e;if(Object.keys(t).length!==2||typeof t.hasWiki!="boolean")throw new Error("invalid_codex_workspace");if(t.hasWiki&&typeof t.id=="string"&&/^[0-9a-f]{12}$/.test(t.id))return{hasWiki:!0,id:t.id};if(!t.hasWiki&&t.id===null)return{hasWiki:!1,id:null};throw new Error("invalid_codex_workspace")}function iQ(){return u.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),u.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),u.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function sQ(e,t,n){const i=t.trim().toLocaleLowerCase();return e.filter(r=>i===""||r.name.toLocaleLowerCase().includes(i)||r.title.toLocaleLowerCase().includes(i)?n==="all"?!0:r.tasksTotal<=0?!1:n==="complete"?r.tasksDone>=r.tasksTotal:r.tasksDone<r.tasksTotal:!1)}function rQ(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function Db(e){return e.replace(/\s+/g," ").trim()}function aQ(e,t){const n=i=>Db(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function YL(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"Unknown";const i=Math.max(0,Math.floor((t-n)/1e3));if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function oQ(e,t){return!Number.isFinite(t)||t<=0?null:Number.isFinite(e)?Math.round(Math.min(1,Math.max(0,e/t))*100):0}function lQ(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function cQ(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function uQ(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(cQ)?"ready":"blocked"}const hQ="plans-changed",dQ=3e4;function fQ(e,t){let n=null,i=null,r=!1,o=!0;const c=()=>{const d=o;o=!1;let f=0;n=new EventSource(`/api/v1/plans/events?theaterId=${encodeURIComponent(e)}`),n.addEventListener(hQ,()=>{t()}),n.onopen=()=>{f+=1,d&&f===1||t()},n.onerror=()=>{n?.readyState!==EventSource.CLOSED||i!==null||(r||t(),i=setTimeout(()=>{i=null,r||c()},dQ))}};return c(),()=>{r=!0,i!==null&&clearTimeout(i),n?.close()}}const pQ=360,mQ={id:"plans",title:"Plans",icon:SQ,render:e=>u.jsx(gQ,{...e})};function gQ(e){const t=e.theaterId;return u.jsx(_Q,{...e},t)}function _Q(e){const{requestExtraWidth:t,theaterId:n}=e,[i,r]=y.useState({kind:"no-theater"}),[o,c]=y.useState({kind:"loading"}),[d,f]=y.useState(null),[p,_]=y.useState(0),[g,b]=y.useState(0),[S,w]=y.useState(()=>new Set),x=y.useRef(0),E=y.useRef(0),D=y.useRef(null),j=y.useRef(o),z=y.useRef(null),T=y.useRef(!1),N=y.useRef(!1),L=y.useRef(null),H=y.useRef(null),F=d?.theaterId===n?d.name:null;y.useEffect(()=>{L.current=F},[F]),y.useEffect(()=>{const $=++x.current;if(!n){r({kind:"no-theater"});return}const M=D.current!==null,k=N.current;N.current=!1,M||r({kind:"loading"}),TO(n).then(B=>{if($!==x.current)return;const O=new Map(B.plans.map(R=>[R.name,rQ(R)])),W=D.current;if(W){const R=new Set(B.plans.filter(Y=>W.get(Y.name)!==O.get(Y.name)).map(Y=>Y.name));R.size>0&&(H.current&&clearTimeout(H.current),w(R),H.current=setTimeout(()=>w(new Set),1200))}D.current=O,r({kind:"ready",plans:B.plans});const U=L.current;U&&(O.has(U)?O.get(U)!==z.current&&b(R=>R+1):(z.current=null,T.current=!0,b(R=>R+1)))}).catch(()=>{$===x.current&&(!M||k)&&r({kind:"error"})})},[n,p]),y.useEffect(()=>{const $=++E.current;if(!n||!F)return;const M=T.current;T.current=!1,!M&&j.current.kind==="ready"&&j.current.plan.name===F||(z.current=null,j.current={kind:"loading"},c({kind:"loading"})),AO(n,F).then(B=>{if($===E.current){z.current=D.current?.get(B.name)??null;const O={kind:"ready",plan:B};j.current=O,c(O)}}).catch(()=>{$===E.current&&(j.current={kind:"error"},c({kind:"error"}))})},[g,F,n]),y.useEffect(()=>{if(n)return fQ(n,()=>{_($=>$+1)})},[n]),y.useEffect(()=>()=>{H.current&&clearTimeout(H.current)},[]),y.useLayoutEffect(()=>(t?.(F?pQ:null),()=>t?.(null)),[t,F]);const J=y.useCallback($=>{n&&f({theaterId:n,name:$})},[n]),pe=y.useCallback(()=>{f(null),z.current=null,j.current={kind:"loading"},c({kind:"loading"})},[]),P=y.useCallback(()=>{N.current=!0,_($=>$+1)},[]),A=y.useCallback(()=>b($=>$+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${F?" is-reader-open":""}`,onKeyDown:$=>{$.key==="Escape"&&F&&pe()},children:[F&&u.jsx(yQ,{state:o,onClose:pe,onRetry:A}),F&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(vQ,{selectedName:F,state:i,onRetry:P,onSelect:J,pulsedNames:S})]})})}function vQ({selectedName:e,state:t,onRetry:n,onSelect:i,pulsedNames:r}){const[o,c]=y.useState(""),[d,f]=y.useState("all"),[p,_]=y.useState(null),g=y.useRef(new Map);if(t.kind==="no-theater")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(Av,{children:"Select a Theater to browse plans."})});if(t.kind==="loading")return u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-loading",children:"Loading plans…"})});if(t.kind==="error")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(XL,{message:"Unable to load plans.",onRetry:n})});if(t.plans.length===0)return u.jsx("div",{className:"plans-list-pane",children:u.jsx(Av,{detail:"Workspace-scoped Fleet Plans appear here.",children:"No plans yet."})});const b=sQ(t.plans,o,d),S=(E,D)=>{const j=(E+D+b.length)%b.length;g.current.get(b[j]?.name??"")?.focus()},w=(E,D)=>{(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),S(D,E.key==="ArrowDown"?1:-1))},x=(E,D)=>{E.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${D}`).then(()=>{_(D),window.setTimeout(()=>_(j=>j===D?null:j),1200)}).catch(()=>{})};return u.jsxs("div",{className:"plans-list-pane",children:[u.jsxs("div",{className:"plans-toolbar",children:[u.jsxs("label",{className:"plans-search-label",children:[u.jsx("span",{children:"Search plans"}),u.jsx("input",{className:"plans-search",value:o,onChange:E=>c(E.target.value)})]}),u.jsx("div",{className:"plans-filter-group","aria-label":"Plan status",children:["all","in-progress","complete"].map(E=>u.jsx("button",{type:"button",className:`plans-filter${d===E?" is-active":""}`,"aria-pressed":d===E,onClick:()=>f(E),children:E==="all"?"ALL":E==="in-progress"?"IN PROGRESS":"COMPLETE"},E))}),u.jsx("button",{type:"button",className:"plans-refresh",onClick:n,children:"REFRESH"})]}),u.jsxs("div",{className:"plans-list","aria-label":"Plans",children:[b.length===0&&u.jsx(Av,{children:"No matching plans."}),b.map((E,D)=>{const j=oQ(E.tasksDone,E.tasksTotal),z=j===100;return u.jsxs("div",{className:`plans-row${e===E.name?" is-selected":""}${r.has(E.name)?" is-pulsing":""}`,children:[u.jsxs("button",{ref:T=>{T?g.current.set(E.name,T):g.current.delete(E.name)},type:"button",className:"plans-row-select",onClick:()=>i(E.name),onKeyDown:T=>w(T,D),children:[u.jsx("span",{className:"plans-row-name",children:E.name}),u.jsxs("span",{className:"plans-row-meta",children:[E.waveCount," waves · ",E.tasksDone,"/",E.tasksTotal," tasks · ",YL(E.updatedAt),E.executionMode==="parallel"?" · parallel":""]}),j!==null&&u.jsx("span",{className:"plans-progress-track","aria-label":`${j}% complete`,children:u.jsx("span",{className:`plans-progress-fill${z?" is-complete":""}`,style:{width:`${j}%`}})})]}),u.jsx("button",{type:"button",className:"plans-copy",onClick:T=>x(T,E.name),"aria-label":p===E.name?`Copied plans/${E.name}`:`Copy plans/${E.name}`,children:p===E.name?"COPIED":"COPY"})]},E.name)})]})]})}function yQ({state:e,onClose:t,onRetry:n}){return e.kind==="loading"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(jb,{onClose:t})]}),u.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(jb,{onClose:t})]}),u.jsx(XL,{message:"Unable to load plan.",onRetry:n})]}):u.jsx(bQ,{plan:e.plan,onClose:t})}function bQ({plan:e,onClose:t}){const n=y.useMemo(()=>{const d=new DOMParser().parseFromString($s(e.content).html,"text/html");return Rv(d.body),d.body.innerHTML},[e.content]),i=y.useRef(null),r=y.useRef(null),o=y.useCallback((d,f)=>{const p=i.current;if(!p)return;const _=[...p.querySelectorAll(d)].find(b=>d==="h3"?aQ(b.textContent??"",f):Db(b.textContent??"")===Db(f));if(!_)return;const g=window.matchMedia("(prefers-reduced-motion: reduce)").matches;_.scrollIntoView({behavior:g?"auto":"smooth",block:"start"}),_.classList.remove("plans-heading-flash"),_.getBoundingClientRect(),_.classList.add("plans-heading-flash"),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>_.classList.remove("plans-heading-flash"),1200)},[]),c=y.useCallback(d=>{const f=d.target.closest('[data-action="copy-code"]');if(!f)return;const p=f.closest("pre")?.getAttribute("data-code");if(!p)return;navigator.clipboard?.writeText(p);const _=f.textContent;f.textContent="Copied",window.setTimeout(()=>{f.textContent=_},1200)},[]);return y.useEffect(()=>{const d=i.current;if(!d)return;zp(d),Rv(d);const f=new MutationObserver(()=>Rv(d));return f.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>f.disconnect()},[n]),y.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsxs("div",{className:"plans-reader-heading",children:[u.jsx("h2",{className:"plans-reader-title",children:e.title}),u.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&u.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",YL(e.updatedAt)]})]}),u.jsx(jb,{onClose:t})]}),u.jsxs("div",{className:"plans-reader-body",children:[u.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((d,f)=>{const p=lQ(d.tasksDone,d.tasksTotal);return u.jsxs("div",{className:`plans-wave is-${p}`,children:[u.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>o("h2",d.heading),children:d.heading}),d.tasksTotal>0&&u.jsxs("span",{className:"plans-wave-count",children:[d.tasksDone,"/",d.tasksTotal]}),d.lanes.length>0&&u.jsx("div",{className:"plans-lane-list",children:d.lanes.map((_,g)=>{const b=uQ(e.waves,f,_);return u.jsxs("div",{className:`plans-lane is-${b}`,children:[u.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>o("h3",_.heading),children:_.id??_.heading}),_.tasksTotal>0&&u.jsxs("span",{className:"plans-lane-count",children:[_.tasksDone,"/",_.tasksTotal]}),b==="ready"&&u.jsx("span",{className:"plans-lane-ready",children:"READY"})]},_.id??`${d.index}-${g}`)})})]},d.index)})}),u.jsx("div",{ref:i,className:"plans-markdown markdown-body",onClick:c,dangerouslySetInnerHTML:{__html:n}})]})]})}function jb({onClose:e}){return u.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Av({children:e,detail:t}){return u.jsxs("div",{className:"plans-empty",children:[u.jsx("span",{children:e}),t&&u.jsx("span",{className:"plans-empty-detail",children:t})]})}function XL({message:e,onRetry:t}){return u.jsxs("div",{className:"plans-error-state",children:[u.jsx("span",{children:e}),u.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Rv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(n)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const n=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),i=t.tagName==="IMG"?"Image":"Media",r=t.ownerDocument.createElement("span");r.className="plans-md-blocked-image",r.textContent=n?`${i} blocked: ${n}`:`${i} blocked`,t.replaceWith(r)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const n=t.getAttribute("href")??t.getAttribute("xlink:href")??"";n!==""&&!n.startsWith("#")&&t.remove()}}function SQ(){return u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M4 12.5l1.5 1.5L8 10.5M4 18.5l1.5 1.5L8 16.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}const wQ=[PZ,JJ,mQ];function xQ(e="right"){const{railPanels:t}=pc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const CQ=360;function kQ(e){const{codexReader:t}=er();return e==="codex"&&t!==null?CQ:0}const ZL=240,EQ=312,JL="fleet-console.rail.panelWidth",YE="Theater";function TQ(){try{const e=localStorage.getItem(JL);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=ZL)return t}}catch{}return EQ}function AQ({theaterId:e,api:t}){const n=y.useSyncExternalStore(I5,()=>Bo().theaters.find(N=>N.id===e)?.label??YE,()=>YE),i=y.useRef(null),r=Z5(),o=J5(),c=y.useRef(o),d=xQ(),f=wQ,_=[...f,...d].find(N=>N.id===r)??null,g=_!==null,b=kQ(r)+(_?.preferredExtraWidth??0)+bj(),S=y.useRef(b);S.current=b;const[w,x]=y.useState(TQ),E=y.useRef(w),[D,j]=y.useState(!1);y.useLayoutEffect(()=>{c.current&&!o&&MN(i.current,".command-band-rail-toggle"),c.current=o},[o]);const z=y.useCallback(N=>{N.preventDefault();const L=N.clientX,H=E.current;j(!0);const F=pe=>{const G=L-pe.clientX,P=window.innerWidth-148-S.current,A=Math.max(ZL,Math.min(P,H+G));E.current=A,x(A)},J=()=>{document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",J),j(!1);try{localStorage.setItem(JL,String(E.current))}catch{}};document.addEventListener("pointermove",F),document.addEventListener("pointerup",J)},[]),T=y.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:n},api:t,requestExtraWidth:N=>{r!==null&&yj(r,N)}}),[e,n,t,r]);return u.jsxs("div",{ref:i,className:`right-rail${g?" is-open":""}${o?" is-expanded":" is-closed"}${D?" is-dragging":""}`,"data-rail-chrome":o?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!o,style:{"--right-rail-panel-width":`${g?w+b:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:w+b}:void 0,children:[g&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:z,"aria-hidden":"true"}),_&&u.jsx(RQ,{activePanel:_,activeId:r,ctx:T})]}),u.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:u.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[f.map(N=>u.jsx(XE,{panel:N,isActive:r===N.id},N.id)),f.length>0&&d.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,d.map(N=>u.jsx(XE,{panel:N,isActive:r===N.id},N.id))]})})]})}const RQ=y.memo(function({activePanel:t,activeId:n,ctx:i}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:_j,children:"✕"})]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:t.render(i)})]})});function XE({panel:e,isActive:t}){const n=y.useCallback(()=>gj(e.id),[e.id]),i=typeof e.icon=="function"?e.icon():e.icon;return u.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:n,children:i})}const NQ='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function LQ(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=er(),i=y.useRef(null),r=y.useRef(null),o=y.useRef(null),c=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.kind==="conflicts"?e.id??"":e.templateId??""}`:null,d=e!==null&&t,f=y.useCallback(()=>{VJ(),CD()},[]);return y.useEffect(()=>{if(!d)return;const p=e;document.body.setAttribute("data-codex-reading","true");const _=document.querySelector(".operations-canvas"),g=document.querySelector(".operations-side-bar");_?.setAttribute("inert",""),g?.setAttribute("inert","");const b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),f();return}S.key==="Tab"&&MQ(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0),document.body.removeAttribute("data-codex-reading"),_?.removeAttribute("inert"),g?.removeAttribute("inert");const S=p?.kind==="entry"?p.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(S?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${S}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[d]),y.useEffect(()=>{if(!d||!r.current||!o.current||!e)return;const p=e.kind,_=p==="drydock"?e.patchId:p==="conflicts"?e.id:p==="schema"?e.templateId:void 0;KL(r.current,o.current,{initialEntryId:p==="entry"?e.entryId:"",kind:p,subId:_,theaterId:n,onRelatedClick:g=>{hr({kind:"entry",entryId:g}),Sf()},onClose:f,onPatchOpen:g=>{hr({kind:"drydock",patchId:g}),Sf()},onDecided:()=>{wp(),hr({kind:"drydock",patchId:void 0}),Sf()}}),requestAnimationFrame(()=>{i.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[d,c]),d?Va.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:f,"aria-hidden":"true"}),u.jsxs("div",{ref:i,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[u.jsxs("div",{className:"codex-reading-sheet-head",children:[u.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),u.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:f,children:"✕"})]}),u.jsxs("div",{className:"codex-reading-sheet-body",children:[u.jsx("div",{ref:r,className:"codex-reading-sheet-read"}),u.jsx("aside",{ref:o,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function MQ(e,t){if(!e)return;const n=[...e.querySelectorAll(NQ)].filter(o=>!o.closest("[inert]"));if(n.length===0)return;const i=n[0],r=n[n.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),i.focus())}const gf=Xp().api,Ib=560,Bb=360,Pf=new Set;function OQ({state:e,claimBootPanelMinimization:t}){const n=y.useRef(null),i=PN(),r=zN(),o=Gp(),c=FN(),d=pc(),[f,p]=y.useState([]),_=y.useMemo(()=>DQ(e).map(O=>O.id),[e.operations,e.activeTheaterId]),g=y.useRef(e),b=y.useRef(0);g.current=e,y.useEffect(()=>{kV(e.activeTheaterId)},[e.activeTheaterId]),y.useEffect(()=>{if(!e.activeTheaterId){p([]);return}e5().then(p).catch(()=>{})},[e.activeTheaterId]),y.useEffect(()=>{const O=W=>{if(!FD()||!W.altKey||W.metaKey||W.ctrlKey)return;const U=document.activeElement;if(U instanceof HTMLElement&&U.matches("input, textarea, [contenteditable='true']")&&!U.closest(".xterm"))return;if(W.code==="KeyF"&&!W.shiftKey){W.preventDefault(),W.stopImmediatePropagation(),AV();return}if(W.shiftKey||W.key!=="ArrowLeft"&&W.key!=="ArrowRight")return;const R=g.current,Y=Ga(),Z=wD(R.operations.filter(oe=>oe.theaterId===R.activeTheaterId),R.groups.filter(oe=>oe.theaterId===R.activeTheaterId),Y.operationOrder,Y.collapsedGroups,_s()===null&&Ys()===null?Y.minimized:[]);if(W.preventDefault(),W.stopImmediatePropagation(),Z.length===0)return;const me=_s()??Ys()??g.current.activeOperationId,ue=SD(Z,me,W.key==="ArrowRight"?1:-1);ue&&Nv(ue,d.operationKinds,gf,b,()=>{Y.minimized.includes(ue)&&bp(ue),ih(ue)})};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[r,o,i,d.operationKinds]),y.useEffect(()=>{for(const U of _)xV(U);if(!e.operationsHydrated||(CV(_),!e.activeTheaterId))return;const O=t(e.activeTheaterId);if(O===null)return;const W=new Set([g.current.pendingOperationFocus,_s(),Ys()].filter(U=>U!==null));wV(O.filter(U=>!W.has(U)))},[t,_,e.activeTheaterId,e.operationsHydrated]);const S=y.useCallback(O=>{const W=g.current.operations.find(Z=>Z.id===O);if(!W)return;const U=Ga(),R=U.operations[O]??W.geometry??IQ(W);U.operations[O]||Sb(O,R),bp(O),Bi(O);const Y=jQ(n.current);Y&&EV(O,Y)},[]);y.useEffect(()=>{const O=e.pendingOperationFocus;O!==null&&(Nv(O,d.operationKinds,gf,b,()=>S(O)),bD())},[S,d.operationKinds,e.pendingOperationFocus]);const w=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(O=>O.theaterId===e.activeTheaterId);const x=y.useCallback((O,W)=>d.plugins.find(R=>R.id===O)?.renderLaunchIcon?.(W)??null,[d.plugins]),E=y.useCallback((O,W,U)=>{if(!g.current.activeTheaterId)return;const R={...ZE(U),zIndex:Fo()};Lv(O,W,R,g.current.activeTheaterId,d.plugins)},[d.plugins]),D=y.useCallback((O,W)=>{if(!g.current.activeTheaterId)return;const U=BQ(n.current),R={...ZE(U),zIndex:Fo()};Lv(O,W,R,g.current.activeTheaterId,d.plugins)},[d.plugins]),j=y.useCallback((O,W,U)=>{g.current.activeTheaterId&&Lv(O,W,U,g.current.activeTheaterId,d.plugins)},[d.plugins]),z=y.useCallback(()=>{WN({x:0,y:0,zoom:1})},[]),T=y.useCallback(O=>{const W=g.current.operations.find(U=>U.id===O);if(W){if(W.theaterId!==g.current.activeTheaterId){b.current+=1,ih(O);return}Nv(O,d.operationKinds,gf,b,()=>S(O))}},[S,d.operationKinds]),N=y.useCallback(O=>{g.current.activeOperationId===O&&Bi(null),qN(O)},[]),L=y.useCallback((O,W)=>{bf(O,{accent:W}).then(()=>Qi(null)).then(ms).catch(()=>{})},[]),H=y.useCallback((O,W)=>{T5(O,W).then(()=>Qi(null)).then(ms).catch(()=>{})},[]),F=y.useCallback((O,W)=>{bf(O,{groupId:W}).then(()=>Qi(null)).then(ms).catch(()=>{})},[]),J=y.useCallback((O,W,U)=>{NO({theaterId:O,name:W,color:"blue"}).then(R=>U?bf(U,{groupId:R.id}).then(()=>{}):void 0).then(()=>Promise.all([Qi(null).then(ms),So().then(wo)])).catch(()=>{})},[]),pe=y.useCallback((O,W)=>{W&&c_(O,{color:W}).then(()=>So()).then(wo).catch(()=>{})},[]),G=y.useCallback((O,W)=>{c_(O,{name:W}).then(()=>So()).then(wo).catch(()=>{})},[]),P=y.useCallback(O=>{const W=new Map(g.current.groups.map(R=>[R.id,R])),U=O.flatMap((R,Y)=>{const Z=W.get(R);return!Z||Z.order===Y?[]:[c_(R,{order:Y})]});U.length!==0&&Promise.allSettled(U).then(()=>So()).then(wo).catch(()=>{})},[]),A=y.useCallback(O=>{const W=new Map(g.current.theaters.map(R=>[R.id,R])),U=O.flatMap((R,Y)=>{const Z=W.get(R);return!Z||Z.order===Y?[]:[kO(R,Y)]});U.length!==0&&Promise.allSettled(U).then(()=>rC(null)).then(Hv).catch(()=>{})},[]),$=y.useCallback(O=>{LO(O).then(()=>Promise.all([Qi(null).then(ms),So().then(wo)])).catch(()=>{})},[]),M=y.useCallback(O=>{if(Pf.has(O))return;_s()===O&&Qs(),Pf.add(O);const W=g.current.operations.find(R=>R.id===O)?.pluginId,U=(W?d.plugins.find(R=>R.id===W):null)??null;$Q(O,U).finally(()=>Pf.delete(O))},[d.plugins]),k=y.useCallback(async O=>{$5();try{const W=await E5(O),U=await k5(W);P5(U),rC(null).then(Hv).catch(()=>{})}catch(W){Fv(W instanceof Error?W.message:String(W))}},[]),B=y.useCallback(async O=>{const W=()=>Promise.all([Qi(null).then(ms),So().then(wo)]).then(()=>{}).catch(()=>{});try{await RO(O),hC(O),await W()}catch(U){if(U instanceof an&&U.status===404){hC(O),await W();return}Fv(U instanceof Error?U.message:String(U))}},[]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(yY,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:c,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:f,canLaunch:w,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:x,onLaunchKind:D,onResetView:z,onClose:M,onMinimize:N,onFocus:T,onSetAccent:L,onRename:H,onSetGroupId:F,onCreateGroup:J,onSetGroupColor:pe,onRenameGroup:G,onReorderGroups:P,onReorderTheaters:A,onUngroupAll:$,onSelectTheater:gD,onAddTheater:k,onCancelAddTheater:yD,onForgetTheater:B}),u.jsx("div",{className:"operations-center-stage",ref:n,children:u.jsx(TZ,{state:e,catalog:f,canLaunch:w,renderKindIcon:x,onLaunchKind:E,onLaunchAtGeometry:j,onClose:M,onFocus:T,onRename:H,onSetAccent:L})}),u.jsx(AQ,{theaterId:e.activeTheaterId,api:gf}),u.jsx(LQ,{})]})}async function Nv(e,t,n,i,r){const o=++i.current,c=cE(),d=_s();if(d!==null){if(d===e){Bi(e),go(e);return}const f=Bo().operations.find(b=>b.id===e),p=Ga().minimized.includes(e),_=f&&t.find(b=>b.pluginId===f.pluginId&&b.type===f.type);let g=!0;if(f&&_?.companions?.length&&_.canOpenCompanions){try{g=await _.canOpenCompanions({api:n,operation:f})}catch{g=!1}const b=Bo(),S=b.operations.find(x=>x.id===e),w=!p&&Ga().minimized.includes(e);if(i.current!==o||cE()!==c||_s()!==d||b.activeTheaterId!==f.theaterId||BN()!==f.theaterId||w||Pf.has(e)||!S||S.pluginId!==f.pluginId||S.type!==f.type||S.theaterId!==f.theaterId)return}if(f&&(!_||!_.companions?.length||!g)){if(Qs(),yp()){bp(e),Bi(e),go(e);return}r(),go(e);return}Bi(e),GN(e),go(e);return}if(Ys()!==null){Bi(e),Q0(e),go(e);return}if(yp()){bp(e),Bi(e),go(e);return}r(),go(e)}function DQ(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(Uv)}function jQ(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function IQ(e){return e.geometry??{x:0,y:0,width:Ib,height:Bb,zIndex:0}}function BQ(e){const t=Ga(),n=e?.clientWidth??800,i=e?.clientHeight??600;return gh({x:n/2,y:i/2},t.viewport)}function ZE(e){return{x:e.x-Ib/2,y:e.y-Bb/2,width:Ib,height:Bb}}async function Lv(e,t,n,i,r){const o=r.find(g=>g.id===e),d=Xp(()=>{Qi(null).then(ms).catch(()=>{})});let f=null;if(o?.launch?f=(await o.launch({theaterId:i,kind:t,geometry:n,operations:d.operations})).id:f=(await d.operations.create({theaterId:i,type:t.type,pluginId:e,title:t.title,geometry:n})).id,await Qi(null).then(ms).catch(()=>{}),!f)return;const p=BN()===i,_=Bo().operations.some(g=>g.id===f);gV(i)===null&&(p&&_&&Ys()!==null?(Bi(f),Q0(f)):ih(f))}async function $Q(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Qi(null).then(ms).catch(()=>{})}const PQ=3e4;let _f=1e3,Mu=null,Mv=null,Ov=!1;function QL(){Mu!==null&&(clearTimeout(Mu),Mu=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);zQ(i.operation)&&mD(i.operation)}catch{}}),e.addEventListener("update:available",()=>{vh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{_L(JSON.parse(n.data))}catch{SE()}}),e.onopen=()=>{_f=1e3,vh()},e.onerror=()=>{e.close(),SE(),Mu=setTimeout(()=>{Mu=null,_f=Math.min(_f*2,PQ),Qi().then(ms).catch(()=>{}).finally(QL)},_f)}}function vh(){if(Mv){Ov=!0;return}Mv=SO(Bo().activeTheaterId).then(aD).catch(()=>{}).finally(()=>{Mv=null,Ov&&(Ov=!1,vh())})}function zQ(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const HQ=6e3;function FQ(){const e=er(),t=y.useRef(new Set),n=y.useRef(null),i=zs(),r=pc(),o=c1(),c=EL(o.state?.language??"auto"),f=i.pathname.startsWith("/operations"),p=y.useCallback(_=>n.current===null||t.current.has(_)?null:(t.current.add(_),n.current),[]);return y.useEffect(()=>{const _=Xp(()=>{Qi().then(ms).catch(()=>{})}),g=r.plugins.map(b=>b.install?.(_)).filter(b=>typeof b=="function");return()=>{for(const b of g)b()}},[r.plugins]),y.useEffect(()=>{rD(f)},[f]),y.useEffect(()=>{const _=new AbortController;C5(_.signal).then(S=>{fD(S),uC()}).catch(S=>{_.signal.aborted||(_t({theaterError:S instanceof Error?S.message:String(S)}),uC())});const g=Date.now();Qi(null,_.signal).then(S=>{n.current=S.filter(w=>w.ts.createdAt<g).map(w=>w.id),pD(S)}).catch(()=>{}),So(null,_.signal).then(wo).catch(()=>{}),vh();const b=window.setTimeout(vh,HQ);return()=>{window.clearTimeout(b),_.abort()}},[]),y.useEffect(()=>(kL({locale:c}),lX),[c]),y.useEffect(()=>SX({getSideBarCollapsed:()=>kb().collapsed,setSideBarCollapsed:o1,toggleOperationSearch:H5,toggleRailChrome:X5}),[]),u.jsxs("div",{className:"console-shell",children:[u.jsx(zY,{operationsViewVisible:f}),u.jsx("main",{className:"console-route-content",children:u.jsxs(z4,{children:[u.jsx(Ml,{path:"/",element:u.jsx(o_,{to:"/operations",replace:!0})}),u.jsx(Ml,{path:"/operations",element:u.jsx(OQ,{state:e,claimBootPanelMinimization:p})}),u.jsx(Ml,{path:"/carrier-settings",element:u.jsx(o_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),u.jsx(Ml,{path:"/settings",element:u.jsx(PX,{})}),u.jsx(Ml,{path:"*",element:u.jsx(o_,{to:"/operations",replace:!0})})]})}),u.jsx(YY,{state:e}),u.jsx(gX,{state:e}),u.jsx(GY,{state:e}),u.jsx(tX,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:zf,"react/jsx-runtime":r6,"@fleet-console/sdk/plugin/browser":k6,"@fleet-console/sdk/settings/browser":M6,"@fleet-console/sdk/operations/browser":f6,"@fleet-console/sdk/notifications/browser":D6,"@fleet-console/sdk/react/browser":I6};Kf("instrument");hD();try{const e=await SL();Kf(e.theme),zv(e.uiFont),rX(e)}catch{}const UQ=await jK();QL();const JE=document.querySelector("#app");JE&&F6.createRoot(JE).render(u.jsx(y.StrictMode,{children:u.jsx(uO,{basename:"/console",children:u.jsx(DK,{value:UQ,children:u.jsx(FQ,{})})})}));export{lH as _,WQ as a,$b as g,en as k,Zu as p};
|