@dotobokuri/fleet-console 1.24.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/AGENTS.md +2 -0
  2. package/dist/cli.mjs +2774 -2836
  3. package/dist/client/assets/{_baseUniq-yooYbTgN.js → _baseUniq-CftO_qma.js} +1 -1
  4. package/dist/client/assets/{arc-D4mme5Ts.js → arc-CIUNumHO.js} +1 -1
  5. package/dist/client/assets/{architectureDiagram-Q4EWVU46-BAJOviEX.js → architectureDiagram-Q4EWVU46-TpVISJv_.js} +1 -1
  6. package/dist/client/assets/{blockDiagram-DXYQGD6D-DuObpxQ3.js → blockDiagram-DXYQGD6D-iHi0B0P6.js} +1 -1
  7. package/dist/client/assets/{c4Diagram-AHTNJAMY-BOT-SD34.js → c4Diagram-AHTNJAMY-CYAcFDrF.js} +1 -1
  8. package/dist/client/assets/channel-B-2UBgQ_.js +1 -0
  9. package/dist/client/assets/{chunk-4BX2VUAB-BF_aMTes.js → chunk-4BX2VUAB-B3Nh-xBT.js} +1 -1
  10. package/dist/client/assets/{chunk-4TB4RGXK-M4brBcnD.js → chunk-4TB4RGXK-CDbmqVYQ.js} +1 -1
  11. package/dist/client/assets/{chunk-55IACEB6-CrG-4b2Z.js → chunk-55IACEB6-DRXIVd03.js} +1 -1
  12. package/dist/client/assets/{chunk-EDXVE4YY-BxDSygH1.js → chunk-EDXVE4YY-b05C0dVN.js} +1 -1
  13. package/dist/client/assets/{chunk-FMBD7UC4-Bh7MEX7E.js → chunk-FMBD7UC4-ByrEd9CG.js} +1 -1
  14. package/dist/client/assets/{chunk-OYMX7WX6-DBnBwxer.js → chunk-OYMX7WX6-BpEVT-V-.js} +1 -1
  15. package/dist/client/assets/{chunk-QZHKN3VN-bjAogQwW.js → chunk-QZHKN3VN-CfdhAAA9.js} +1 -1
  16. package/dist/client/assets/{chunk-YZCP3GAM-l4FGlk_c.js → chunk-YZCP3GAM-Fdx8QRTs.js} +1 -1
  17. package/dist/client/assets/classDiagram-6PBFFD2Q-DiaCSZq-.js +1 -0
  18. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DiaCSZq-.js +1 -0
  19. package/dist/client/assets/clone-Dq4F-r1q.js +1 -0
  20. package/dist/client/assets/{cose-bilkent-S5V4N54A-Bm5QA4zo.js → cose-bilkent-S5V4N54A-D8w9KovE.js} +1 -1
  21. package/dist/client/assets/{dagre-KV5264BT-PzXQN-5Q.js → dagre-KV5264BT-D4fw7rTF.js} +1 -1
  22. package/dist/client/assets/{diagram-5BDNPKRD-KhaAKPtX.js → diagram-5BDNPKRD-BRFcBwDM.js} +1 -1
  23. package/dist/client/assets/{diagram-G4DWMVQ6-DBbjfiR8.js → diagram-G4DWMVQ6-BKzuEau8.js} +1 -1
  24. package/dist/client/assets/{diagram-MMDJMWI5-QWro7PRX.js → diagram-MMDJMWI5-DkqP7aZ4.js} +1 -1
  25. package/dist/client/assets/{diagram-TYMM5635-B9LqWrbF.js → diagram-TYMM5635-NelXGAN3.js} +1 -1
  26. package/dist/client/assets/{erDiagram-SMLLAGMA-b0VkMMN4.js → erDiagram-SMLLAGMA-DHH5btR9.js} +1 -1
  27. package/dist/client/assets/{flowDiagram-DWJPFMVM-edxBAbe6.js → flowDiagram-DWJPFMVM-BmqHUJoi.js} +1 -1
  28. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-ks2Gg1_V.js → ganttDiagram-T4ZO3ILL-BtmWEvNP.js} +1 -1
  29. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-DymUyYNl.js → gitGraphDiagram-UUTBAWPF-B64kk9Nb.js} +1 -1
  30. package/dist/client/assets/{graph-B-B_mqfh.js → graph-CEjP0hvY.js} +1 -1
  31. package/dist/client/assets/index-B3gs6ohi.js +380 -0
  32. package/dist/client/assets/index-DDfl_vPx.css +1 -0
  33. package/dist/client/assets/{infoDiagram-42DDH7IO-B5iLIYAc.js → infoDiagram-42DDH7IO-CaTXrw5R.js} +1 -1
  34. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DnztLLn7.js → ishikawaDiagram-UXIWVN3A-D9-Ds_71.js} +1 -1
  35. package/dist/client/assets/{journeyDiagram-VCZTEJTY-BKDRfH1Y.js → journeyDiagram-VCZTEJTY-Cv4qWOhs.js} +1 -1
  36. package/dist/client/assets/{kanban-definition-6JOO6SKY-DPB3Phvr.js → kanban-definition-6JOO6SKY-CWBLcIpD.js} +1 -1
  37. package/dist/client/assets/{layout-BEeRhYTG.js → layout-D8eNRDnf.js} +1 -1
  38. package/dist/client/assets/{linear-QzmfWKSq.js → linear-lDifS_HV.js} +1 -1
  39. package/dist/client/assets/{mermaid.core-BVka5dgm.js → mermaid.core-DcGkHMSR.js} +4 -4
  40. package/dist/client/assets/{min-CfXk9kSN.js → min-Dz_jFvYt.js} +1 -1
  41. package/dist/client/assets/{mindmap-definition-QFDTVHPH-tGrGhr6Z.js → mindmap-definition-QFDTVHPH-F3RmDOG-.js} +1 -1
  42. package/dist/client/assets/{pieDiagram-DEJITSTG-ZRBqRiRK.js → pieDiagram-DEJITSTG-B1fDKBcl.js} +1 -1
  43. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-VCINZgct.js → quadrantDiagram-34T5L4WZ-D93hlO3O.js} +1 -1
  44. package/dist/client/assets/{requirementDiagram-MS252O5E-DFLzADh3.js → requirementDiagram-MS252O5E-B4wj4AQL.js} +1 -1
  45. package/dist/client/assets/{sankeyDiagram-XADWPNL6-BbouN8Ji.js → sankeyDiagram-XADWPNL6-ZRwx77Xd.js} +1 -1
  46. package/dist/client/assets/{sequenceDiagram-FGHM5R23-B58_LF0R.js → sequenceDiagram-FGHM5R23-COMMRNyM.js} +1 -1
  47. package/dist/client/assets/{stateDiagram-FHFEXIEX-pk-OHHuL.js → stateDiagram-FHFEXIEX-CpBccMyi.js} +1 -1
  48. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-UCYrbaKP.js +1 -0
  49. package/dist/client/assets/{timeline-definition-GMOUNBTQ-4jQdCvaj.js → timeline-definition-GMOUNBTQ-C44EI_-o.js} +1 -1
  50. package/dist/client/assets/{vennDiagram-DHZGUBPP-CUr1fH6N.js → vennDiagram-DHZGUBPP-BiBJbCdD.js} +1 -1
  51. package/dist/client/assets/{wardley-RL74JXVD-D0cfvvNA.js → wardley-RL74JXVD-Dm5-kWNd.js} +1 -1
  52. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-D0l_Rp_Z.js → wardleyDiagram-NUSXRM2D-BjbesihY.js} +1 -1
  53. package/dist/client/assets/{xychartDiagram-5P7HB3ND-BdR8OEuJ.js → xychartDiagram-5P7HB3ND-5P6xhAMr.js} +1 -1
  54. package/dist/client/index.html +2 -2
  55. package/dist/desktop-protocol.d.ts +6 -5
  56. package/dist/desktop-protocol.mjs +26 -18
  57. package/dist/fleet-plugins/diff/routes.mjs +127 -19
  58. package/dist/fleet-plugins/terminal/routes.mjs +3500 -3472
  59. package/package.json +1 -1
  60. package/dist/client/assets/channel-TZYyAq1v.js +0 -1
  61. package/dist/client/assets/classDiagram-6PBFFD2Q-Dh6hZUl4.js +0 -1
  62. package/dist/client/assets/classDiagram-v2-HSJHXN6E-Dh6hZUl4.js +0 -1
  63. package/dist/client/assets/clone-DgWGnVWH.js +0 -1
  64. package/dist/client/assets/index-BgLzfg-v.css +0 -1
  65. package/dist/client/assets/index-pDnb-q6f.js +0 -380
  66. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-xsN122JA.js +0 -1
@@ -0,0 +1,380 @@
1
+ function Ix(e,t){for(var i=0;i<t.length;i++){const s=t[i];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const d=Object.getOwnPropertyDescriptor(s,a);d&&Object.defineProperty(e,a,d.get?d:{enumerable:!0,get:()=>s[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const d of a)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function i(a){const d={};return a.integrity&&(d.integrity=a.integrity),a.referrerPolicy&&(d.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?d.credentials="include":a.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(a){if(a.ep)return;a.ep=!0;const d=i(a);fetch(a.href,d)}})();function Xg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function N$(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var i=function s(){var a=!1;try{a=this instanceof s}catch{}return a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(i,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}),i}var Tp={exports:{}},Rl={};var My;function _T(){if(My)return Rl;My=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(s,a,d){var f=null;if(d!==void 0&&(f=""+d),a.key!==void 0&&(f=""+a.key),"key"in a){d={};for(var c in a)c!=="key"&&(d[c]=a[c])}else d=a;return a=d.ref,{$$typeof:e,type:s,key:f,ref:a!==void 0?a:null,props:d}}return Rl.Fragment=t,Rl.jsx=i,Rl.jsxs=i,Rl}var Ny;function vT(){return Ny||(Ny=1,Tp.exports=_T()),Tp.exports}var l=vT();const bT=Xg(l),yT=Ix({__proto__:null,default:bT},[l]);var Ap={exports:{}},Ye={};var Oy;function ST(){if(Oy)return Ye;Oy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),S=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=S&&j[S]||j["@@iterator"],typeof j=="function"?j:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,_={};function b(j,W,Z){this.props=j,this.context=W,this.refs=_,this.updater=Z||T}b.prototype.isReactComponent={},b.prototype.setState=function(j,W){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,W,"setState")},b.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function v(){}v.prototype=b.prototype;function y(j,W,Z){this.props=j,this.context=W,this.refs=_,this.updater=Z||T}var k=y.prototype=new v;k.constructor=y,C(k,b.prototype),k.isPureReactComponent=!0;var M=Array.isArray;function R(){}var N={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(j,W,Z){var ne=Z.ref;return{$$typeof:e,type:j,key:W,ref:ne!==void 0?ne:null,props:Z}}function $(j,W){return I(j.type,W,j.props)}function H(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function q(j){var W={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(Z){return W[Z]})}var B=/\/+/g;function Y(j,W){return typeof j=="object"&&j!==null&&j.key!=null?q(""+j.key):W.toString(36)}function G(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(R,R):(j.status="pending",j.then(function(W){j.status==="pending"&&(j.status="fulfilled",j.value=W)},function(W){j.status==="pending"&&(j.status="rejected",j.reason=W)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function P(j,W,Z,ne,te){var he=typeof j;(he==="undefined"||he==="boolean")&&(j=null);var J=!1;if(j===null)J=!0;else switch(he){case"bigint":case"string":case"number":J=!0;break;case"object":switch(j.$$typeof){case e:case t:J=!0;break;case g:return J=j._init,P(J(j._payload),W,Z,ne,te)}}if(J)return te=te(j),J=ne===""?"."+Y(j,0):ne,M(te)?(Z="",J!=null&&(Z=J.replace(B,"$&/")+"/"),P(te,W,Z,"",function(fe){return fe})):te!=null&&(H(te)&&(te=$(te,Z+(te.key==null||j&&j.key===te.key?"":(""+te.key).replace(B,"$&/")+"/")+J)),W.push(te)),1;J=0;var F=ne===""?".":ne+":";if(M(j))for(var ae=0;ae<j.length;ae++)ne=j[ae],he=F+Y(ne,ae),J+=P(ne,W,Z,he,te);else if(ae=w(j),typeof ae=="function")for(j=ae.call(j),ae=0;!(ne=j.next()).done;)ne=ne.value,he=F+Y(ne,ae++),J+=P(ne,W,Z,he,te);else if(he==="object"){if(typeof j.then=="function")return P(G(j),W,Z,ne,te);throw W=String(j),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return J}function K(j,W,Z){if(j==null)return j;var ne=[],te=0;return P(j,ne,"","",function(he){return W.call(Z,he,te++)}),ne}function V(j){if(j._status===-1){var W=j._result;W=W(),W.then(function(Z){(j._status===0||j._status===-1)&&(j._status=1,j._result=Z)},function(Z){(j._status===0||j._status===-1)&&(j._status=2,j._result=Z)}),j._status===-1&&(j._status=0,j._result=W)}if(j._status===1)return j._result.default;throw j._result}var O=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},z={map:K,forEach:function(j,W,Z){K(j,function(){W.apply(this,arguments)},Z)},count:function(j){var W=0;return K(j,function(){W++}),W},toArray:function(j){return K(j,function(W){return W})||[]},only:function(j){if(!H(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Ye.Activity=m,Ye.Children=z,Ye.Component=b,Ye.Fragment=i,Ye.Profiler=a,Ye.PureComponent=y,Ye.StrictMode=s,Ye.Suspense=h,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(j){return N.H.useMemoCache(j)}},Ye.cache=function(j){return function(){return j.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(j,W,Z){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var ne=C({},j.props),te=j.key;if(W!=null)for(he in W.key!==void 0&&(te=""+W.key),W)!A.call(W,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&W.ref===void 0||(ne[he]=W[he]);var he=arguments.length-2;if(he===1)ne.children=Z;else if(1<he){for(var J=Array(he),F=0;F<he;F++)J[F]=arguments[F+2];ne.children=J}return I(j.type,te,ne)},Ye.createContext=function(j){return j={$$typeof:f,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:d,_context:j},j},Ye.createElement=function(j,W,Z){var ne,te={},he=null;if(W!=null)for(ne in W.key!==void 0&&(he=""+W.key),W)A.call(W,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(te[ne]=W[ne]);var J=arguments.length-2;if(J===1)te.children=Z;else if(1<J){for(var F=Array(J),ae=0;ae<J;ae++)F[ae]=arguments[ae+2];te.children=F}if(j&&j.defaultProps)for(ne in J=j.defaultProps,J)te[ne]===void 0&&(te[ne]=J[ne]);return I(j,he,te)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(j){return{$$typeof:c,render:j}},Ye.isValidElement=H,Ye.lazy=function(j){return{$$typeof:g,_payload:{_status:-1,_result:j},_init:V}},Ye.memo=function(j,W){return{$$typeof:p,type:j,compare:W===void 0?null:W}},Ye.startTransition=function(j){var W=N.T,Z={};N.T=Z;try{var ne=j(),te=N.S;te!==null&&te(Z,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(R,O)}catch(he){O(he)}finally{W!==null&&Z.types!==null&&(W.types=Z.types),N.T=W}},Ye.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ye.use=function(j){return N.H.use(j)},Ye.useActionState=function(j,W,Z){return N.H.useActionState(j,W,Z)},Ye.useCallback=function(j,W){return N.H.useCallback(j,W)},Ye.useContext=function(j){return N.H.useContext(j)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(j,W){return N.H.useDeferredValue(j,W)},Ye.useEffect=function(j,W){return N.H.useEffect(j,W)},Ye.useEffectEvent=function(j){return N.H.useEffectEvent(j)},Ye.useId=function(){return N.H.useId()},Ye.useImperativeHandle=function(j,W,Z){return N.H.useImperativeHandle(j,W,Z)},Ye.useInsertionEffect=function(j,W){return N.H.useInsertionEffect(j,W)},Ye.useLayoutEffect=function(j,W){return N.H.useLayoutEffect(j,W)},Ye.useMemo=function(j,W){return N.H.useMemo(j,W)},Ye.useOptimistic=function(j,W){return N.H.useOptimistic(j,W)},Ye.useReducer=function(j,W,Z){return N.H.useReducer(j,W,Z)},Ye.useRef=function(j){return N.H.useRef(j)},Ye.useState=function(j){return N.H.useState(j)},Ye.useSyncExternalStore=function(j,W,Z){return N.H.useSyncExternalStore(j,W,Z)},Ye.useTransition=function(){return N.H.useTransition()},Ye.version="19.2.7",Ye}var Dy;function Zg(){return Dy||(Dy=1,Ap.exports=ST()),Ap.exports}var L=Zg();const xT=Xg(L),Mh=Ix({__proto__:null,default:xT},[L]),wT="fc-operation-body";let ni=class extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}};async function Bx(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new ni(t.status,`Operation catalog request failed: ${t.status}`);const i=await t.json();return Array.isArray(i.plugins)?i.plugins.map(ET).filter(s=>s!==null):[]}function Nh(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)||Px(t))throw new ni(500,"Invalid operation response");return t}function Px(e){return zm(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function CT({children:e,className:t}){return l.jsx("div",{className:TT(wT,t),children:e})}function ET(e){if(!zx(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(kT).filter(i=>i!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function kT(e){return!zx(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 zx(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zm(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>zm(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||zm(s,t))}function TT(...e){return e.filter(t=>!!t).join(" ")}const AT=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ni,OperationBody:CT,assertOperationNode:Nh,fetchOperationCatalog:Bx,hasForbiddenBrowserPayloadKey:Px},Symbol.toStringTag,{value:"Module"}));function RT(e){return e}function LT(e){return e}function Hx(e=()=>{}){const t=new Set;return{api:{fetch:(i,s,a)=>fetch(Rp(i,s),a).then(IT),subscribe:(i,s,a)=>{const d=new EventSource(Rp(i,s));d.onmessage=a;const f=()=>d.close();return t.add(f),()=>{f(),t.delete(f)}},resync:e},lifecycle:{onDispose:i=>(t.add(i),()=>t.delete(i))},terminal:{requestTicket:async(i,s,a,d)=>{const f=await fetch(Rp(i,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:a}),signal:d});if(!f.ok)throw new ni(f.status,`Terminal ticket request failed: ${f.status}`);const c=await f.json();if(typeof c.ticket!="string"||typeof c.ttlMs!="number")throw new ni(f.status,"Invalid terminal ticket response");return{ticket:c.ticket,ttlMs:c.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async i=>{const s=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new ni(s.status,`Operation create failed: ${s.status}`);const a=await s.json();return Nh(a.operation)},rename:async(i,s)=>{const a=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})});if(!a.ok)throw new ni(a.status,`Operation rename failed: ${a.status}`);const d=await a.json();return Nh(d.operation)},remove:async i=>{const s=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"DELETE"});if(!s.ok)throw new ni(s.status,`Operation remove failed: ${s.status}`)}},preferences:{read:(i,s)=>PT(i,s),write:(i,s)=>zT(i,s)},settings:{read:async i=>{const s=await fetch(jy(i));if(!s.ok)throw new ni(s.status,`Plugin settings read failed: ${s.status}`);const d=(await s.json()).value;return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:null},write:async(i,s)=>{const a=await fetch(jy(i),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok)throw new ni(a.status,`Plugin settings write failed: ${a.status}`)}},status:{set:()=>{},clear:()=>{}}}}function $x(e,t){return L.useSyncExternalStore(e,t,t)}function MT(){const[e,t]=L.useState([]),i=L.useCallback(async()=>{const s=await fetch("/api/v1/operations");if(!s.ok)throw new ni(s.status,`Operations request failed: ${s.status}`);const a=await s.json();t(Array.isArray(a.operations)?a.operations.map(Nh):[])},[]);return L.useEffect(()=>{i()},[i]),{operations:e,refresh:i}}function NT(e,t){return L.useMemo(()=>({fetch:(i,s)=>e.fetch(t,i,s),subscribe:(i,s)=>e.subscribe(t,i,s)}),[e,t])}function OT(e,t){return L.useMemo(()=>({read:()=>e.read(t),write:i=>e.write(t,i)}),[e,t])}function DT(e,t,i){const[s,a]=L.useState(()=>e.read(t,i)),d=L.useCallback(f=>{a(f),e.write(t,f)},[e,t]);return[s,d]}function jT(e,t){return L.useMemo(()=>({set:i=>e.set(t,i),clear:()=>e.clear(t)}),[e,t])}async function IT(e){if(!e.ok)throw new ni(e.status,`Plugin request failed: ${e.status}`);return e}function Rp(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new ni(400,"Invalid plugin id");const i=t.startsWith("/")?t:`/${t}`;if(i.includes(".."))throw new ni(400,"Invalid plugin path");return`/plugins/${e}${i}`}const BT=/^[a-z0-9][a-z0-9._-]*$/;function jy(e){if(!BT.test(e))throw new ni(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function PT(e,t){if(typeof window>"u")return t;try{const i=window.localStorage.getItem(`fleet-plugin.${e}`);return i===null?t:JSON.parse(i)}catch{return t}}function zT(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const HT=Object.freeze(Object.defineProperty({__proto__:null,React:Mh,createClientCapabilities:Hx,defineOperationKind:LT,definePlugin:RT,useOperationStatus:jT,useOperations:MT,usePluginApi:NT,usePluginSettings:OT,usePluginStorage:DT,useStoreSnapshot:$x},Symbol.toStringTag,{value:"Module"}));function $T(e){return e}function FT({title:e,description:t,children:i}){return l.jsxs("section",{className:"fc-settings-card",children:[e?l.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?l.jsx("p",{className:"fc-settings-card__desc",children:t}):null,l.jsx("div",{className:"fc-settings-card__body",children:i})]})}function UT({label:e,hint:t,children:i}){const s=L.useId(),a=L.useId();return l.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":s,"aria-describedby":t?a:void 0,children:[l.jsxs("div",{className:"fc-settings-row__copy",children:[l.jsx("div",{className:"fc-settings-row__label",id:s,children:e}),t?l.jsx("div",{className:"fc-settings-row__hint",id:a,children:t}):null]}),l.jsx("div",{className:"fc-settings-row__control",children:i})]})}function WT({checked:e,onChange:t,label:i,disabled:s=!1}){const a=L.useId();return l.jsxs("label",{className:"fc-settings-toggle",htmlFor:a,children:[l.jsx("input",{id:a,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:s,"aria-label":i?void 0:"Toggle setting",onChange:d=>t(d.currentTarget.checked)}),l.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),i?l.jsx("span",{className:"fc-settings-toggle__label",children:i}):null]})}function GT({value:e,options:t,onChange:i,label:s,disabled:a=!1}){const d=L.useId(),f=l.jsx("select",{id:d,className:"fc-settings-select__control",value:e,disabled:a,"aria-label":s?void 0:"Select setting",onChange:c=>i(c.currentTarget.value),children:t.map(c=>l.jsx("option",{value:c.value,children:c.label},c.value))});return s?l.jsxs("label",{className:"fc-settings-select",htmlFor:d,children:[l.jsx("span",{className:"fc-settings-select__label",children:s}),f]}):l.jsx("div",{className:"fc-settings-select",children:f})}function qT({label:e,hint:t,children:i}){const s=L.useId(),a=L.useId();return l.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":s,"aria-describedby":t?a:void 0,children:[l.jsx("div",{className:"fc-settings-field__label",id:s,children:e}),t?l.jsx("div",{className:"fc-settings-field__hint",id:a,children:t}):null,l.jsx("div",{className:"fc-settings-field__control",children:i})]})}const KT=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:FT,SettingsField:qT,SettingsRow:UT,SettingsSelect:GT,SettingsToggle:WT,defineSettingsSection:$T},Symbol.toStringTag,{value:"Module"}));function VT(e){return e}const YT=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:VT},Symbol.toStringTag,{value:"Module"})),XT=l.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Jg extends L.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??XT:this.props.children}}const ZT=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Jg,React:Mh,default:Mh},Symbol.toStringTag,{value:"Module"}));var Lp={exports:{}},Ll={},Mp={exports:{}},Np={};var Iy;function JT(){return Iy||(Iy=1,(function(e){function t(P,K){var V=P.length;P.push(K);e:for(;0<V;){var O=V-1>>>1,z=P[O];if(0<a(z,K))P[O]=K,P[V]=z,V=O;else break e}}function i(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var K=P[0],V=P.pop();if(V!==K){P[0]=V;e:for(var O=0,z=P.length,j=z>>>1;O<j;){var W=2*(O+1)-1,Z=P[W],ne=W+1,te=P[ne];if(0>a(Z,V))ne<z&&0>a(te,Z)?(P[O]=te,P[ne]=V,O=ne):(P[O]=Z,P[W]=V,O=W);else if(ne<z&&0>a(te,V))P[O]=te,P[ne]=V,O=ne;else break e}}return K}function a(P,K){var V=P.sortIndex-K.sortIndex;return V!==0?V:P.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var f=Date,c=f.now();e.unstable_now=function(){return f.now()-c}}var h=[],p=[],g=1,m=null,S=3,w=!1,T=!1,C=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function k(P){for(var K=i(p);K!==null;){if(K.callback===null)s(p);else if(K.startTime<=P)s(p),K.sortIndex=K.expirationTime,t(h,K);else break;K=i(p)}}function M(P){if(C=!1,k(P),!T)if(i(h)!==null)T=!0,R||(R=!0,q());else{var K=i(p);K!==null&&G(M,K.startTime-P)}}var R=!1,N=-1,A=5,I=-1;function $(){return _?!0:!(e.unstable_now()-I<A)}function H(){if(_=!1,R){var P=e.unstable_now();I=P;var K=!0;try{e:{T=!1,C&&(C=!1,v(N),N=-1),w=!0;var V=S;try{t:{for(k(P),m=i(h);m!==null&&!(m.expirationTime>P&&$());){var O=m.callback;if(typeof O=="function"){m.callback=null,S=m.priorityLevel;var z=O(m.expirationTime<=P);if(P=e.unstable_now(),typeof z=="function"){m.callback=z,k(P),K=!0;break t}m===i(h)&&s(h),k(P)}else s(h);m=i(h)}if(m!==null)K=!0;else{var j=i(p);j!==null&&G(M,j.startTime-P),K=!1}}break e}finally{m=null,S=V,w=!1}K=void 0}}finally{K?q():R=!1}}}var q;if(typeof y=="function")q=function(){y(H)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,Y=B.port2;B.port1.onmessage=H,q=function(){Y.postMessage(null)}}else q=function(){b(H,0)};function G(P,K){N=b(function(){P(e.unstable_now())},K)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(P){switch(S){case 1:case 2:case 3:var K=3;break;default:K=S}var V=S;S=K;try{return P()}finally{S=V}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(P,K){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var V=S;S=P;try{return K()}finally{S=V}},e.unstable_scheduleCallback=function(P,K,V){var O=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?O+V:O):V=O,P){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=V+z,P={id:g++,callback:K,priorityLevel:P,startTime:V,expirationTime:z,sortIndex:-1},V>O?(P.sortIndex=V,t(p,P),i(h)===null&&P===i(p)&&(C?(v(N),N=-1):C=!0,G(M,V-O))):(P.sortIndex=z,t(h,P),T||w||(T=!0,R||(R=!0,q()))),P},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(P){var K=S;return function(){var V=S;S=K;try{return P.apply(this,arguments)}finally{S=V}}}})(Np)),Np}var By;function QT(){return By||(By=1,Mp.exports=JT()),Mp.exports}var Op={exports:{}},Kn={};var Py;function eA(){if(Py)return Kn;Py=1;var e=Zg();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},a=Symbol.for("react.portal");function d(h,p,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:h,containerInfo:p,implementation:g}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Kn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Kn.createPortal=function(h,p){var g=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 d(h,p,null,g)},Kn.flushSync=function(h){var p=f.T,g=s.p;try{if(f.T=null,s.p=2,h)return h()}finally{f.T=p,s.p=g,s.d.f()}},Kn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(h,p))},Kn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Kn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var g=p.as,m=c(g,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,w=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?s.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:S,fetchPriority:w}):g==="script"&&s.d.X(h,{crossOrigin:m,integrity:S,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Kn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=c(p.as,p.crossOrigin);s.d.M(h,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(h)},Kn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,m=c(g,p.crossOrigin);s.d.L(h,g,{crossOrigin:m,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})}},Kn.preloadModule=function(h,p){if(typeof h=="string")if(p){var g=c(p.as,p.crossOrigin);s.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(h)},Kn.requestFormReset=function(h){s.d.r(h)},Kn.unstable_batchedUpdates=function(h,p){return h(p)},Kn.useFormState=function(h,p,g){return f.H.useFormState(h,p,g)},Kn.useFormStatus=function(){return f.H.useHostTransitionStatus()},Kn.version="19.2.7",Kn}var zy;function Fx(){if(zy)return Op.exports;zy=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(),Op.exports=eA(),Op.exports}var Hy;function tA(){if(Hy)return Ll;Hy=1;var e=QT(),t=Zg(),i=Fx();function s(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function d(n){var r=n,o=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(o=r.return),n=r.return;while(n)}return r.tag===3?o:null}function f(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function c(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function h(n){if(d(n)!==n)throw Error(s(188))}function p(n){var r=n.alternate;if(!r){if(r=d(n),r===null)throw Error(s(188));return r!==n?null:n}for(var o=n,u=r;;){var x=o.return;if(x===null)break;var E=x.alternate;if(E===null){if(u=x.return,u!==null){o=u;continue}break}if(x.child===E.child){for(E=x.child;E;){if(E===o)return h(x),n;if(E===u)return h(x),r;E=E.sibling}throw Error(s(188))}if(o.return!==u.return)o=x,u=E;else{for(var D=!1,U=x.child;U;){if(U===o){D=!0,o=x,u=E;break}if(U===u){D=!0,u=x,o=E;break}U=U.sibling}if(!D){for(U=E.child;U;){if(U===o){D=!0,o=E,u=x;break}if(U===u){D=!0,u=E,o=x;break}U=U.sibling}if(!D)throw Error(s(189))}}if(o.alternate!==u)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?n:r}function g(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=g(n),r!==null)return r;n=n.sibling}return null}var m=Object.assign,S=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),y=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function q(n){return n===null||typeof n!="object"?null:(n=H&&n[H]||n["@@iterator"],typeof n=="function"?n:null)}var B=Symbol.for("react.client.reference");function Y(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===B?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case C:return"Fragment";case b:return"Profiler";case _:return"StrictMode";case M:return"Suspense";case R:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case y:return n.displayName||"Context";case v:return(n._context.displayName||"Context")+".Consumer";case k:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case N:return r=n.displayName||null,r!==null?r:Y(n.type)||"Memo";case A:r=n._payload,n=n._init;try{return Y(n(r))}catch{}}return null}var G=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},O=[],z=-1;function j(n){return{current:n}}function W(n){0>z||(n.current=O[z],O[z]=null,z--)}function Z(n,r){z++,O[z]=n.current,n.current=r}var ne=j(null),te=j(null),he=j(null),J=j(null);function F(n,r){switch(Z(he,r),Z(te,n),Z(ne,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?ey(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=ey(r),n=ty(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}W(ne),Z(ne,n)}function ae(){W(ne),W(te),W(he)}function fe(n){n.memoizedState!==null&&Z(J,n);var r=ne.current,o=ty(r,n.type);r!==o&&(Z(te,n),Z(ne,o))}function Ce(n){te.current===n&&(W(ne),W(te)),J.current===n&&(W(J),El._currentValue=V)}var pe,xe;function Le(n){if(pe===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);pe=r&&r[1]||"",xe=-1<o.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+pe+n+xe}var Pe=!1;function Ue(n,r){if(!n||Pe)return"";Pe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(ue){var ce=ue}Reflect.construct(n,[],be)}else{try{be.call()}catch(ue){ce=ue}n.call(be.prototype)}}else{try{throw Error()}catch(ue){ce=ue}(be=n())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(ue){if(ue&&ce&&typeof ue.stack=="string")return[ue.stack,ce.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=u.DetermineComponentFrameRoot(),D=E[0],U=E[1];if(D&&U){var Q=D.split(`
4
+ `),le=U.split(`
5
+ `);for(x=u=0;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;for(;x<le.length&&!le[x].includes("DetermineComponentFrameRoot");)x++;if(u===Q.length||x===le.length)for(u=Q.length-1,x=le.length-1;1<=u&&0<=x&&Q[u]!==le[x];)x--;for(;1<=u&&0<=x;u--,x--)if(Q[u]!==le[x]){if(u!==1||x!==1)do if(u--,x--,0>x||Q[u]!==le[x]){var me=`
6
+ `+Q[u].replace(" at new "," at ");return n.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",n.displayName)),me}while(1<=u&&0<=x);break}}}finally{Pe=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Le(o):""}function Ae(n,r){switch(n.tag){case 26:case 27:case 5:return Le(n.type);case 16:return Le("Lazy");case 13:return n.child!==r&&r!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return Ue(n.type,!1);case 11:return Ue(n.type.render,!1);case 1:return Ue(n.type,!0);case 31:return Le("Activity");default:return""}}function ye(n){try{var r="",o=null;do r+=Ae(n,o),o=n,n=n.return;while(n);return r}catch(u){return`
7
+ Error generating stack: `+u.message+`
8
+ `+u.stack}}var Oe=Object.prototype.hasOwnProperty,xt=e.unstable_scheduleCallback,Wn=e.unstable_cancelCallback,Gn=e.unstable_shouldYield,en=e.unstable_requestPaint,pt=e.unstable_now,tn=e.unstable_getCurrentPriorityLevel,zt=e.unstable_ImmediatePriority,Ut=e.unstable_UserBlockingPriority,wt=e.unstable_NormalPriority,Ln=e.unstable_LowPriority,xn=e.unstable_IdlePriority,fn=e.log,ft=e.unstable_setDisableYieldValue,wn=null,At=null;function Dt(n){if(typeof fn=="function"&&ft(n),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(wn,n)}catch{}}var Yt=Math.clz32?Math.clz32:Ii,Mn=Math.log,Zn=Math.LN2;function Ii(n){return n>>>=0,n===0?32:31-(Mn(n)/Zn|0)|0}var vi=256,Bi=262144,Nn=4194304;function Ht(n){var r=n&42;if(r!==0)return r;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ee(n,r,o){var u=n.pendingLanes;if(u===0)return 0;var x=0,E=n.suspendedLanes,D=n.pingedLanes;n=n.warmLanes;var U=u&134217727;return U!==0?(u=U&~E,u!==0?x=Ht(u):(D&=U,D!==0?x=Ht(D):o||(o=U&~n,o!==0&&(x=Ht(o))))):(U=u&~E,U!==0?x=Ht(U):D!==0?x=Ht(D):o||(o=u&~n,o!==0&&(x=Ht(o)))),x===0?0:r!==0&&r!==x&&(r&E)===0&&(E=x&-x,o=r&-r,E>=o||E===32&&(o&4194048)!==0)?r:x}function ge(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function we(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 n=Nn;return Nn<<=1,(Nn&62914560)===0&&(Nn=4194304),n}function Ct(n){for(var r=[],o=0;31>o;o++)r.push(n);return r}function mt(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Me(n,r,o,u,x,E){var D=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var U=n.entanglements,Q=n.expirationTimes,le=n.hiddenUpdates;for(o=D&~o;0<o;){var me=31-Yt(o),be=1<<me;U[me]=0,Q[me]=-1;var ce=le[me];if(ce!==null)for(le[me]=null,me=0;me<ce.length;me++){var ue=ce[me];ue!==null&&(ue.lane&=-536870913)}o&=~be}u!==0&&Re(n,u,0),E!==0&&x===0&&n.tag!==0&&(n.suspendedLanes|=E&~(D&~r))}function Re(n,r,o){n.pendingLanes|=r,n.suspendedLanes&=~r;var u=31-Yt(r);n.entangledLanes|=r,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function $e(n,r){var o=n.entangledLanes|=r;for(n=n.entanglements;o;){var u=31-Yt(o),x=1<<u;x&r|n[u]&r&&(n[u]|=r),o&=~x}}function $t(n,r){var o=r&-r;return o=(o&42)!==0?1:it(o),(o&(n.suspendedLanes|r))!==0?0:o}function it(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function de(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function ot(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:Cy(n.type))}function jt(n,r){var o=K.p;try{return K.p=n,r()}finally{K.p=o}}var Xe=Math.random().toString(36).slice(2),Ee="__reactFiber$"+Xe,Ke="__reactProps$"+Xe,It="__reactContainer$"+Xe,On="__reactEvents$"+Xe,bi="__reactListeners$"+Xe,Jn="__reactHandles$"+Xe,yi="__reactResources$"+Xe,Si="__reactMarker$"+Xe;function De(n){delete n[Ee],delete n[Ke],delete n[On],delete n[bi],delete n[Jn]}function X(n){var r=n[Ee];if(r)return r;for(var o=n.parentNode;o;){if(r=o[It]||o[Ee]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(n=ly(n);n!==null;){if(o=n[Ee])return o;n=ly(n)}return r}n=o,o=n.parentNode}return null}function _e(n){if(n=n[Ee]||n[It]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function Te(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(s(33))}function nt(n){var r=n[yi];return r||(r=n[yi]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Qe(n){n[Si]=!0}var Bt=new Set,Xt={};function rn(n,r){Se(n,r),Se(n+"Capture",r)}function Se(n,r){for(Xt[n]=r,n=0;n<r.length;n++)Bt.add(r[n])}var Be=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]*$"),ze={},gt={};function Zt(n){return Oe.call(gt,n)?!0:Oe.call(ze,n)?!1:Be.test(n)?gt[n]=!0:(ze[n]=!0,!1)}function qn(n,r,o){if(Zt(r))if(o===null)n.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+o)}}function xi(n,r,o){if(o===null)n.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+o)}}function ai(n,r,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(r,o,""+u)}}function Ft(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function wi(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Oc(n,r,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var x=u.get,E=u.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return x.call(this)},set:function(D){o=""+D,E.call(this,D)}}),Object.defineProperty(n,r,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(D){o=""+D},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function ya(n){if(!n._valueTracker){var r=wi(n)?"checked":"value";n._valueTracker=Oc(n,r,""+n[r])}}function Po(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var o=r.getValue(),u="";return n&&(u=wi(n)?n.checked?"true":"false":n.value),n=u,n!==o?(r.setValue(n),!0):!1}function Sa(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Ed=/[\n"\\]/g;function oi(n){return n.replace(Ed,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function zo(n,r,o,u,x,E,D,U){n.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?n.type=D:n.removeAttribute("type"),r!=null?D==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Ft(r)):n.value!==""+Ft(r)&&(n.value=""+Ft(r)):D!=="submit"&&D!=="reset"||n.removeAttribute("value"),r!=null?xa(n,D,Ft(r)):o!=null?xa(n,D,Ft(o)):u!=null&&n.removeAttribute("value"),x==null&&E!=null&&(n.defaultChecked=!!E),x!=null&&(n.checked=x&&typeof x!="function"&&typeof x!="symbol"),U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?n.name=""+Ft(U):n.removeAttribute("name")}function Bs(n,r,o,u,x,E,D,U){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.type=E),r!=null||o!=null){if(!(E!=="submit"&&E!=="reset"||r!=null)){ya(n);return}o=o!=null?""+Ft(o):"",r=r!=null?""+Ft(r):o,U||r===n.value||(n.value=r),n.defaultValue=r}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=U?n.checked:!!u,n.defaultChecked=!!u,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(n.name=D),ya(n)}function xa(n,r,o){r==="number"&&Sa(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function Dn(n,r,o,u){if(n=n.options,r){r={};for(var x=0;x<o.length;x++)r["$"+o[x]]=!0;for(o=0;o<n.length;o++)x=r.hasOwnProperty("$"+n[o].value),n[o].selected!==x&&(n[o].selected=x),x&&u&&(n[o].defaultSelected=!0)}else{for(o=""+Ft(o),r=null,x=0;x<n.length;x++){if(n[x].value===o){n[x].selected=!0,u&&(n[x].defaultSelected=!0);return}r!==null||n[x].disabled||(r=n[x])}r!==null&&(r.selected=!0)}}function Dc(n,r,o){if(r!=null&&(r=""+Ft(r),r!==n.value&&(n.value=r),o==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=o!=null?""+Ft(o):""}function wa(n,r,o,u){if(r==null){if(u!=null){if(o!=null)throw Error(s(92));if(G(u)){if(1<u.length)throw Error(s(93));u=u[0]}o=u}o==null&&(o=""),r=o}o=Ft(r),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),ya(n)}function qe(n,r){if(r){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=r;return}}n.textContent=r}var jc=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 pn(n,r,o){var u=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":u?n.setProperty(r,o):typeof o!="number"||o===0||jc.has(r)?r==="float"?n.cssFloat=o:n[r]=(""+o).trim():n[r]=o+"px"}function Et(n,r,o){if(r!=null&&typeof r!="object")throw Error(s(62));if(n=n.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var x in r)u=r[x],r.hasOwnProperty(x)&&o[x]!==u&&pn(n,x,u)}else for(var E in r)r.hasOwnProperty(E)&&pn(n,E,r[E])}function Xr(n){if(n.indexOf("-")===-1)return!1;switch(n){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 wr=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"]]),Ho=/^[\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 Zr(n){return Ho.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function ke(){}var je=null;function Ze(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var lt=null,nn=null;function Pi(n){var r=_e(n);if(r&&(n=r.stateNode)){var o=n[Ke]||null;e:switch(n=r.stateNode,r.type){case"input":if(zo(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+oi(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var u=o[r];if(u!==n&&u.form===n.form){var x=u[Ke]||null;if(!x)throw Error(s(90));zo(u,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(r=0;r<o.length;r++)u=o[r],u.form===n.form&&Po(u)}break e;case"textarea":Dc(n,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&Dn(n,!!o.multiple,r,!1)}}}var $o=!1;function Ic(n,r,o){if($o)return n(r,o);$o=!0;try{var u=n(r);return u}finally{if($o=!1,(lt!==null||nn!==null)&&(wu(),lt&&(r=lt,n=nn,nn=lt=null,Pi(r),n)))for(r=0;r<n.length;r++)Pi(n[r])}}function Fo(n,r){var o=n.stateNode;if(o===null)return null;var u=o[Ke]||null;if(u===null)return null;o=u[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(s(231,r,typeof o));return o}var Cr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kd=!1;if(Cr)try{var Uo={};Object.defineProperty(Uo,"passive",{get:function(){kd=!0}}),window.addEventListener("test",Uo,Uo),window.removeEventListener("test",Uo,Uo)}catch{kd=!1}var Jr=null,Td=null,Bc=null;function tv(){if(Bc)return Bc;var n,r=Td,o=r.length,u,x="value"in Jr?Jr.value:Jr.textContent,E=x.length;for(n=0;n<o&&r[n]===x[n];n++);var D=o-n;for(u=1;u<=D&&r[o-u]===x[E-u];u++);return Bc=x.slice(n,1<u?1-u:void 0)}function Pc(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function zc(){return!0}function nv(){return!1}function li(n){function r(o,u,x,E,D){this._reactName=o,this._targetInst=x,this.type=u,this.nativeEvent=E,this.target=D,this.currentTarget=null;for(var U in n)n.hasOwnProperty(U)&&(o=n[U],this[U]=o?o(E):E[U]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?zc:nv,this.isPropagationStopped=nv,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=zc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=zc)},persist:function(){},isPersistent:zc}),r}var Ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hc=li(Ps),Wo=m({},Ps,{view:0,detail:0}),m5=li(Wo),Ad,Rd,Go,$c=m({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Md,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Go&&(Go&&n.type==="mousemove"?(Ad=n.screenX-Go.screenX,Rd=n.screenY-Go.screenY):Rd=Ad=0,Go=n),Ad)},movementY:function(n){return"movementY"in n?n.movementY:Rd}}),iv=li($c),g5=m({},$c,{dataTransfer:0}),_5=li(g5),v5=m({},Wo,{relatedTarget:0}),Ld=li(v5),b5=m({},Ps,{animationName:0,elapsedTime:0,pseudoElement:0}),y5=li(b5),S5=m({},Ps,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),x5=li(S5),w5=m({},Ps,{data:0}),rv=li(w5),C5={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E5={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"},k5={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function T5(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=k5[n])?!!r[n]:!1}function Md(){return T5}var A5=m({},Wo,{key:function(n){if(n.key){var r=C5[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=Pc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?E5[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Md,charCode:function(n){return n.type==="keypress"?Pc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Pc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),R5=li(A5),L5=m({},$c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sv=li(L5),M5=m({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Md}),N5=li(M5),O5=m({},Ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),D5=li(O5),j5=m({},$c,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),I5=li(j5),B5=m({},Ps,{newState:0,oldState:0}),P5=li(B5),z5=[9,13,27,32],Nd=Cr&&"CompositionEvent"in window,qo=null;Cr&&"documentMode"in document&&(qo=document.documentMode);var H5=Cr&&"TextEvent"in window&&!qo,av=Cr&&(!Nd||qo&&8<qo&&11>=qo),ov=" ",lv=!1;function cv(n,r){switch(n){case"keyup":return z5.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ca=!1;function $5(n,r){switch(n){case"compositionend":return uv(r);case"keypress":return r.which!==32?null:(lv=!0,ov);case"textInput":return n=r.data,n===ov&&lv?null:n;default:return null}}function F5(n,r){if(Ca)return n==="compositionend"||!Nd&&cv(n,r)?(n=tv(),Bc=Td=Jr=null,Ca=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return av&&r.locale!=="ko"?null:r.data;default:return null}}var U5={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 hv(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!U5[n.type]:r==="textarea"}function dv(n,r,o,u){lt?nn?nn.push(u):nn=[u]:lt=u,r=Lu(r,"onChange"),0<r.length&&(o=new Hc("onChange","change",null,o,u),n.push({event:o,listeners:r}))}var Ko=null,Vo=null;function W5(n){Vb(n,0)}function Fc(n){var r=Te(n);if(Po(r))return n}function fv(n,r){if(n==="change")return r}var pv=!1;if(Cr){var Od;if(Cr){var Dd="oninput"in document;if(!Dd){var mv=document.createElement("div");mv.setAttribute("oninput","return;"),Dd=typeof mv.oninput=="function"}Od=Dd}else Od=!1;pv=Od&&(!document.documentMode||9<document.documentMode)}function gv(){Ko&&(Ko.detachEvent("onpropertychange",_v),Vo=Ko=null)}function _v(n){if(n.propertyName==="value"&&Fc(Vo)){var r=[];dv(r,Vo,n,Ze(n)),Ic(W5,r)}}function G5(n,r,o){n==="focusin"?(gv(),Ko=r,Vo=o,Ko.attachEvent("onpropertychange",_v)):n==="focusout"&&gv()}function q5(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Fc(Vo)}function K5(n,r){if(n==="click")return Fc(r)}function V5(n,r){if(n==="input"||n==="change")return Fc(r)}function Y5(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var Ci=typeof Object.is=="function"?Object.is:Y5;function Yo(n,r){if(Ci(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var o=Object.keys(n),u=Object.keys(r);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var x=o[u];if(!Oe.call(r,x)||!Ci(n[x],r[x]))return!1}return!0}function vv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function bv(n,r){var o=vv(n);n=0;for(var u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=r&&u>=r)return{node:o,offset:r-n};n=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=vv(o)}}function yv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?yv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Sv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=Sa(n.document);r instanceof n.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)n=r.contentWindow;else break;r=Sa(n.document)}return r}function jd(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var X5=Cr&&"documentMode"in document&&11>=document.documentMode,Ea=null,Id=null,Xo=null,Bd=!1;function xv(n,r,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Bd||Ea==null||Ea!==Sa(u)||(u=Ea,"selectionStart"in u&&jd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Xo&&Yo(Xo,u)||(Xo=u,u=Lu(Id,"onSelect"),0<u.length&&(r=new Hc("onSelect","select",null,r,o),n.push({event:r,listeners:u}),r.target=Ea)))}function zs(n,r){var o={};return o[n.toLowerCase()]=r.toLowerCase(),o["Webkit"+n]="webkit"+r,o["Moz"+n]="moz"+r,o}var ka={animationend:zs("Animation","AnimationEnd"),animationiteration:zs("Animation","AnimationIteration"),animationstart:zs("Animation","AnimationStart"),transitionrun:zs("Transition","TransitionRun"),transitionstart:zs("Transition","TransitionStart"),transitioncancel:zs("Transition","TransitionCancel"),transitionend:zs("Transition","TransitionEnd")},Pd={},wv={};Cr&&(wv=document.createElement("div").style,"AnimationEvent"in window||(delete ka.animationend.animation,delete ka.animationiteration.animation,delete ka.animationstart.animation),"TransitionEvent"in window||delete ka.transitionend.transition);function Hs(n){if(Pd[n])return Pd[n];if(!ka[n])return n;var r=ka[n],o;for(o in r)if(r.hasOwnProperty(o)&&o in wv)return Pd[n]=r[o];return n}var Cv=Hs("animationend"),Ev=Hs("animationiteration"),kv=Hs("animationstart"),Z5=Hs("transitionrun"),J5=Hs("transitionstart"),Q5=Hs("transitioncancel"),Tv=Hs("transitionend"),Av=new Map,zd="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(" ");zd.push("scrollEnd");function Qi(n,r){Av.set(n,r),rn(r,[n])}var Uc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},zi=[],Ta=0,Hd=0;function Wc(){for(var n=Ta,r=Hd=Ta=0;r<n;){var o=zi[r];zi[r++]=null;var u=zi[r];zi[r++]=null;var x=zi[r];zi[r++]=null;var E=zi[r];if(zi[r++]=null,u!==null&&x!==null){var D=u.pending;D===null?x.next=x:(x.next=D.next,D.next=x),u.pending=x}E!==0&&Rv(o,x,E)}}function Gc(n,r,o,u){zi[Ta++]=n,zi[Ta++]=r,zi[Ta++]=o,zi[Ta++]=u,Hd|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function $d(n,r,o,u){return Gc(n,r,o,u),qc(n)}function $s(n,r){return Gc(n,null,null,r),qc(n)}function Rv(n,r,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var x=!1,E=n.return;E!==null;)E.childLanes|=o,u=E.alternate,u!==null&&(u.childLanes|=o),E.tag===22&&(n=E.stateNode,n===null||n._visibility&1||(x=!0)),n=E,E=E.return;return n.tag===3?(E=n.stateNode,x&&r!==null&&(x=31-Yt(o),n=E.hiddenUpdates,u=n[x],u===null?n[x]=[r]:u.push(r),r.lane=o|536870912),E):null}function qc(n){if(50<vl)throw vl=0,Zf=null,Error(s(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var Aa={};function ek(n,r,o,u){this.tag=n,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ei(n,r,o,u){return new ek(n,r,o,u)}function Fd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Er(n,r){var o=n.alternate;return o===null?(o=Ei(n.tag,r,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=r,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,r=n.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function Lv(n,r){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=r,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,r=o.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function Kc(n,r,o,u,x,E){var D=0;if(u=n,typeof n=="function")Fd(n)&&(D=1);else if(typeof n=="string")D=sT(n,o,ne.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=Ei(31,o,r,x),n.elementType=I,n.lanes=E,n;case C:return Fs(o.children,x,E,r);case _:D=8,x|=24;break;case b:return n=Ei(12,o,r,x|2),n.elementType=b,n.lanes=E,n;case M:return n=Ei(13,o,r,x),n.elementType=M,n.lanes=E,n;case R:return n=Ei(19,o,r,x),n.elementType=R,n.lanes=E,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case y:D=10;break e;case v:D=9;break e;case k:D=11;break e;case N:D=14;break e;case A:D=16,u=null;break e}D=29,o=Error(s(130,n===null?"null":typeof n,"")),u=null}return r=Ei(D,o,r,x),r.elementType=n,r.type=u,r.lanes=E,r}function Fs(n,r,o,u){return n=Ei(7,n,u,r),n.lanes=o,n}function Ud(n,r,o){return n=Ei(6,n,null,r),n.lanes=o,n}function Mv(n){var r=Ei(18,null,null,0);return r.stateNode=n,r}function Wd(n,r,o){return r=Ei(4,n.children!==null?n.children:[],n.key,r),r.lanes=o,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var Nv=new WeakMap;function Hi(n,r){if(typeof n=="object"&&n!==null){var o=Nv.get(n);return o!==void 0?o:(r={value:n,source:r,stack:ye(r)},Nv.set(n,r),r)}return{value:n,source:r,stack:ye(r)}}var Ra=[],La=0,Vc=null,Zo=0,$i=[],Fi=0,Qr=null,fr=1,pr="";function kr(n,r){Ra[La++]=Zo,Ra[La++]=Vc,Vc=n,Zo=r}function Ov(n,r,o){$i[Fi++]=fr,$i[Fi++]=pr,$i[Fi++]=Qr,Qr=n;var u=fr;n=pr;var x=32-Yt(u)-1;u&=~(1<<x),o+=1;var E=32-Yt(r)+x;if(30<E){var D=x-x%5;E=(u&(1<<D)-1).toString(32),u>>=D,x-=D,fr=1<<32-Yt(r)+x|o<<x|u,pr=E+n}else fr=1<<E|o<<x|u,pr=n}function Gd(n){n.return!==null&&(kr(n,1),Ov(n,1,0))}function qd(n){for(;n===Vc;)Vc=Ra[--La],Ra[La]=null,Zo=Ra[--La],Ra[La]=null;for(;n===Qr;)Qr=$i[--Fi],$i[Fi]=null,pr=$i[--Fi],$i[Fi]=null,fr=$i[--Fi],$i[Fi]=null}function Dv(n,r){$i[Fi++]=fr,$i[Fi++]=pr,$i[Fi++]=Qr,fr=r.id,pr=r.overflow,Qr=n}var jn=null,Wt=null,ht=!1,es=null,Ui=!1,Kd=Error(s(519));function ts(n){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jo(Hi(r,n)),Kd}function jv(n){var r=n.stateNode,o=n.type,u=n.memoizedProps;switch(r[Ee]=n,r[Ke]=u,o){case"dialog":at("cancel",r),at("close",r);break;case"iframe":case"object":case"embed":at("load",r);break;case"video":case"audio":for(o=0;o<yl.length;o++)at(yl[o],r);break;case"source":at("error",r);break;case"img":case"image":case"link":at("error",r),at("load",r);break;case"details":at("toggle",r);break;case"input":at("invalid",r),Bs(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":at("invalid",r);break;case"textarea":at("invalid",r),wa(r,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||u.suppressHydrationWarning===!0||Jb(r.textContent,o)?(u.popover!=null&&(at("beforetoggle",r),at("toggle",r)),u.onScroll!=null&&at("scroll",r),u.onScrollEnd!=null&&at("scrollend",r),u.onClick!=null&&(r.onclick=ke),r=!0):r=!1,r||ts(n,!0)}function Iv(n){for(jn=n.return;jn;)switch(jn.tag){case 5:case 31:case 13:Ui=!1;return;case 27:case 3:Ui=!0;return;default:jn=jn.return}}function Ma(n){if(n!==jn)return!1;if(!ht)return Iv(n),ht=!0,!1;var r=n.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||dp(n.type,n.memoizedProps)),o=!o),o&&Wt&&ts(n),Iv(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Wt=oy(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Wt=oy(n)}else r===27?(r=Wt,ms(n.type)?(n=_p,_p=null,Wt=n):Wt=r):Wt=jn?Gi(n.stateNode.nextSibling):null;return!0}function Us(){Wt=jn=null,ht=!1}function Vd(){var n=es;return n!==null&&(di===null?di=n:di.push.apply(di,n),es=null),n}function Jo(n){es===null?es=[n]:es.push(n)}var Yd=j(null),Ws=null,Tr=null;function ns(n,r,o){Z(Yd,r._currentValue),r._currentValue=o}function Ar(n){n._currentValue=Yd.current,W(Yd)}function Xd(n,r,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),n===o)break;n=n.return}}function Zd(n,r,o,u){var x=n.child;for(x!==null&&(x.return=n);x!==null;){var E=x.dependencies;if(E!==null){var D=x.child;E=E.firstContext;e:for(;E!==null;){var U=E;E=x;for(var Q=0;Q<r.length;Q++)if(U.context===r[Q]){E.lanes|=o,U=E.alternate,U!==null&&(U.lanes|=o),Xd(E.return,o,n),u||(D=null);break e}E=U.next}}else if(x.tag===18){if(D=x.return,D===null)throw Error(s(341));D.lanes|=o,E=D.alternate,E!==null&&(E.lanes|=o),Xd(D,o,n),D=null}else D=x.child;if(D!==null)D.return=x;else for(D=x;D!==null;){if(D===n){D=null;break}if(x=D.sibling,x!==null){x.return=D.return,D=x;break}D=D.return}x=D}}function Na(n,r,o,u){n=null;for(var x=r,E=!1;x!==null;){if(!E){if((x.flags&524288)!==0)E=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var D=x.alternate;if(D===null)throw Error(s(387));if(D=D.memoizedProps,D!==null){var U=x.type;Ci(x.pendingProps.value,D.value)||(n!==null?n.push(U):n=[U])}}else if(x===J.current){if(D=x.alternate,D===null)throw Error(s(387));D.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(n!==null?n.push(El):n=[El])}x=x.return}n!==null&&Zd(r,n,o,u),r.flags|=262144}function Yc(n){for(n=n.firstContext;n!==null;){if(!Ci(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Gs(n){Ws=n,Tr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function In(n){return Bv(Ws,n)}function Xc(n,r){return Ws===null&&Gs(n),Bv(n,r)}function Bv(n,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},Tr===null){if(n===null)throw Error(s(308));Tr=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else Tr=Tr.next=r;return o}var tk=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){r.aborted=!0,n.forEach(function(o){return o()})}},nk=e.unstable_scheduleCallback,ik=e.unstable_NormalPriority,mn={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jd(){return{controller:new tk,data:new Map,refCount:0}}function Qo(n){n.refCount--,n.refCount===0&&nk(ik,function(){n.controller.abort()})}var el=null,Qd=0,Oa=0,Da=null;function rk(n,r){if(el===null){var o=el=[];Qd=0,Oa=ip(),Da={status:"pending",value:void 0,then:function(u){o.push(u)}}}return Qd++,r.then(Pv,Pv),r}function Pv(){if(--Qd===0&&el!==null){Da!==null&&(Da.status="fulfilled");var n=el;el=null,Oa=0,Da=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function sk(n,r){var o=[],u={status:"pending",value:null,reason:null,then:function(x){o.push(x)}};return n.then(function(){u.status="fulfilled",u.value=r;for(var x=0;x<o.length;x++)(0,o[x])(r)},function(x){for(u.status="rejected",u.reason=x,x=0;x<o.length;x++)(0,o[x])(void 0)}),u}var zv=P.S;P.S=function(n,r){xb=pt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&rk(n,r),zv!==null&&zv(n,r)};var qs=j(null);function ef(){var n=qs.current;return n!==null?n:Pt.pooledCache}function Zc(n,r){r===null?Z(qs,qs.current):Z(qs,r.pool)}function Hv(){var n=ef();return n===null?null:{parent:mn._currentValue,pool:n}}var ja=Error(s(460)),tf=Error(s(474)),Jc=Error(s(542)),Qc={then:function(){}};function $v(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Fv(n,r,o){switch(o=n[o],o===void 0?n.push(r):o!==r&&(r.then(ke,ke),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Wv(n),n;default:if(typeof r.status=="string")r.then(ke,ke);else{if(n=Pt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=r,n.status="pending",n.then(function(u){if(r.status==="pending"){var x=r;x.status="fulfilled",x.value=u}},function(u){if(r.status==="pending"){var x=r;x.status="rejected",x.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Wv(n),n}throw Vs=r,ja}}function Ks(n){try{var r=n._init;return r(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Vs=o,ja):o}}var Vs=null;function Uv(){if(Vs===null)throw Error(s(459));var n=Vs;return Vs=null,n}function Wv(n){if(n===ja||n===Jc)throw Error(s(483))}var Ia=null,tl=0;function eu(n){var r=tl;return tl+=1,Ia===null&&(Ia=[]),Fv(Ia,n,r)}function nl(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function tu(n,r){throw r.$$typeof===S?Error(s(525)):(n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function Gv(n){function r(re,ie){if(n){var oe=re.deletions;oe===null?(re.deletions=[ie],re.flags|=16):oe.push(ie)}}function o(re,ie){if(!n)return null;for(;ie!==null;)r(re,ie),ie=ie.sibling;return null}function u(re){for(var ie=new Map;re!==null;)re.key!==null?ie.set(re.key,re):ie.set(re.index,re),re=re.sibling;return ie}function x(re,ie){return re=Er(re,ie),re.index=0,re.sibling=null,re}function E(re,ie,oe){return re.index=oe,n?(oe=re.alternate,oe!==null?(oe=oe.index,oe<ie?(re.flags|=67108866,ie):oe):(re.flags|=67108866,ie)):(re.flags|=1048576,ie)}function D(re){return n&&re.alternate===null&&(re.flags|=67108866),re}function U(re,ie,oe,ve){return ie===null||ie.tag!==6?(ie=Ud(oe,re.mode,ve),ie.return=re,ie):(ie=x(ie,oe),ie.return=re,ie)}function Q(re,ie,oe,ve){var Fe=oe.type;return Fe===C?me(re,ie,oe.props.children,ve,oe.key):ie!==null&&(ie.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===A&&Ks(Fe)===ie.type)?(ie=x(ie,oe.props),nl(ie,oe),ie.return=re,ie):(ie=Kc(oe.type,oe.key,oe.props,null,re.mode,ve),nl(ie,oe),ie.return=re,ie)}function le(re,ie,oe,ve){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==oe.containerInfo||ie.stateNode.implementation!==oe.implementation?(ie=Wd(oe,re.mode,ve),ie.return=re,ie):(ie=x(ie,oe.children||[]),ie.return=re,ie)}function me(re,ie,oe,ve,Fe){return ie===null||ie.tag!==7?(ie=Fs(oe,re.mode,ve,Fe),ie.return=re,ie):(ie=x(ie,oe),ie.return=re,ie)}function be(re,ie,oe){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=Ud(""+ie,re.mode,oe),ie.return=re,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case w:return oe=Kc(ie.type,ie.key,ie.props,null,re.mode,oe),nl(oe,ie),oe.return=re,oe;case T:return ie=Wd(ie,re.mode,oe),ie.return=re,ie;case A:return ie=Ks(ie),be(re,ie,oe)}if(G(ie)||q(ie))return ie=Fs(ie,re.mode,oe,null),ie.return=re,ie;if(typeof ie.then=="function")return be(re,eu(ie),oe);if(ie.$$typeof===y)return be(re,Xc(re,ie),oe);tu(re,ie)}return null}function ce(re,ie,oe,ve){var Fe=ie!==null?ie.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Fe!==null?null:U(re,ie,""+oe,ve);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case w:return oe.key===Fe?Q(re,ie,oe,ve):null;case T:return oe.key===Fe?le(re,ie,oe,ve):null;case A:return oe=Ks(oe),ce(re,ie,oe,ve)}if(G(oe)||q(oe))return Fe!==null?null:me(re,ie,oe,ve,null);if(typeof oe.then=="function")return ce(re,ie,eu(oe),ve);if(oe.$$typeof===y)return ce(re,ie,Xc(re,oe),ve);tu(re,oe)}return null}function ue(re,ie,oe,ve,Fe){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return re=re.get(oe)||null,U(ie,re,""+ve,Fe);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case w:return re=re.get(ve.key===null?oe:ve.key)||null,Q(ie,re,ve,Fe);case T:return re=re.get(ve.key===null?oe:ve.key)||null,le(ie,re,ve,Fe);case A:return ve=Ks(ve),ue(re,ie,oe,ve,Fe)}if(G(ve)||q(ve))return re=re.get(oe)||null,me(ie,re,ve,Fe,null);if(typeof ve.then=="function")return ue(re,ie,oe,eu(ve),Fe);if(ve.$$typeof===y)return ue(re,ie,oe,Xc(ie,ve),Fe);tu(ie,ve)}return null}function Ne(re,ie,oe,ve){for(var Fe=null,_t=null,Ie=ie,et=ie=0,ut=null;Ie!==null&&et<oe.length;et++){Ie.index>et?(ut=Ie,Ie=null):ut=Ie.sibling;var vt=ce(re,Ie,oe[et],ve);if(vt===null){Ie===null&&(Ie=ut);break}n&&Ie&&vt.alternate===null&&r(re,Ie),ie=E(vt,ie,et),_t===null?Fe=vt:_t.sibling=vt,_t=vt,Ie=ut}if(et===oe.length)return o(re,Ie),ht&&kr(re,et),Fe;if(Ie===null){for(;et<oe.length;et++)Ie=be(re,oe[et],ve),Ie!==null&&(ie=E(Ie,ie,et),_t===null?Fe=Ie:_t.sibling=Ie,_t=Ie);return ht&&kr(re,et),Fe}for(Ie=u(Ie);et<oe.length;et++)ut=ue(Ie,re,et,oe[et],ve),ut!==null&&(n&&ut.alternate!==null&&Ie.delete(ut.key===null?et:ut.key),ie=E(ut,ie,et),_t===null?Fe=ut:_t.sibling=ut,_t=ut);return n&&Ie.forEach(function(ys){return r(re,ys)}),ht&&kr(re,et),Fe}function Ge(re,ie,oe,ve){if(oe==null)throw Error(s(151));for(var Fe=null,_t=null,Ie=ie,et=ie=0,ut=null,vt=oe.next();Ie!==null&&!vt.done;et++,vt=oe.next()){Ie.index>et?(ut=Ie,Ie=null):ut=Ie.sibling;var ys=ce(re,Ie,vt.value,ve);if(ys===null){Ie===null&&(Ie=ut);break}n&&Ie&&ys.alternate===null&&r(re,Ie),ie=E(ys,ie,et),_t===null?Fe=ys:_t.sibling=ys,_t=ys,Ie=ut}if(vt.done)return o(re,Ie),ht&&kr(re,et),Fe;if(Ie===null){for(;!vt.done;et++,vt=oe.next())vt=be(re,vt.value,ve),vt!==null&&(ie=E(vt,ie,et),_t===null?Fe=vt:_t.sibling=vt,_t=vt);return ht&&kr(re,et),Fe}for(Ie=u(Ie);!vt.done;et++,vt=oe.next())vt=ue(Ie,re,et,vt.value,ve),vt!==null&&(n&&vt.alternate!==null&&Ie.delete(vt.key===null?et:vt.key),ie=E(vt,ie,et),_t===null?Fe=vt:_t.sibling=vt,_t=vt);return n&&Ie.forEach(function(gT){return r(re,gT)}),ht&&kr(re,et),Fe}function Mt(re,ie,oe,ve){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case w:e:{for(var Fe=oe.key;ie!==null;){if(ie.key===Fe){if(Fe=oe.type,Fe===C){if(ie.tag===7){o(re,ie.sibling),ve=x(ie,oe.props.children),ve.return=re,re=ve;break e}}else if(ie.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===A&&Ks(Fe)===ie.type){o(re,ie.sibling),ve=x(ie,oe.props),nl(ve,oe),ve.return=re,re=ve;break e}o(re,ie);break}else r(re,ie);ie=ie.sibling}oe.type===C?(ve=Fs(oe.props.children,re.mode,ve,oe.key),ve.return=re,re=ve):(ve=Kc(oe.type,oe.key,oe.props,null,re.mode,ve),nl(ve,oe),ve.return=re,re=ve)}return D(re);case T:e:{for(Fe=oe.key;ie!==null;){if(ie.key===Fe)if(ie.tag===4&&ie.stateNode.containerInfo===oe.containerInfo&&ie.stateNode.implementation===oe.implementation){o(re,ie.sibling),ve=x(ie,oe.children||[]),ve.return=re,re=ve;break e}else{o(re,ie);break}else r(re,ie);ie=ie.sibling}ve=Wd(oe,re.mode,ve),ve.return=re,re=ve}return D(re);case A:return oe=Ks(oe),Mt(re,ie,oe,ve)}if(G(oe))return Ne(re,ie,oe,ve);if(q(oe)){if(Fe=q(oe),typeof Fe!="function")throw Error(s(150));return oe=Fe.call(oe),Ge(re,ie,oe,ve)}if(typeof oe.then=="function")return Mt(re,ie,eu(oe),ve);if(oe.$$typeof===y)return Mt(re,ie,Xc(re,oe),ve);tu(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ie!==null&&ie.tag===6?(o(re,ie.sibling),ve=x(ie,oe),ve.return=re,re=ve):(o(re,ie),ve=Ud(oe,re.mode,ve),ve.return=re,re=ve),D(re)):o(re,ie)}return function(re,ie,oe,ve){try{tl=0;var Fe=Mt(re,ie,oe,ve);return Ia=null,Fe}catch(Ie){if(Ie===ja||Ie===Jc)throw Ie;var _t=Ei(29,Ie,null,re.mode);return _t.lanes=ve,_t.return=re,_t}}}var Ys=Gv(!0),qv=Gv(!1),is=!1;function nf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rf(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function rs(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ss(n,r,o){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(yt&2)!==0){var x=u.pending;return x===null?r.next=r:(r.next=x.next,x.next=r),u.pending=r,r=qc(n),Rv(n,null,o),r}return Gc(n,u,r,o),qc(n)}function il(n,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var u=r.lanes;u&=n.pendingLanes,o|=u,r.lanes=o,$e(n,o)}}function sf(n,r){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var x=null,E=null;if(o=o.firstBaseUpdate,o!==null){do{var D={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};E===null?x=E=D:E=E.next=D,o=o.next}while(o!==null);E===null?x=E=r:E=E.next=r}else x=E=r;o={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:E,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=r:n.next=r,o.lastBaseUpdate=r}var af=!1;function rl(){if(af){var n=Da;if(n!==null)throw n}}function sl(n,r,o,u){af=!1;var x=n.updateQueue;is=!1;var E=x.firstBaseUpdate,D=x.lastBaseUpdate,U=x.shared.pending;if(U!==null){x.shared.pending=null;var Q=U,le=Q.next;Q.next=null,D===null?E=le:D.next=le,D=Q;var me=n.alternate;me!==null&&(me=me.updateQueue,U=me.lastBaseUpdate,U!==D&&(U===null?me.firstBaseUpdate=le:U.next=le,me.lastBaseUpdate=Q))}if(E!==null){var be=x.baseState;D=0,me=le=Q=null,U=E;do{var ce=U.lane&-536870913,ue=ce!==U.lane;if(ue?(ct&ce)===ce:(u&ce)===ce){ce!==0&&ce===Oa&&(af=!0),me!==null&&(me=me.next={lane:0,tag:U.tag,payload:U.payload,callback:null,next:null});e:{var Ne=n,Ge=U;ce=r;var Mt=o;switch(Ge.tag){case 1:if(Ne=Ge.payload,typeof Ne=="function"){be=Ne.call(Mt,be,ce);break e}be=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ge.payload,ce=typeof Ne=="function"?Ne.call(Mt,be,ce):Ne,ce==null)break e;be=m({},be,ce);break e;case 2:is=!0}}ce=U.callback,ce!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=x.callbacks,ue===null?x.callbacks=[ce]:ue.push(ce))}else ue={lane:ce,tag:U.tag,payload:U.payload,callback:U.callback,next:null},me===null?(le=me=ue,Q=be):me=me.next=ue,D|=ce;if(U=U.next,U===null){if(U=x.shared.pending,U===null)break;ue=U,U=ue.next,ue.next=null,x.lastBaseUpdate=ue,x.shared.pending=null}}while(!0);me===null&&(Q=be),x.baseState=Q,x.firstBaseUpdate=le,x.lastBaseUpdate=me,E===null&&(x.shared.lanes=0),us|=D,n.lanes=D,n.memoizedState=be}}function Kv(n,r){if(typeof n!="function")throw Error(s(191,n));n.call(r)}function Vv(n,r){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)Kv(o[n],r)}var Ba=j(null),nu=j(0);function Yv(n,r){n=Br,Z(nu,n),Z(Ba,r),Br=n|r.baseLanes}function of(){Z(nu,Br),Z(Ba,Ba.current)}function lf(){Br=nu.current,W(Ba),W(nu)}var ki=j(null),Wi=null;function as(n){var r=n.alternate;Z(hn,hn.current&1),Z(ki,n),Wi===null&&(r===null||Ba.current!==null||r.memoizedState!==null)&&(Wi=n)}function cf(n){Z(hn,hn.current),Z(ki,n),Wi===null&&(Wi=n)}function Xv(n){n.tag===22?(Z(hn,hn.current),Z(ki,n),Wi===null&&(Wi=n)):os()}function os(){Z(hn,hn.current),Z(ki,ki.current)}function Ti(n){W(ki),Wi===n&&(Wi=null),W(hn)}var hn=j(0);function iu(n){for(var r=n;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||mp(o)||gp(o)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Rr=0,Je=null,Rt=null,gn=null,ru=!1,Pa=!1,Xs=!1,su=0,al=0,za=null,ak=0;function sn(){throw Error(s(321))}function uf(n,r){if(r===null)return!1;for(var o=0;o<r.length&&o<n.length;o++)if(!Ci(n[o],r[o]))return!1;return!0}function hf(n,r,o,u,x,E){return Rr=E,Je=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,P.H=n===null||n.memoizedState===null?O0:kf,Xs=!1,E=o(u,x),Xs=!1,Pa&&(E=Jv(r,o,u,x)),Zv(n),E}function Zv(n){P.H=cl;var r=Rt!==null&&Rt.next!==null;if(Rr=0,gn=Rt=Je=null,ru=!1,al=0,za=null,r)throw Error(s(300));n===null||_n||(n=n.dependencies,n!==null&&Yc(n)&&(_n=!0))}function Jv(n,r,o,u){Je=n;var x=0;do{if(Pa&&(za=null),al=0,Pa=!1,25<=x)throw Error(s(301));if(x+=1,gn=Rt=null,n.updateQueue!=null){var E=n.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}P.H=D0,E=r(o,u)}while(Pa);return E}function ok(){var n=P.H,r=n.useState()[0];return r=typeof r.then=="function"?ol(r):r,n=n.useState()[0],(Rt!==null?Rt.memoizedState:null)!==n&&(Je.flags|=1024),r}function df(){var n=su!==0;return su=0,n}function ff(n,r,o){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~o}function pf(n){if(ru){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}ru=!1}Rr=0,gn=Rt=Je=null,Pa=!1,al=su=0,za=null}function Qn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gn===null?Je.memoizedState=gn=n:gn=gn.next=n,gn}function dn(){if(Rt===null){var n=Je.alternate;n=n!==null?n.memoizedState:null}else n=Rt.next;var r=gn===null?Je.memoizedState:gn.next;if(r!==null)gn=r,Rt=n;else{if(n===null)throw Je.alternate===null?Error(s(467)):Error(s(310));Rt=n,n={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},gn===null?Je.memoizedState=gn=n:gn=gn.next=n}return gn}function au(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ol(n){var r=al;return al+=1,za===null&&(za=[]),n=Fv(za,n,r),r=Je,(gn===null?r.memoizedState:gn.next)===null&&(r=r.alternate,P.H=r===null||r.memoizedState===null?O0:kf),n}function ou(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ol(n);if(n.$$typeof===y)return In(n)}throw Error(s(438,String(n)))}function mf(n){var r=null,o=Je.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var u=Je.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(x){return x.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=au(),Je.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(n),u=0;u<n;u++)o[u]=$;return r.index++,o}function Lr(n,r){return typeof r=="function"?r(n):r}function lu(n){var r=dn();return gf(r,Rt,n)}function gf(n,r,o){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=o;var x=n.baseQueue,E=u.pending;if(E!==null){if(x!==null){var D=x.next;x.next=E.next,E.next=D}r.baseQueue=x=E,u.pending=null}if(E=n.baseState,x===null)n.memoizedState=E;else{r=x.next;var U=D=null,Q=null,le=r,me=!1;do{var be=le.lane&-536870913;if(be!==le.lane?(ct&be)===be:(Rr&be)===be){var ce=le.revertLane;if(ce===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),be===Oa&&(me=!0);else if((Rr&ce)===ce){le=le.next,ce===Oa&&(me=!0);continue}else be={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(U=Q=be,D=E):Q=Q.next=be,Je.lanes|=ce,us|=ce;be=le.action,Xs&&o(E,be),E=le.hasEagerState?le.eagerState:o(E,be)}else ce={lane:be,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(U=Q=ce,D=E):Q=Q.next=ce,Je.lanes|=be,us|=be;le=le.next}while(le!==null&&le!==r);if(Q===null?D=E:Q.next=U,!Ci(E,n.memoizedState)&&(_n=!0,me&&(o=Da,o!==null)))throw o;n.memoizedState=E,n.baseState=D,n.baseQueue=Q,u.lastRenderedState=E}return x===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function _f(n){var r=dn(),o=r.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=n;var u=o.dispatch,x=o.pending,E=r.memoizedState;if(x!==null){o.pending=null;var D=x=x.next;do E=n(E,D.action),D=D.next;while(D!==x);Ci(E,r.memoizedState)||(_n=!0),r.memoizedState=E,r.baseQueue===null&&(r.baseState=E),o.lastRenderedState=E}return[E,u]}function Qv(n,r,o){var u=Je,x=dn(),E=ht;if(E){if(o===void 0)throw Error(s(407));o=o()}else o=r();var D=!Ci((Rt||x).memoizedState,o);if(D&&(x.memoizedState=o,_n=!0),x=x.queue,yf(n0.bind(null,u,x,n),[n]),x.getSnapshot!==r||D||gn!==null&&gn.memoizedState.tag&1){if(u.flags|=2048,Ha(9,{destroy:void 0},t0.bind(null,u,x,o,r),null),Pt===null)throw Error(s(349));E||(Rr&127)!==0||e0(u,r,o)}return o}function e0(n,r,o){n.flags|=16384,n={getSnapshot:r,value:o},r=Je.updateQueue,r===null?(r=au(),Je.updateQueue=r,r.stores=[n]):(o=r.stores,o===null?r.stores=[n]:o.push(n))}function t0(n,r,o,u){r.value=o,r.getSnapshot=u,i0(r)&&r0(n)}function n0(n,r,o){return o(function(){i0(r)&&r0(n)})}function i0(n){var r=n.getSnapshot;n=n.value;try{var o=r();return!Ci(n,o)}catch{return!0}}function r0(n){var r=$s(n,2);r!==null&&fi(r,n,2)}function vf(n){var r=Qn();if(typeof n=="function"){var o=n;if(n=o(),Xs){Dt(!0);try{o()}finally{Dt(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:n},r}function s0(n,r,o,u){return n.baseState=o,gf(n,Rt,typeof u=="function"?u:Lr)}function lk(n,r,o,u,x){if(hu(n))throw Error(s(485));if(n=r.action,n!==null){var E={payload:x,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){E.listeners.push(D)}};P.T!==null?o(!0):E.isTransition=!1,u(E),o=r.pending,o===null?(E.next=r.pending=E,a0(r,E)):(E.next=o.next,r.pending=o.next=E)}}function a0(n,r){var o=r.action,u=r.payload,x=n.state;if(r.isTransition){var E=P.T,D={};P.T=D;try{var U=o(x,u),Q=P.S;Q!==null&&Q(D,U),o0(n,r,U)}catch(le){bf(n,r,le)}finally{E!==null&&D.types!==null&&(E.types=D.types),P.T=E}}else try{E=o(x,u),o0(n,r,E)}catch(le){bf(n,r,le)}}function o0(n,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){l0(n,r,u)},function(u){return bf(n,r,u)}):l0(n,r,o)}function l0(n,r,o){r.status="fulfilled",r.value=o,c0(r),n.state=o,r=n.pending,r!==null&&(o=r.next,o===r?n.pending=null:(o=o.next,r.next=o,a0(n,o)))}function bf(n,r,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=o,c0(r),r=r.next;while(r!==u)}n.action=null}function c0(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function u0(n,r){return r}function h0(n,r){if(ht){var o=Pt.formState;if(o!==null){e:{var u=Je;if(ht){if(Wt){t:{for(var x=Wt,E=Ui;x.nodeType!==8;){if(!E){x=null;break t}if(x=Gi(x.nextSibling),x===null){x=null;break t}}E=x.data,x=E==="F!"||E==="F"?x:null}if(x){Wt=Gi(x.nextSibling),u=x.data==="F!";break e}}ts(u)}u=!1}u&&(r=o[0])}}return o=Qn(),o.memoizedState=o.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u0,lastRenderedState:r},o.queue=u,o=L0.bind(null,Je,u),u.dispatch=o,u=vf(!1),E=Ef.bind(null,Je,!1,u.queue),u=Qn(),x={state:r,dispatch:null,action:n,pending:null},u.queue=x,o=lk.bind(null,Je,x,E,o),x.dispatch=o,u.memoizedState=n,[r,o,!1]}function d0(n){var r=dn();return f0(r,Rt,n)}function f0(n,r,o){if(r=gf(n,r,u0)[0],n=lu(Lr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=ol(r)}catch(D){throw D===ja?Jc:D}else u=r;r=dn();var x=r.queue,E=x.dispatch;return o!==r.memoizedState&&(Je.flags|=2048,Ha(9,{destroy:void 0},ck.bind(null,x,o),null)),[u,E,n]}function ck(n,r){n.action=r}function p0(n){var r=dn(),o=Rt;if(o!==null)return f0(r,o,n);dn(),r=r.memoizedState,o=dn();var u=o.queue.dispatch;return o.memoizedState=n,[r,u,!1]}function Ha(n,r,o,u){return n={tag:n,create:o,deps:u,inst:r,next:null},r=Je.updateQueue,r===null&&(r=au(),Je.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,r.lastEffect=n),n}function m0(){return dn().memoizedState}function cu(n,r,o,u){var x=Qn();Je.flags|=n,x.memoizedState=Ha(1|r,{destroy:void 0},o,u===void 0?null:u)}function uu(n,r,o,u){var x=dn();u=u===void 0?null:u;var E=x.memoizedState.inst;Rt!==null&&u!==null&&uf(u,Rt.memoizedState.deps)?x.memoizedState=Ha(r,E,o,u):(Je.flags|=n,x.memoizedState=Ha(1|r,E,o,u))}function g0(n,r){cu(8390656,8,n,r)}function yf(n,r){uu(2048,8,n,r)}function uk(n){Je.flags|=4;var r=Je.updateQueue;if(r===null)r=au(),Je.updateQueue=r,r.events=[n];else{var o=r.events;o===null?r.events=[n]:o.push(n)}}function _0(n){var r=dn().memoizedState;return uk({ref:r,nextImpl:n}),function(){if((yt&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function v0(n,r){return uu(4,2,n,r)}function b0(n,r){return uu(4,4,n,r)}function y0(n,r){if(typeof r=="function"){n=n();var o=r(n);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function S0(n,r,o){o=o!=null?o.concat([n]):null,uu(4,4,y0.bind(null,r,n),o)}function Sf(){}function x0(n,r){var o=dn();r=r===void 0?null:r;var u=o.memoizedState;return r!==null&&uf(r,u[1])?u[0]:(o.memoizedState=[n,r],n)}function w0(n,r){var o=dn();r=r===void 0?null:r;var u=o.memoizedState;if(r!==null&&uf(r,u[1]))return u[0];if(u=n(),Xs){Dt(!0);try{n()}finally{Dt(!1)}}return o.memoizedState=[u,r],u}function xf(n,r,o){return o===void 0||(Rr&1073741824)!==0&&(ct&261930)===0?n.memoizedState=r:(n.memoizedState=o,n=Cb(),Je.lanes|=n,us|=n,o)}function C0(n,r,o,u){return Ci(o,r)?o:Ba.current!==null?(n=xf(n,o,u),Ci(n,r)||(_n=!0),n):(Rr&42)===0||(Rr&1073741824)!==0&&(ct&261930)===0?(_n=!0,n.memoizedState=o):(n=Cb(),Je.lanes|=n,us|=n,r)}function E0(n,r,o,u,x){var E=K.p;K.p=E!==0&&8>E?E:8;var D=P.T,U={};P.T=U,Ef(n,!1,r,o);try{var Q=x(),le=P.S;if(le!==null&&le(U,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var me=sk(Q,u);ll(n,r,me,Li(n))}else ll(n,r,u,Li(n))}catch(be){ll(n,r,{then:function(){},status:"rejected",reason:be},Li())}finally{K.p=E,D!==null&&U.types!==null&&(D.types=U.types),P.T=D}}function hk(){}function wf(n,r,o,u){if(n.tag!==5)throw Error(s(476));var x=k0(n).queue;E0(n,x,r,V,o===null?hk:function(){return T0(n),o(u)})}function k0(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:V},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:o},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function T0(n){var r=k0(n);r.next===null&&(r=n.alternate.memoizedState),ll(n,r.next.queue,{},Li())}function Cf(){return In(El)}function A0(){return dn().memoizedState}function R0(){return dn().memoizedState}function dk(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var o=Li();n=rs(o);var u=ss(r,n,o);u!==null&&(fi(u,r,o),il(u,r,o)),r={cache:Jd()},n.payload=r;return}r=r.return}}function fk(n,r,o){var u=Li();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},hu(n)?M0(r,o):(o=$d(n,r,o,u),o!==null&&(fi(o,n,u),N0(o,r,u)))}function L0(n,r,o){var u=Li();ll(n,r,o,u)}function ll(n,r,o,u){var x={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(hu(n))M0(r,x);else{var E=n.alternate;if(n.lanes===0&&(E===null||E.lanes===0)&&(E=r.lastRenderedReducer,E!==null))try{var D=r.lastRenderedState,U=E(D,o);if(x.hasEagerState=!0,x.eagerState=U,Ci(U,D))return Gc(n,r,x,0),Pt===null&&Wc(),!1}catch{}if(o=$d(n,r,x,u),o!==null)return fi(o,n,u),N0(o,r,u),!0}return!1}function Ef(n,r,o,u){if(u={lane:2,revertLane:ip(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},hu(n)){if(r)throw Error(s(479))}else r=$d(n,o,u,2),r!==null&&fi(r,n,2)}function hu(n){var r=n.alternate;return n===Je||r!==null&&r===Je}function M0(n,r){Pa=ru=!0;var o=n.pending;o===null?r.next=r:(r.next=o.next,o.next=r),n.pending=r}function N0(n,r,o){if((o&4194048)!==0){var u=r.lanes;u&=n.pendingLanes,o|=u,r.lanes=o,$e(n,o)}}var cl={readContext:In,use:ou,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn,useHostTransitionStatus:sn,useFormState:sn,useActionState:sn,useOptimistic:sn,useMemoCache:sn,useCacheRefresh:sn};cl.useEffectEvent=sn;var O0={readContext:In,use:ou,useCallback:function(n,r){return Qn().memoizedState=[n,r===void 0?null:r],n},useContext:In,useEffect:g0,useImperativeHandle:function(n,r,o){o=o!=null?o.concat([n]):null,cu(4194308,4,y0.bind(null,r,n),o)},useLayoutEffect:function(n,r){return cu(4194308,4,n,r)},useInsertionEffect:function(n,r){cu(4,2,n,r)},useMemo:function(n,r){var o=Qn();r=r===void 0?null:r;var u=n();if(Xs){Dt(!0);try{n()}finally{Dt(!1)}}return o.memoizedState=[u,r],u},useReducer:function(n,r,o){var u=Qn();if(o!==void 0){var x=o(r);if(Xs){Dt(!0);try{o(r)}finally{Dt(!1)}}}else x=r;return u.memoizedState=u.baseState=x,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:x},u.queue=n,n=n.dispatch=fk.bind(null,Je,n),[u.memoizedState,n]},useRef:function(n){var r=Qn();return n={current:n},r.memoizedState=n},useState:function(n){n=vf(n);var r=n.queue,o=L0.bind(null,Je,r);return r.dispatch=o,[n.memoizedState,o]},useDebugValue:Sf,useDeferredValue:function(n,r){var o=Qn();return xf(o,n,r)},useTransition:function(){var n=vf(!1);return n=E0.bind(null,Je,n.queue,!0,!1),Qn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,o){var u=Je,x=Qn();if(ht){if(o===void 0)throw Error(s(407));o=o()}else{if(o=r(),Pt===null)throw Error(s(349));(ct&127)!==0||e0(u,r,o)}x.memoizedState=o;var E={value:o,getSnapshot:r};return x.queue=E,g0(n0.bind(null,u,E,n),[n]),u.flags|=2048,Ha(9,{destroy:void 0},t0.bind(null,u,E,o,r),null),o},useId:function(){var n=Qn(),r=Pt.identifierPrefix;if(ht){var o=pr,u=fr;o=(u&~(1<<32-Yt(u)-1)).toString(32)+o,r="_"+r+"R_"+o,o=su++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=ak++,r="_"+r+"r_"+o.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Cf,useFormState:h0,useActionState:h0,useOptimistic:function(n){var r=Qn();r.memoizedState=r.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=Ef.bind(null,Je,!0,o),o.dispatch=r,[n,r]},useMemoCache:mf,useCacheRefresh:function(){return Qn().memoizedState=dk.bind(null,Je)},useEffectEvent:function(n){var r=Qn(),o={impl:n};return r.memoizedState=o,function(){if((yt&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},kf={readContext:In,use:ou,useCallback:x0,useContext:In,useEffect:yf,useImperativeHandle:S0,useInsertionEffect:v0,useLayoutEffect:b0,useMemo:w0,useReducer:lu,useRef:m0,useState:function(){return lu(Lr)},useDebugValue:Sf,useDeferredValue:function(n,r){var o=dn();return C0(o,Rt.memoizedState,n,r)},useTransition:function(){var n=lu(Lr)[0],r=dn().memoizedState;return[typeof n=="boolean"?n:ol(n),r]},useSyncExternalStore:Qv,useId:A0,useHostTransitionStatus:Cf,useFormState:d0,useActionState:d0,useOptimistic:function(n,r){var o=dn();return s0(o,Rt,n,r)},useMemoCache:mf,useCacheRefresh:R0};kf.useEffectEvent=_0;var D0={readContext:In,use:ou,useCallback:x0,useContext:In,useEffect:yf,useImperativeHandle:S0,useInsertionEffect:v0,useLayoutEffect:b0,useMemo:w0,useReducer:_f,useRef:m0,useState:function(){return _f(Lr)},useDebugValue:Sf,useDeferredValue:function(n,r){var o=dn();return Rt===null?xf(o,n,r):C0(o,Rt.memoizedState,n,r)},useTransition:function(){var n=_f(Lr)[0],r=dn().memoizedState;return[typeof n=="boolean"?n:ol(n),r]},useSyncExternalStore:Qv,useId:A0,useHostTransitionStatus:Cf,useFormState:p0,useActionState:p0,useOptimistic:function(n,r){var o=dn();return Rt!==null?s0(o,Rt,n,r):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:mf,useCacheRefresh:R0};D0.useEffectEvent=_0;function Tf(n,r,o,u){r=n.memoizedState,o=o(u,r),o=o==null?r:m({},r,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Af={enqueueSetState:function(n,r,o){n=n._reactInternals;var u=Li(),x=rs(u);x.payload=r,o!=null&&(x.callback=o),r=ss(n,x,u),r!==null&&(fi(r,n,u),il(r,n,u))},enqueueReplaceState:function(n,r,o){n=n._reactInternals;var u=Li(),x=rs(u);x.tag=1,x.payload=r,o!=null&&(x.callback=o),r=ss(n,x,u),r!==null&&(fi(r,n,u),il(r,n,u))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var o=Li(),u=rs(o);u.tag=2,r!=null&&(u.callback=r),r=ss(n,u,o),r!==null&&(fi(r,n,o),il(r,n,o))}};function j0(n,r,o,u,x,E,D){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,E,D):r.prototype&&r.prototype.isPureReactComponent?!Yo(o,u)||!Yo(x,E):!0}function I0(n,r,o,u){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,u),r.state!==n&&Af.enqueueReplaceState(r,r.state,null)}function Zs(n,r){var o=r;if("ref"in r){o={};for(var u in r)u!=="ref"&&(o[u]=r[u])}if(n=n.defaultProps){o===r&&(o=m({},o));for(var x in n)o[x]===void 0&&(o[x]=n[x])}return o}function B0(n){Uc(n)}function P0(n){console.error(n)}function z0(n){Uc(n)}function du(n,r){try{var o=n.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function H0(n,r,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Rf(n,r,o){return o=rs(o),o.tag=3,o.payload={element:null},o.callback=function(){du(n,r)},o}function $0(n){return n=rs(n),n.tag=3,n}function F0(n,r,o,u){var x=o.type.getDerivedStateFromError;if(typeof x=="function"){var E=u.value;n.payload=function(){return x(E)},n.callback=function(){H0(r,o,u)}}var D=o.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(n.callback=function(){H0(r,o,u),typeof x!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var U=u.stack;this.componentDidCatch(u.value,{componentStack:U!==null?U:""})})}function pk(n,r,o,u,x){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=o.alternate,r!==null&&Na(r,o,x,!0),o=ki.current,o!==null){switch(o.tag){case 31:case 13:return Wi===null?Cu():o.alternate===null&&an===0&&(an=3),o.flags&=-257,o.flags|=65536,o.lanes=x,u===Qc?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([u]):r.add(u),ep(n,u,x)),!1;case 22:return o.flags|=65536,u===Qc?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([u]):o.add(u)),ep(n,u,x)),!1}throw Error(s(435,o.tag))}return ep(n,u,x),Cu(),!1}if(ht)return r=ki.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=x,u!==Kd&&(n=Error(s(422),{cause:u}),Jo(Hi(n,o)))):(u!==Kd&&(r=Error(s(423),{cause:u}),Jo(Hi(r,o))),n=n.current.alternate,n.flags|=65536,x&=-x,n.lanes|=x,u=Hi(u,o),x=Rf(n.stateNode,u,x),sf(n,x),an!==4&&(an=2)),!1;var E=Error(s(520),{cause:u});if(E=Hi(E,o),_l===null?_l=[E]:_l.push(E),an!==4&&(an=2),r===null)return!0;u=Hi(u,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,n=x&-x,o.lanes|=n,n=Rf(o.stateNode,u,n),sf(o,n),!1;case 1:if(r=o.type,E=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(hs===null||!hs.has(E))))return o.flags|=65536,x&=-x,o.lanes|=x,x=$0(x),F0(x,n,o,u),sf(o,x),!1}o=o.return}while(o!==null);return!1}var Lf=Error(s(461)),_n=!1;function Bn(n,r,o,u){r.child=n===null?qv(r,null,o,u):Ys(r,n.child,o,u)}function U0(n,r,o,u,x){o=o.render;var E=r.ref;if("ref"in u){var D={};for(var U in u)U!=="ref"&&(D[U]=u[U])}else D=u;return Gs(r),u=hf(n,r,o,D,E,x),U=df(),n!==null&&!_n?(ff(n,r,x),Mr(n,r,x)):(ht&&U&&Gd(r),r.flags|=1,Bn(n,r,u,x),r.child)}function W0(n,r,o,u,x){if(n===null){var E=o.type;return typeof E=="function"&&!Fd(E)&&E.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=E,G0(n,r,E,u,x)):(n=Kc(o.type,null,u,r,r.mode,x),n.ref=r.ref,n.return=r,r.child=n)}if(E=n.child,!Pf(n,x)){var D=E.memoizedProps;if(o=o.compare,o=o!==null?o:Yo,o(D,u)&&n.ref===r.ref)return Mr(n,r,x)}return r.flags|=1,n=Er(E,u),n.ref=r.ref,n.return=r,r.child=n}function G0(n,r,o,u,x){if(n!==null){var E=n.memoizedProps;if(Yo(E,u)&&n.ref===r.ref)if(_n=!1,r.pendingProps=u=E,Pf(n,x))(n.flags&131072)!==0&&(_n=!0);else return r.lanes=n.lanes,Mr(n,r,x)}return Mf(n,r,o,u,x)}function q0(n,r,o,u){var x=u.children,E=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(E=E!==null?E.baseLanes|o:o,n!==null){for(u=r.child=n.child,x=0;u!==null;)x=x|u.lanes|u.childLanes,u=u.sibling;u=x&~E}else u=0,r.child=null;return K0(n,r,E,o,u)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Zc(r,E!==null?E.cachePool:null),E!==null?Yv(r,E):of(),Xv(r);else return u=r.lanes=536870912,K0(n,r,E!==null?E.baseLanes|o:o,o,u)}else E!==null?(Zc(r,E.cachePool),Yv(r,E),os(),r.memoizedState=null):(n!==null&&Zc(r,null),of(),os());return Bn(n,r,x,o),r.child}function ul(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function K0(n,r,o,u,x){var E=ef();return E=E===null?null:{parent:mn._currentValue,pool:E},r.memoizedState={baseLanes:o,cachePool:E},n!==null&&Zc(r,null),of(),Xv(r),n!==null&&Na(n,r,u,!0),r.childLanes=x,null}function fu(n,r){return r=mu({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function V0(n,r,o){return Ys(r,n.child,null,o),n=fu(r,r.pendingProps),n.flags|=2,Ti(r),r.memoizedState=null,n}function mk(n,r,o){var u=r.pendingProps,x=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(ht){if(u.mode==="hidden")return n=fu(r,u),r.lanes=536870912,ul(null,n);if(cf(r),(n=Wt)?(n=ay(n,Ui),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Qr!==null?{id:fr,overflow:pr}:null,retryLane:536870912,hydrationErrors:null},o=Mv(n),o.return=r,r.child=o,jn=r,Wt=null)):n=null,n===null)throw ts(r);return r.lanes=536870912,null}return fu(r,u)}var E=n.memoizedState;if(E!==null){var D=E.dehydrated;if(cf(r),x)if(r.flags&256)r.flags&=-257,r=V0(n,r,o);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(s(558));else if(_n||Na(n,r,o,!1),x=(o&n.childLanes)!==0,_n||x){if(u=Pt,u!==null&&(D=$t(u,o),D!==0&&D!==E.retryLane))throw E.retryLane=D,$s(n,D),fi(u,n,D),Lf;Cu(),r=V0(n,r,o)}else n=E.treeContext,Wt=Gi(D.nextSibling),jn=r,ht=!0,es=null,Ui=!1,n!==null&&Dv(r,n),r=fu(r,u),r.flags|=4096;return r}return n=Er(n.child,{mode:u.mode,children:u.children}),n.ref=r.ref,r.child=n,n.return=r,n}function pu(n,r){var o=r.ref;if(o===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(n===null||n.ref!==o)&&(r.flags|=4194816)}}function Mf(n,r,o,u,x){return Gs(r),o=hf(n,r,o,u,void 0,x),u=df(),n!==null&&!_n?(ff(n,r,x),Mr(n,r,x)):(ht&&u&&Gd(r),r.flags|=1,Bn(n,r,o,x),r.child)}function Y0(n,r,o,u,x,E){return Gs(r),r.updateQueue=null,o=Jv(r,u,o,x),Zv(n),u=df(),n!==null&&!_n?(ff(n,r,E),Mr(n,r,E)):(ht&&u&&Gd(r),r.flags|=1,Bn(n,r,o,E),r.child)}function X0(n,r,o,u,x){if(Gs(r),r.stateNode===null){var E=Aa,D=o.contextType;typeof D=="object"&&D!==null&&(E=In(D)),E=new o(u,E),r.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Af,r.stateNode=E,E._reactInternals=r,E=r.stateNode,E.props=u,E.state=r.memoizedState,E.refs={},nf(r),D=o.contextType,E.context=typeof D=="object"&&D!==null?In(D):Aa,E.state=r.memoizedState,D=o.getDerivedStateFromProps,typeof D=="function"&&(Tf(r,o,D,u),E.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(D=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),D!==E.state&&Af.enqueueReplaceState(E,E.state,null),sl(r,u,E,x),rl(),E.state=r.memoizedState),typeof E.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(n===null){E=r.stateNode;var U=r.memoizedProps,Q=Zs(o,U);E.props=Q;var le=E.context,me=o.contextType;D=Aa,typeof me=="object"&&me!==null&&(D=In(me));var be=o.getDerivedStateFromProps;me=typeof be=="function"||typeof E.getSnapshotBeforeUpdate=="function",U=r.pendingProps!==U,me||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(U||le!==D)&&I0(r,E,u,D),is=!1;var ce=r.memoizedState;E.state=ce,sl(r,u,E,x),rl(),le=r.memoizedState,U||ce!==le||is?(typeof be=="function"&&(Tf(r,o,be,u),le=r.memoizedState),(Q=is||j0(r,o,Q,u,ce,le,D))?(me||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(r.flags|=4194308)):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=le),E.props=u,E.state=le,E.context=D,u=Q):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{E=r.stateNode,rf(n,r),D=r.memoizedProps,me=Zs(o,D),E.props=me,be=r.pendingProps,ce=E.context,le=o.contextType,Q=Aa,typeof le=="object"&&le!==null&&(Q=In(le)),U=o.getDerivedStateFromProps,(le=typeof U=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(D!==be||ce!==Q)&&I0(r,E,u,Q),is=!1,ce=r.memoizedState,E.state=ce,sl(r,u,E,x),rl();var ue=r.memoizedState;D!==be||ce!==ue||is||n!==null&&n.dependencies!==null&&Yc(n.dependencies)?(typeof U=="function"&&(Tf(r,o,U,u),ue=r.memoizedState),(me=is||j0(r,o,me,u,ce,ue,Q)||n!==null&&n.dependencies!==null&&Yc(n.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(u,ue,Q),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(u,ue,Q)),typeof E.componentDidUpdate=="function"&&(r.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof E.componentDidUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=ue),E.props=u,E.state=ue,E.context=Q,u=me):(typeof E.componentDidUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),u=!1)}return E=u,pu(n,r),u=(r.flags&128)!==0,E||u?(E=r.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:E.render(),r.flags|=1,n!==null&&u?(r.child=Ys(r,n.child,null,x),r.child=Ys(r,null,o,x)):Bn(n,r,o,x),r.memoizedState=E.state,n=r.child):n=Mr(n,r,x),n}function Z0(n,r,o,u){return Us(),r.flags|=256,Bn(n,r,o,u),r.child}var Nf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Of(n){return{baseLanes:n,cachePool:Hv()}}function Df(n,r,o){return n=n!==null?n.childLanes&~o:0,r&&(n|=Ri),n}function J0(n,r,o){var u=r.pendingProps,x=!1,E=(r.flags&128)!==0,D;if((D=E)||(D=n!==null&&n.memoizedState===null?!1:(hn.current&2)!==0),D&&(x=!0,r.flags&=-129),D=(r.flags&32)!==0,r.flags&=-33,n===null){if(ht){if(x?as(r):os(),(n=Wt)?(n=ay(n,Ui),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Qr!==null?{id:fr,overflow:pr}:null,retryLane:536870912,hydrationErrors:null},o=Mv(n),o.return=r,r.child=o,jn=r,Wt=null)):n=null,n===null)throw ts(r);return gp(n)?r.lanes=32:r.lanes=536870912,null}var U=u.children;return u=u.fallback,x?(os(),x=r.mode,U=mu({mode:"hidden",children:U},x),u=Fs(u,x,o,null),U.return=r,u.return=r,U.sibling=u,r.child=U,u=r.child,u.memoizedState=Of(o),u.childLanes=Df(n,D,o),r.memoizedState=Nf,ul(null,u)):(as(r),jf(r,U))}var Q=n.memoizedState;if(Q!==null&&(U=Q.dehydrated,U!==null)){if(E)r.flags&256?(as(r),r.flags&=-257,r=If(n,r,o)):r.memoizedState!==null?(os(),r.child=n.child,r.flags|=128,r=null):(os(),U=u.fallback,x=r.mode,u=mu({mode:"visible",children:u.children},x),U=Fs(U,x,o,null),U.flags|=2,u.return=r,U.return=r,u.sibling=U,r.child=u,Ys(r,n.child,null,o),u=r.child,u.memoizedState=Of(o),u.childLanes=Df(n,D,o),r.memoizedState=Nf,r=ul(null,u));else if(as(r),gp(U)){if(D=U.nextSibling&&U.nextSibling.dataset,D)var le=D.dgst;D=le,u=Error(s(419)),u.stack="",u.digest=D,Jo({value:u,source:null,stack:null}),r=If(n,r,o)}else if(_n||Na(n,r,o,!1),D=(o&n.childLanes)!==0,_n||D){if(D=Pt,D!==null&&(u=$t(D,o),u!==0&&u!==Q.retryLane))throw Q.retryLane=u,$s(n,u),fi(D,n,u),Lf;mp(U)||Cu(),r=If(n,r,o)}else mp(U)?(r.flags|=192,r.child=n.child,r=null):(n=Q.treeContext,Wt=Gi(U.nextSibling),jn=r,ht=!0,es=null,Ui=!1,n!==null&&Dv(r,n),r=jf(r,u.children),r.flags|=4096);return r}return x?(os(),U=u.fallback,x=r.mode,Q=n.child,le=Q.sibling,u=Er(Q,{mode:"hidden",children:u.children}),u.subtreeFlags=Q.subtreeFlags&65011712,le!==null?U=Er(le,U):(U=Fs(U,x,o,null),U.flags|=2),U.return=r,u.return=r,u.sibling=U,r.child=u,ul(null,u),u=r.child,U=n.child.memoizedState,U===null?U=Of(o):(x=U.cachePool,x!==null?(Q=mn._currentValue,x=x.parent!==Q?{parent:Q,pool:Q}:x):x=Hv(),U={baseLanes:U.baseLanes|o,cachePool:x}),u.memoizedState=U,u.childLanes=Df(n,D,o),r.memoizedState=Nf,ul(n.child,u)):(as(r),o=n.child,n=o.sibling,o=Er(o,{mode:"visible",children:u.children}),o.return=r,o.sibling=null,n!==null&&(D=r.deletions,D===null?(r.deletions=[n],r.flags|=16):D.push(n)),r.child=o,r.memoizedState=null,o)}function jf(n,r){return r=mu({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function mu(n,r){return n=Ei(22,n,null,r),n.lanes=0,n}function If(n,r,o){return Ys(r,n.child,null,o),n=jf(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function Q0(n,r,o){n.lanes|=r;var u=n.alternate;u!==null&&(u.lanes|=r),Xd(n.return,r,o)}function Bf(n,r,o,u,x,E){var D=n.memoizedState;D===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:x,treeForkCount:E}:(D.isBackwards=r,D.rendering=null,D.renderingStartTime=0,D.last=u,D.tail=o,D.tailMode=x,D.treeForkCount=E)}function eb(n,r,o){var u=r.pendingProps,x=u.revealOrder,E=u.tail;u=u.children;var D=hn.current,U=(D&2)!==0;if(U?(D=D&1|2,r.flags|=128):D&=1,Z(hn,D),Bn(n,r,u,o),u=ht?Zo:0,!U&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Q0(n,o,r);else if(n.tag===19)Q0(n,o,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(x){case"forwards":for(o=r.child,x=null;o!==null;)n=o.alternate,n!==null&&iu(n)===null&&(x=o),o=o.sibling;o=x,o===null?(x=r.child,r.child=null):(x=o.sibling,o.sibling=null),Bf(r,!1,x,o,E,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,x=r.child,r.child=null;x!==null;){if(n=x.alternate,n!==null&&iu(n)===null){r.child=x;break}n=x.sibling,x.sibling=o,o=x,x=n}Bf(r,!0,o,null,E,u);break;case"together":Bf(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function Mr(n,r,o){if(n!==null&&(r.dependencies=n.dependencies),us|=r.lanes,(o&r.childLanes)===0)if(n!==null){if(Na(n,r,o,!1),(o&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,o=Er(n,n.pendingProps),r.child=o,o.return=r;n.sibling!==null;)n=n.sibling,o=o.sibling=Er(n,n.pendingProps),o.return=r;o.sibling=null}return r.child}function Pf(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Yc(n)))}function gk(n,r,o){switch(r.tag){case 3:F(r,r.stateNode.containerInfo),ns(r,mn,n.memoizedState.cache),Us();break;case 27:case 5:fe(r);break;case 4:F(r,r.stateNode.containerInfo);break;case 10:ns(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,cf(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(as(r),r.flags|=128,null):(o&r.child.childLanes)!==0?J0(n,r,o):(as(r),n=Mr(n,r,o),n!==null?n.sibling:null);as(r);break;case 19:var x=(n.flags&128)!==0;if(u=(o&r.childLanes)!==0,u||(Na(n,r,o,!1),u=(o&r.childLanes)!==0),x){if(u)return eb(n,r,o);r.flags|=128}if(x=r.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Z(hn,hn.current),u)break;return null;case 22:return r.lanes=0,q0(n,r,o,r.pendingProps);case 24:ns(r,mn,n.memoizedState.cache)}return Mr(n,r,o)}function tb(n,r,o){if(n!==null)if(n.memoizedProps!==r.pendingProps)_n=!0;else{if(!Pf(n,o)&&(r.flags&128)===0)return _n=!1,gk(n,r,o);_n=(n.flags&131072)!==0}else _n=!1,ht&&(r.flags&1048576)!==0&&Ov(r,Zo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(n=Ks(r.elementType),r.type=n,typeof n=="function")Fd(n)?(u=Zs(n,u),r.tag=1,r=X0(null,r,n,u,o)):(r.tag=0,r=Mf(null,r,n,u,o));else{if(n!=null){var x=n.$$typeof;if(x===k){r.tag=11,r=U0(null,r,n,u,o);break e}else if(x===N){r.tag=14,r=W0(null,r,n,u,o);break e}}throw r=Y(n)||n,Error(s(306,r,""))}}return r;case 0:return Mf(n,r,r.type,r.pendingProps,o);case 1:return u=r.type,x=Zs(u,r.pendingProps),X0(n,r,u,x,o);case 3:e:{if(F(r,r.stateNode.containerInfo),n===null)throw Error(s(387));u=r.pendingProps;var E=r.memoizedState;x=E.element,rf(n,r),sl(r,u,null,o);var D=r.memoizedState;if(u=D.cache,ns(r,mn,u),u!==E.cache&&Zd(r,[mn],o,!0),rl(),u=D.element,E.isDehydrated)if(E={element:u,isDehydrated:!1,cache:D.cache},r.updateQueue.baseState=E,r.memoizedState=E,r.flags&256){r=Z0(n,r,u,o);break e}else if(u!==x){x=Hi(Error(s(424)),r),Jo(x),r=Z0(n,r,u,o);break e}else for(n=r.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Wt=Gi(n.firstChild),jn=r,ht=!0,es=null,Ui=!0,o=qv(r,null,u,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Us(),u===x){r=Mr(n,r,o);break e}Bn(n,r,u,o)}r=r.child}return r;case 26:return pu(n,r),n===null?(o=dy(r.type,null,r.pendingProps,null))?r.memoizedState=o:ht||(o=r.type,n=r.pendingProps,u=Mu(he.current).createElement(o),u[Ee]=r,u[Ke]=n,Pn(u,o,n),Qe(u),r.stateNode=u):r.memoizedState=dy(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return fe(r),n===null&&ht&&(u=r.stateNode=cy(r.type,r.pendingProps,he.current),jn=r,Ui=!0,x=Wt,ms(r.type)?(_p=x,Wt=Gi(u.firstChild)):Wt=x),Bn(n,r,r.pendingProps.children,o),pu(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&ht&&((x=u=Wt)&&(u=qk(u,r.type,r.pendingProps,Ui),u!==null?(r.stateNode=u,jn=r,Wt=Gi(u.firstChild),Ui=!1,x=!0):x=!1),x||ts(r)),fe(r),x=r.type,E=r.pendingProps,D=n!==null?n.memoizedProps:null,u=E.children,dp(x,E)?u=null:D!==null&&dp(x,D)&&(r.flags|=32),r.memoizedState!==null&&(x=hf(n,r,ok,null,null,o),El._currentValue=x),pu(n,r),Bn(n,r,u,o),r.child;case 6:return n===null&&ht&&((n=o=Wt)&&(o=Kk(o,r.pendingProps,Ui),o!==null?(r.stateNode=o,jn=r,Wt=null,n=!0):n=!1),n||ts(r)),null;case 13:return J0(n,r,o);case 4:return F(r,r.stateNode.containerInfo),u=r.pendingProps,n===null?r.child=Ys(r,null,u,o):Bn(n,r,u,o),r.child;case 11:return U0(n,r,r.type,r.pendingProps,o);case 7:return Bn(n,r,r.pendingProps,o),r.child;case 8:return Bn(n,r,r.pendingProps.children,o),r.child;case 12:return Bn(n,r,r.pendingProps.children,o),r.child;case 10:return u=r.pendingProps,ns(r,r.type,u.value),Bn(n,r,u.children,o),r.child;case 9:return x=r.type._context,u=r.pendingProps.children,Gs(r),x=In(x),u=u(x),r.flags|=1,Bn(n,r,u,o),r.child;case 14:return W0(n,r,r.type,r.pendingProps,o);case 15:return G0(n,r,r.type,r.pendingProps,o);case 19:return eb(n,r,o);case 31:return mk(n,r,o);case 22:return q0(n,r,o,r.pendingProps);case 24:return Gs(r),u=In(mn),n===null?(x=ef(),x===null&&(x=Pt,E=Jd(),x.pooledCache=E,E.refCount++,E!==null&&(x.pooledCacheLanes|=o),x=E),r.memoizedState={parent:u,cache:x},nf(r),ns(r,mn,x)):((n.lanes&o)!==0&&(rf(n,r),sl(r,null,null,o),rl()),x=n.memoizedState,E=r.memoizedState,x.parent!==u?(x={parent:u,cache:u},r.memoizedState=x,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=x),ns(r,mn,u)):(u=E.cache,ns(r,mn,u),u!==x.cache&&Zd(r,[mn],o,!0))),Bn(n,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function Nr(n){n.flags|=4}function zf(n,r,o,u,x){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(x&335544128)===x)if(n.stateNode.complete)n.flags|=8192;else if(Ab())n.flags|=8192;else throw Vs=Qc,tf}else n.flags&=-16777217}function nb(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!_y(r))if(Ab())n.flags|=8192;else throw Vs=Qc,tf}function gu(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?He():536870912,n.lanes|=r,Wa|=r)}function hl(n,r){if(!ht)switch(n.tailMode){case"hidden":r=n.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function Gt(n){var r=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(r)for(var x=n.child;x!==null;)o|=x.lanes|x.childLanes,u|=x.subtreeFlags&65011712,u|=x.flags&65011712,x.return=n,x=x.sibling;else for(x=n.child;x!==null;)o|=x.lanes|x.childLanes,u|=x.subtreeFlags,u|=x.flags,x.return=n,x=x.sibling;return n.subtreeFlags|=u,n.childLanes=o,r}function _k(n,r,o){var u=r.pendingProps;switch(qd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(r),null;case 1:return Gt(r),null;case 3:return o=r.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),Ar(mn),ae(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(Ma(r)?Nr(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Vd())),Gt(r),null;case 26:var x=r.type,E=r.memoizedState;return n===null?(Nr(r),E!==null?(Gt(r),nb(r,E)):(Gt(r),zf(r,x,null,u,o))):E?E!==n.memoizedState?(Nr(r),Gt(r),nb(r,E)):(Gt(r),r.flags&=-16777217):(n=n.memoizedProps,n!==u&&Nr(r),Gt(r),zf(r,x,n,u,o)),null;case 27:if(Ce(r),o=he.current,x=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==u&&Nr(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return Gt(r),null}n=ne.current,Ma(r)?jv(r):(n=cy(x,u,o),r.stateNode=n,Nr(r))}return Gt(r),null;case 5:if(Ce(r),x=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==u&&Nr(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return Gt(r),null}if(E=ne.current,Ma(r))jv(r);else{var D=Mu(he.current);switch(E){case 1:E=D.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:E=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":E=D.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":E=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":E=D.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof u.is=="string"?D.createElement("select",{is:u.is}):D.createElement("select"),u.multiple?E.multiple=!0:u.size&&(E.size=u.size);break;default:E=typeof u.is=="string"?D.createElement(x,{is:u.is}):D.createElement(x)}}E[Ee]=r,E[Ke]=u;e:for(D=r.child;D!==null;){if(D.tag===5||D.tag===6)E.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===r)break e;for(;D.sibling===null;){if(D.return===null||D.return===r)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}r.stateNode=E;e:switch(Pn(E,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Nr(r)}}return Gt(r),zf(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,o),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==u&&Nr(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(n=he.current,Ma(r)){if(n=r.stateNode,o=r.memoizedProps,u=null,x=jn,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}n[Ee]=r,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||Jb(n.nodeValue,o)),n||ts(r,!0)}else n=Mu(n).createTextNode(u),n[Ee]=r,r.stateNode=n}return Gt(r),null;case 31:if(o=r.memoizedState,n===null||n.memoizedState!==null){if(u=Ma(r),o!==null){if(n===null){if(!u)throw Error(s(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Ee]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Gt(r),n=!1}else o=Vd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return r.flags&256?(Ti(r),r):(Ti(r),null);if((r.flags&128)!==0)throw Error(s(558))}return Gt(r),null;case 13:if(u=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(x=Ma(r),u!==null&&u.dehydrated!==null){if(n===null){if(!x)throw Error(s(318));if(x=r.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(s(317));x[Ee]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Gt(r),x=!1}else x=Vd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=x),x=!0;if(!x)return r.flags&256?(Ti(r),r):(Ti(r),null)}return Ti(r),(r.flags&128)!==0?(r.lanes=o,r):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=r.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),E=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(E=u.memoizedState.cachePool.pool),E!==x&&(u.flags|=2048)),o!==n&&o&&(r.child.flags|=8192),gu(r,r.updateQueue),Gt(r),null);case 4:return ae(),n===null&&op(r.stateNode.containerInfo),Gt(r),null;case 10:return Ar(r.type),Gt(r),null;case 19:if(W(hn),u=r.memoizedState,u===null)return Gt(r),null;if(x=(r.flags&128)!==0,E=u.rendering,E===null)if(x)hl(u,!1);else{if(an!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(E=iu(n),E!==null){for(r.flags|=128,hl(u,!1),n=E.updateQueue,r.updateQueue=n,gu(r,n),r.subtreeFlags=0,n=o,o=r.child;o!==null;)Lv(o,n),o=o.sibling;return Z(hn,hn.current&1|2),ht&&kr(r,u.treeForkCount),r.child}n=n.sibling}u.tail!==null&&pt()>Su&&(r.flags|=128,x=!0,hl(u,!1),r.lanes=4194304)}else{if(!x)if(n=iu(E),n!==null){if(r.flags|=128,x=!0,n=n.updateQueue,r.updateQueue=n,gu(r,n),hl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!E.alternate&&!ht)return Gt(r),null}else 2*pt()-u.renderingStartTime>Su&&o!==536870912&&(r.flags|=128,x=!0,hl(u,!1),r.lanes=4194304);u.isBackwards?(E.sibling=r.child,r.child=E):(n=u.last,n!==null?n.sibling=E:r.child=E,u.last=E)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=pt(),n.sibling=null,o=hn.current,Z(hn,x?o&1|2:o&1),ht&&kr(r,u.treeForkCount),n):(Gt(r),null);case 22:case 23:return Ti(r),lf(),u=r.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(o&536870912)!==0&&(r.flags&128)===0&&(Gt(r),r.subtreeFlags&6&&(r.flags|=8192)):Gt(r),o=r.updateQueue,o!==null&&gu(r,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==o&&(r.flags|=2048),n!==null&&W(qs),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),Ar(mn),Gt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function vk(n,r){switch(qd(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Ar(mn),ae(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return Ce(r),null;case 31:if(r.memoizedState!==null){if(Ti(r),r.alternate===null)throw Error(s(340));Us()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(Ti(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Us()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return W(hn),null;case 4:return ae(),null;case 10:return Ar(r.type),null;case 22:case 23:return Ti(r),lf(),n!==null&&W(qs),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Ar(mn),null;case 25:return null;default:return null}}function ib(n,r){switch(qd(r),r.tag){case 3:Ar(mn),ae();break;case 26:case 27:case 5:Ce(r);break;case 4:ae();break;case 31:r.memoizedState!==null&&Ti(r);break;case 13:Ti(r);break;case 19:W(hn);break;case 10:Ar(r.type);break;case 22:case 23:Ti(r),lf(),n!==null&&W(qs);break;case 24:Ar(mn)}}function dl(n,r){try{var o=r.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var x=u.next;o=x;do{if((o.tag&n)===n){u=void 0;var E=o.create,D=o.inst;u=E(),D.destroy=u}o=o.next}while(o!==x)}}catch(U){Tt(r,r.return,U)}}function ls(n,r,o){try{var u=r.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var E=x.next;u=E;do{if((u.tag&n)===n){var D=u.inst,U=D.destroy;if(U!==void 0){D.destroy=void 0,x=r;var Q=o,le=U;try{le()}catch(me){Tt(x,Q,me)}}}u=u.next}while(u!==E)}}catch(me){Tt(r,r.return,me)}}function rb(n){var r=n.updateQueue;if(r!==null){var o=n.stateNode;try{Vv(r,o)}catch(u){Tt(n,n.return,u)}}}function sb(n,r,o){o.props=Zs(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){Tt(n,r,u)}}function fl(n,r){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(x){Tt(n,r,x)}}function mr(n,r){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(x){Tt(n,r,x)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(x){Tt(n,r,x)}else o.current=null}function ab(n){var r=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(x){Tt(n,n.return,x)}}function Hf(n,r,o){try{var u=n.stateNode;Hk(u,n.type,o,r),u[Ke]=r}catch(x){Tt(n,n.return,x)}}function ob(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&ms(n.type)||n.tag===4}function $f(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||ob(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&ms(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Ff(n,r,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(n),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=ke));else if(u!==4&&(u===27&&ms(n.type)&&(o=n.stateNode,r=null),n=n.child,n!==null))for(Ff(n,r,o),n=n.sibling;n!==null;)Ff(n,r,o),n=n.sibling}function _u(n,r,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,r?o.insertBefore(n,r):o.appendChild(n);else if(u!==4&&(u===27&&ms(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(_u(n,r,o),n=n.sibling;n!==null;)_u(n,r,o),n=n.sibling}function lb(n){var r=n.stateNode,o=n.memoizedProps;try{for(var u=n.type,x=r.attributes;x.length;)r.removeAttributeNode(x[0]);Pn(r,u,o),r[Ee]=n,r[Ke]=o}catch(E){Tt(n,n.return,E)}}var Or=!1,vn=!1,Uf=!1,cb=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function bk(n,r){if(n=n.containerInfo,up=Pu,n=Sv(n),jd(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var x=u.anchorOffset,E=u.focusNode;u=u.focusOffset;try{o.nodeType,E.nodeType}catch{o=null;break e}var D=0,U=-1,Q=-1,le=0,me=0,be=n,ce=null;t:for(;;){for(var ue;be!==o||x!==0&&be.nodeType!==3||(U=D+x),be!==E||u!==0&&be.nodeType!==3||(Q=D+u),be.nodeType===3&&(D+=be.nodeValue.length),(ue=be.firstChild)!==null;)ce=be,be=ue;for(;;){if(be===n)break t;if(ce===o&&++le===x&&(U=D),ce===E&&++me===u&&(Q=D),(ue=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=ue}o=U===-1||Q===-1?null:{start:U,end:Q}}else o=null}o=o||{start:0,end:0}}else o=null;for(hp={focusedElem:n,selectionRange:o},Pu=!1,Cn=r;Cn!==null;)if(r=Cn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Cn=n;else for(;Cn!==null;){switch(r=Cn,E=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)x=n[o],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&E!==null){n=void 0,o=r,x=E.memoizedProps,E=E.memoizedState,u=o.stateNode;try{var Ne=Zs(o.type,x);n=u.getSnapshotBeforeUpdate(Ne,E),u.__reactInternalSnapshotBeforeUpdate=n}catch(Ge){Tt(o,o.return,Ge)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,o=n.nodeType,o===9)pp(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":pp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=r.sibling,n!==null){n.return=r.return,Cn=n;break}Cn=r.return}}function ub(n,r,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:jr(n,o),u&4&&dl(5,o);break;case 1:if(jr(n,o),u&4)if(n=o.stateNode,r===null)try{n.componentDidMount()}catch(D){Tt(o,o.return,D)}else{var x=Zs(o.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(x,r,n.__reactInternalSnapshotBeforeUpdate)}catch(D){Tt(o,o.return,D)}}u&64&&rb(o),u&512&&fl(o,o.return);break;case 3:if(jr(n,o),u&64&&(n=o.updateQueue,n!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Vv(n,r)}catch(D){Tt(o,o.return,D)}}break;case 27:r===null&&u&4&&lb(o);case 26:case 5:jr(n,o),r===null&&u&4&&ab(o),u&512&&fl(o,o.return);break;case 12:jr(n,o);break;case 31:jr(n,o),u&4&&fb(n,o);break;case 13:jr(n,o),u&4&&pb(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=Ak.bind(null,o),Vk(n,o))));break;case 22:if(u=o.memoizedState!==null||Or,!u){r=r!==null&&r.memoizedState!==null||vn,x=Or;var E=vn;Or=u,(vn=r)&&!E?Ir(n,o,(o.subtreeFlags&8772)!==0):jr(n,o),Or=x,vn=E}break;case 30:break;default:jr(n,o)}}function hb(n){var r=n.alternate;r!==null&&(n.alternate=null,hb(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&De(r)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Jt=null,ci=!1;function Dr(n,r,o){for(o=o.child;o!==null;)db(n,r,o),o=o.sibling}function db(n,r,o){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(wn,o)}catch{}switch(o.tag){case 26:vn||mr(o,r),Dr(n,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:vn||mr(o,r);var u=Jt,x=ci;ms(o.type)&&(Jt=o.stateNode,ci=!1),Dr(n,r,o),xl(o.stateNode),Jt=u,ci=x;break;case 5:vn||mr(o,r);case 6:if(u=Jt,x=ci,Jt=null,Dr(n,r,o),Jt=u,ci=x,Jt!==null)if(ci)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(o.stateNode)}catch(E){Tt(o,r,E)}else try{Jt.removeChild(o.stateNode)}catch(E){Tt(o,r,E)}break;case 18:Jt!==null&&(ci?(n=Jt,ry(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Ja(n)):ry(Jt,o.stateNode));break;case 4:u=Jt,x=ci,Jt=o.stateNode.containerInfo,ci=!0,Dr(n,r,o),Jt=u,ci=x;break;case 0:case 11:case 14:case 15:ls(2,o,r),vn||ls(4,o,r),Dr(n,r,o);break;case 1:vn||(mr(o,r),u=o.stateNode,typeof u.componentWillUnmount=="function"&&sb(o,r,u)),Dr(n,r,o);break;case 21:Dr(n,r,o);break;case 22:vn=(u=vn)||o.memoizedState!==null,Dr(n,r,o),vn=u;break;default:Dr(n,r,o)}}function fb(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Ja(n)}catch(o){Tt(r,r.return,o)}}}function pb(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Ja(n)}catch(o){Tt(r,r.return,o)}}function yk(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new cb),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new cb),r;default:throw Error(s(435,n.tag))}}function vu(n,r){var o=yk(n);r.forEach(function(u){if(!o.has(u)){o.add(u);var x=Rk.bind(null,n,u);u.then(x,x)}})}function ui(n,r){var o=r.deletions;if(o!==null)for(var u=0;u<o.length;u++){var x=o[u],E=n,D=r,U=D;e:for(;U!==null;){switch(U.tag){case 27:if(ms(U.type)){Jt=U.stateNode,ci=!1;break e}break;case 5:Jt=U.stateNode,ci=!1;break e;case 3:case 4:Jt=U.stateNode.containerInfo,ci=!0;break e}U=U.return}if(Jt===null)throw Error(s(160));db(E,D,x),Jt=null,ci=!1,E=x.alternate,E!==null&&(E.return=null),x.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)mb(r,n),r=r.sibling}var er=null;function mb(n,r){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ui(r,n),hi(n),u&4&&(ls(3,n,n.return),dl(3,n),ls(5,n,n.return));break;case 1:ui(r,n),hi(n),u&512&&(vn||o===null||mr(o,o.return)),u&64&&Or&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var x=er;if(ui(r,n),hi(n),u&512&&(vn||o===null||mr(o,o.return)),u&4){var E=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,x=x.ownerDocument||x;t:switch(u){case"title":E=x.getElementsByTagName("title")[0],(!E||E[Si]||E[Ee]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=x.createElement(u),x.head.insertBefore(E,x.querySelector("head > title"))),Pn(E,u,o),E[Ee]=n,Qe(E),u=E;break e;case"link":var D=my("link","href",x).get(u+(o.href||""));if(D){for(var U=0;U<D.length;U++)if(E=D[U],E.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&E.getAttribute("rel")===(o.rel==null?null:o.rel)&&E.getAttribute("title")===(o.title==null?null:o.title)&&E.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){D.splice(U,1);break t}}E=x.createElement(u),Pn(E,u,o),x.head.appendChild(E);break;case"meta":if(D=my("meta","content",x).get(u+(o.content||""))){for(U=0;U<D.length;U++)if(E=D[U],E.getAttribute("content")===(o.content==null?null:""+o.content)&&E.getAttribute("name")===(o.name==null?null:o.name)&&E.getAttribute("property")===(o.property==null?null:o.property)&&E.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&E.getAttribute("charset")===(o.charSet==null?null:o.charSet)){D.splice(U,1);break t}}E=x.createElement(u),Pn(E,u,o),x.head.appendChild(E);break;default:throw Error(s(468,u))}E[Ee]=n,Qe(E),u=E}n.stateNode=u}else gy(x,n.type,n.stateNode);else n.stateNode=py(x,u,n.memoizedProps);else E!==u?(E===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):E.count--,u===null?gy(x,n.type,n.stateNode):py(x,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Hf(n,n.memoizedProps,o.memoizedProps)}break;case 27:ui(r,n),hi(n),u&512&&(vn||o===null||mr(o,o.return)),o!==null&&u&4&&Hf(n,n.memoizedProps,o.memoizedProps);break;case 5:if(ui(r,n),hi(n),u&512&&(vn||o===null||mr(o,o.return)),n.flags&32){x=n.stateNode;try{qe(x,"")}catch(Ne){Tt(n,n.return,Ne)}}u&4&&n.stateNode!=null&&(x=n.memoizedProps,Hf(n,x,o!==null?o.memoizedProps:x)),u&1024&&(Uf=!0);break;case 6:if(ui(r,n),hi(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(Ne){Tt(n,n.return,Ne)}}break;case 3:if(Du=null,x=er,er=Nu(r.containerInfo),ui(r,n),er=x,hi(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Ja(r.containerInfo)}catch(Ne){Tt(n,n.return,Ne)}Uf&&(Uf=!1,gb(n));break;case 4:u=er,er=Nu(n.stateNode.containerInfo),ui(r,n),hi(n),er=u;break;case 12:ui(r,n),hi(n);break;case 31:ui(r,n),hi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,vu(n,u)));break;case 13:ui(r,n),hi(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(yu=pt()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,vu(n,u)));break;case 22:x=n.memoizedState!==null;var Q=o!==null&&o.memoizedState!==null,le=Or,me=vn;if(Or=le||x,vn=me||Q,ui(r,n),vn=me,Or=le,hi(n),u&8192)e:for(r=n.stateNode,r._visibility=x?r._visibility&-2:r._visibility|1,x&&(o===null||Q||Or||vn||Js(n)),o=null,r=n;;){if(r.tag===5||r.tag===26){if(o===null){Q=o=r;try{if(E=Q.stateNode,x)D=E.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{U=Q.stateNode;var be=Q.memoizedProps.style,ce=be!=null&&be.hasOwnProperty("display")?be.display:null;U.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Ne){Tt(Q,Q.return,Ne)}}}else if(r.tag===6){if(o===null){Q=r;try{Q.stateNode.nodeValue=x?"":Q.memoizedProps}catch(Ne){Tt(Q,Q.return,Ne)}}}else if(r.tag===18){if(o===null){Q=r;try{var ue=Q.stateNode;x?sy(ue,!0):sy(Q.stateNode,!1)}catch(Ne){Tt(Q,Q.return,Ne)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,vu(n,o))));break;case 19:ui(r,n),hi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,vu(n,u)));break;case 30:break;case 21:break;default:ui(r,n),hi(n)}}function hi(n){var r=n.flags;if(r&2){try{for(var o,u=n.return;u!==null;){if(ob(u)){o=u;break}u=u.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var x=o.stateNode,E=$f(n);_u(n,E,x);break;case 5:var D=o.stateNode;o.flags&32&&(qe(D,""),o.flags&=-33);var U=$f(n);_u(n,U,D);break;case 3:case 4:var Q=o.stateNode.containerInfo,le=$f(n);Ff(n,le,Q);break;default:throw Error(s(161))}}catch(me){Tt(n,n.return,me)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function gb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;gb(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function jr(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)ub(n,r.alternate,r),r=r.sibling}function Js(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:ls(4,r,r.return),Js(r);break;case 1:mr(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&sb(r,r.return,o),Js(r);break;case 27:xl(r.stateNode);case 26:case 5:mr(r,r.return),Js(r);break;case 22:r.memoizedState===null&&Js(r);break;case 30:Js(r);break;default:Js(r)}n=n.sibling}}function Ir(n,r,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,x=n,E=r,D=E.flags;switch(E.tag){case 0:case 11:case 15:Ir(x,E,o),dl(4,E);break;case 1:if(Ir(x,E,o),u=E,x=u.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(le){Tt(u,u.return,le)}if(u=E,x=u.updateQueue,x!==null){var U=u.stateNode;try{var Q=x.shared.hiddenCallbacks;if(Q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Q.length;x++)Kv(Q[x],U)}catch(le){Tt(u,u.return,le)}}o&&D&64&&rb(E),fl(E,E.return);break;case 27:lb(E);case 26:case 5:Ir(x,E,o),o&&u===null&&D&4&&ab(E),fl(E,E.return);break;case 12:Ir(x,E,o);break;case 31:Ir(x,E,o),o&&D&4&&fb(x,E);break;case 13:Ir(x,E,o),o&&D&4&&pb(x,E);break;case 22:E.memoizedState===null&&Ir(x,E,o),fl(E,E.return);break;case 30:break;default:Ir(x,E,o)}r=r.sibling}}function Wf(n,r){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&Qo(o))}function Gf(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Qo(n))}function tr(n,r,o,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)_b(n,r,o,u),r=r.sibling}function _b(n,r,o,u){var x=r.flags;switch(r.tag){case 0:case 11:case 15:tr(n,r,o,u),x&2048&&dl(9,r);break;case 1:tr(n,r,o,u);break;case 3:tr(n,r,o,u),x&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Qo(n)));break;case 12:if(x&2048){tr(n,r,o,u),n=r.stateNode;try{var E=r.memoizedProps,D=E.id,U=E.onPostCommit;typeof U=="function"&&U(D,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){Tt(r,r.return,Q)}}else tr(n,r,o,u);break;case 31:tr(n,r,o,u);break;case 13:tr(n,r,o,u);break;case 23:break;case 22:E=r.stateNode,D=r.alternate,r.memoizedState!==null?E._visibility&2?tr(n,r,o,u):pl(n,r):E._visibility&2?tr(n,r,o,u):(E._visibility|=2,$a(n,r,o,u,(r.subtreeFlags&10256)!==0||!1)),x&2048&&Wf(D,r);break;case 24:tr(n,r,o,u),x&2048&&Gf(r.alternate,r);break;default:tr(n,r,o,u)}}function $a(n,r,o,u,x){for(x=x&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var E=n,D=r,U=o,Q=u,le=D.flags;switch(D.tag){case 0:case 11:case 15:$a(E,D,U,Q,x),dl(8,D);break;case 23:break;case 22:var me=D.stateNode;D.memoizedState!==null?me._visibility&2?$a(E,D,U,Q,x):pl(E,D):(me._visibility|=2,$a(E,D,U,Q,x)),x&&le&2048&&Wf(D.alternate,D);break;case 24:$a(E,D,U,Q,x),x&&le&2048&&Gf(D.alternate,D);break;default:$a(E,D,U,Q,x)}r=r.sibling}}function pl(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=n,u=r,x=u.flags;switch(u.tag){case 22:pl(o,u),x&2048&&Wf(u.alternate,u);break;case 24:pl(o,u),x&2048&&Gf(u.alternate,u);break;default:pl(o,u)}r=r.sibling}}var ml=8192;function Fa(n,r,o){if(n.subtreeFlags&ml)for(n=n.child;n!==null;)vb(n,r,o),n=n.sibling}function vb(n,r,o){switch(n.tag){case 26:Fa(n,r,o),n.flags&ml&&n.memoizedState!==null&&aT(o,er,n.memoizedState,n.memoizedProps);break;case 5:Fa(n,r,o);break;case 3:case 4:var u=er;er=Nu(n.stateNode.containerInfo),Fa(n,r,o),er=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=ml,ml=16777216,Fa(n,r,o),ml=u):Fa(n,r,o));break;default:Fa(n,r,o)}}function bb(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function gl(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];Cn=u,Sb(u,n)}bb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)yb(n),n=n.sibling}function yb(n){switch(n.tag){case 0:case 11:case 15:gl(n),n.flags&2048&&ls(9,n,n.return);break;case 3:gl(n);break;case 12:gl(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,bu(n)):gl(n);break;default:gl(n)}}function bu(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];Cn=u,Sb(u,n)}bb(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:ls(8,r,r.return),bu(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,bu(r));break;default:bu(r)}n=n.sibling}}function Sb(n,r){for(;Cn!==null;){var o=Cn;switch(o.tag){case 0:case 11:case 15:ls(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Qo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,Cn=u;else e:for(o=n;Cn!==null;){u=Cn;var x=u.sibling,E=u.return;if(hb(u),u===o){Cn=null;break e}if(x!==null){x.return=E,Cn=x;break e}Cn=E}}}var Sk={getCacheForType:function(n){var r=In(mn),o=r.data.get(n);return o===void 0&&(o=n(),r.data.set(n,o)),o},cacheSignal:function(){return In(mn).controller.signal}},xk=typeof WeakMap=="function"?WeakMap:Map,yt=0,Pt=null,st=null,ct=0,kt=0,Ai=null,cs=!1,Ua=!1,qf=!1,Br=0,an=0,us=0,Qs=0,Kf=0,Ri=0,Wa=0,_l=null,di=null,Vf=!1,yu=0,xb=0,Su=1/0,xu=null,hs=null,Sn=0,ds=null,Ga=null,Pr=0,Yf=0,Xf=null,wb=null,vl=0,Zf=null;function Li(){return(yt&2)!==0&&ct!==0?ct&-ct:P.T!==null?ip():ot()}function Cb(){if(Ri===0)if((ct&536870912)===0||ht){var n=Bi;Bi<<=1,(Bi&3932160)===0&&(Bi=262144),Ri=n}else Ri=536870912;return n=ki.current,n!==null&&(n.flags|=32),Ri}function fi(n,r,o){(n===Pt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(qa(n,0),fs(n,ct,Ri,!1)),mt(n,o),((yt&2)===0||n!==Pt)&&(n===Pt&&((yt&2)===0&&(Qs|=o),an===4&&fs(n,ct,Ri,!1)),gr(n))}function Eb(n,r,o){if((yt&6)!==0)throw Error(s(327));var u=!o&&(r&127)===0&&(r&n.expiredLanes)===0||ge(n,r),x=u?Ek(n,r):Qf(n,r,!0),E=u;do{if(x===0){Ua&&!u&&fs(n,r,0,!1);break}else{if(o=n.current.alternate,E&&!wk(o)){x=Qf(n,r,!1),E=!1;continue}if(x===2){if(E=r,n.errorRecoveryDisabledLanes&E)var D=0;else D=n.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){r=D;e:{var U=n;x=_l;var Q=U.current.memoizedState.isDehydrated;if(Q&&(qa(U,D).flags|=256),D=Qf(U,D,!1),D!==2){if(qf&&!Q){U.errorRecoveryDisabledLanes|=E,Qs|=E,x=4;break e}E=di,di=x,E!==null&&(di===null?di=E:di.push.apply(di,E))}x=D}if(E=!1,x!==2)continue}}if(x===1){qa(n,0),fs(n,r,0,!0);break}e:{switch(u=n,E=x,E){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:fs(u,r,Ri,!cs);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(x=yu+300-pt(),10<x)){if(fs(u,r,Ri,!cs),ee(u,0,!0)!==0)break e;Pr=r,u.timeoutHandle=ny(kb.bind(null,u,o,di,xu,Vf,r,Ri,Qs,Wa,cs,E,"Throttled",-0,0),x);break e}kb(u,o,di,xu,Vf,r,Ri,Qs,Wa,cs,E,null,-0,0)}}break}while(!0);gr(n)}function kb(n,r,o,u,x,E,D,U,Q,le,me,be,ce,ue){if(n.timeoutHandle=-1,be=r.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ke},vb(r,E,be);var Ne=(E&62914560)===E?yu-pt():(E&4194048)===E?xb-pt():0;if(Ne=oT(be,Ne),Ne!==null){Pr=E,n.cancelPendingCommit=Ne(Db.bind(null,n,r,E,o,u,x,D,U,Q,me,be,null,ce,ue)),fs(n,E,D,!le);return}}Db(n,r,E,o,u,x,D,U,Q)}function wk(n){for(var r=n;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var x=o[u],E=x.getSnapshot;x=x.value;try{if(!Ci(E(),x))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function fs(n,r,o,u){r&=~Kf,r&=~Qs,n.suspendedLanes|=r,n.pingedLanes&=~r,u&&(n.warmLanes|=r),u=n.expirationTimes;for(var x=r;0<x;){var E=31-Yt(x),D=1<<E;u[E]=-1,x&=~D}o!==0&&Re(n,o,r)}function wu(){return(yt&6)===0?(bl(0),!1):!0}function Jf(){if(st!==null){if(kt===0)var n=st.return;else n=st,Tr=Ws=null,pf(n),Ia=null,tl=0,n=st;for(;n!==null;)ib(n.alternate,n),n=n.return;st=null}}function qa(n,r){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,Uk(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),Pr=0,Jf(),Pt=n,st=o=Er(n.current,null),ct=r,kt=0,Ai=null,cs=!1,Ua=ge(n,r),qf=!1,Wa=Ri=Kf=Qs=us=an=0,di=_l=null,Vf=!1,(r&8)!==0&&(r|=r&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=r;0<u;){var x=31-Yt(u),E=1<<x;r|=n[x],u&=~E}return Br=r,Wc(),o}function Tb(n,r){Je=null,P.H=cl,r===ja||r===Jc?(r=Uv(),kt=3):r===tf?(r=Uv(),kt=4):kt=r===Lf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ai=r,st===null&&(an=1,du(n,Hi(r,n.current)))}function Ab(){var n=ki.current;return n===null?!0:(ct&4194048)===ct?Wi===null:(ct&62914560)===ct||(ct&536870912)!==0?n===Wi:!1}function Rb(){var n=P.H;return P.H=cl,n===null?cl:n}function Lb(){var n=P.A;return P.A=Sk,n}function Cu(){an=4,cs||(ct&4194048)!==ct&&ki.current!==null||(Ua=!0),(us&134217727)===0&&(Qs&134217727)===0||Pt===null||fs(Pt,ct,Ri,!1)}function Qf(n,r,o){var u=yt;yt|=2;var x=Rb(),E=Lb();(Pt!==n||ct!==r)&&(xu=null,qa(n,r)),r=!1;var D=an;e:do try{if(kt!==0&&st!==null){var U=st,Q=Ai;switch(kt){case 8:Jf(),D=6;break e;case 3:case 2:case 9:case 6:ki.current===null&&(r=!0);var le=kt;if(kt=0,Ai=null,Ka(n,U,Q,le),o&&Ua){D=0;break e}break;default:le=kt,kt=0,Ai=null,Ka(n,U,Q,le)}}Ck(),D=an;break}catch(me){Tb(n,me)}while(!0);return r&&n.shellSuspendCounter++,Tr=Ws=null,yt=u,P.H=x,P.A=E,st===null&&(Pt=null,ct=0,Wc()),D}function Ck(){for(;st!==null;)Mb(st)}function Ek(n,r){var o=yt;yt|=2;var u=Rb(),x=Lb();Pt!==n||ct!==r?(xu=null,Su=pt()+500,qa(n,r)):Ua=ge(n,r);e:do try{if(kt!==0&&st!==null){r=st;var E=Ai;t:switch(kt){case 1:kt=0,Ai=null,Ka(n,r,E,1);break;case 2:case 9:if($v(E)){kt=0,Ai=null,Nb(r);break}r=function(){kt!==2&&kt!==9||Pt!==n||(kt=7),gr(n)},E.then(r,r);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:$v(E)?(kt=0,Ai=null,Nb(r)):(kt=0,Ai=null,Ka(n,r,E,7));break;case 5:var D=null;switch(st.tag){case 26:D=st.memoizedState;case 5:case 27:var U=st;if(D?_y(D):U.stateNode.complete){kt=0,Ai=null;var Q=U.sibling;if(Q!==null)st=Q;else{var le=U.return;le!==null?(st=le,Eu(le)):st=null}break t}}kt=0,Ai=null,Ka(n,r,E,5);break;case 6:kt=0,Ai=null,Ka(n,r,E,6);break;case 8:Jf(),an=6;break e;default:throw Error(s(462))}}kk();break}catch(me){Tb(n,me)}while(!0);return Tr=Ws=null,P.H=u,P.A=x,yt=o,st!==null?0:(Pt=null,ct=0,Wc(),an)}function kk(){for(;st!==null&&!Gn();)Mb(st)}function Mb(n){var r=tb(n.alternate,n,Br);n.memoizedProps=n.pendingProps,r===null?Eu(n):st=r}function Nb(n){var r=n,o=r.alternate;switch(r.tag){case 15:case 0:r=Y0(o,r,r.pendingProps,r.type,void 0,ct);break;case 11:r=Y0(o,r,r.pendingProps,r.type.render,r.ref,ct);break;case 5:pf(r);default:ib(o,r),r=st=Lv(r,Br),r=tb(o,r,Br)}n.memoizedProps=n.pendingProps,r===null?Eu(n):st=r}function Ka(n,r,o,u){Tr=Ws=null,pf(r),Ia=null,tl=0;var x=r.return;try{if(pk(n,x,r,o,ct)){an=1,du(n,Hi(o,n.current)),st=null;return}}catch(E){if(x!==null)throw st=x,E;an=1,du(n,Hi(o,n.current)),st=null;return}r.flags&32768?(ht||u===1?n=!0:Ua||(ct&536870912)!==0?n=!1:(cs=n=!0,(u===2||u===9||u===3||u===6)&&(u=ki.current,u!==null&&u.tag===13&&(u.flags|=16384))),Ob(r,n)):Eu(r)}function Eu(n){var r=n;do{if((r.flags&32768)!==0){Ob(r,cs);return}n=r.return;var o=_k(r.alternate,r,Br);if(o!==null){st=o;return}if(r=r.sibling,r!==null){st=r;return}st=r=n}while(r!==null);an===0&&(an=5)}function Ob(n,r){do{var o=vk(n.alternate,n);if(o!==null){o.flags&=32767,st=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(n=n.sibling,n!==null)){st=n;return}st=n=o}while(n!==null);an=6,st=null}function Db(n,r,o,u,x,E,D,U,Q){n.cancelPendingCommit=null;do ku();while(Sn!==0);if((yt&6)!==0)throw Error(s(327));if(r!==null){if(r===n.current)throw Error(s(177));if(E=r.lanes|r.childLanes,E|=Hd,Me(n,o,E,D,U,Q),n===Pt&&(st=Pt=null,ct=0),Ga=r,ds=n,Pr=o,Yf=E,Xf=x,wb=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,Lk(wt,function(){return zb(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=P.T,P.T=null,x=K.p,K.p=2,D=yt,yt|=4;try{bk(n,r,o)}finally{yt=D,K.p=x,P.T=u}}Sn=1,jb(),Ib(),Bb()}}function jb(){if(Sn===1){Sn=0;var n=ds,r=Ga,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=P.T,P.T=null;var u=K.p;K.p=2;var x=yt;yt|=4;try{mb(r,n);var E=hp,D=Sv(n.containerInfo),U=E.focusedElem,Q=E.selectionRange;if(D!==U&&U&&U.ownerDocument&&yv(U.ownerDocument.documentElement,U)){if(Q!==null&&jd(U)){var le=Q.start,me=Q.end;if(me===void 0&&(me=le),"selectionStart"in U)U.selectionStart=le,U.selectionEnd=Math.min(me,U.value.length);else{var be=U.ownerDocument||document,ce=be&&be.defaultView||window;if(ce.getSelection){var ue=ce.getSelection(),Ne=U.textContent.length,Ge=Math.min(Q.start,Ne),Mt=Q.end===void 0?Ge:Math.min(Q.end,Ne);!ue.extend&&Ge>Mt&&(D=Mt,Mt=Ge,Ge=D);var re=bv(U,Ge),ie=bv(U,Mt);if(re&&ie&&(ue.rangeCount!==1||ue.anchorNode!==re.node||ue.anchorOffset!==re.offset||ue.focusNode!==ie.node||ue.focusOffset!==ie.offset)){var oe=be.createRange();oe.setStart(re.node,re.offset),ue.removeAllRanges(),Ge>Mt?(ue.addRange(oe),ue.extend(ie.node,ie.offset)):(oe.setEnd(ie.node,ie.offset),ue.addRange(oe))}}}}for(be=[],ue=U;ue=ue.parentNode;)ue.nodeType===1&&be.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof U.focus=="function"&&U.focus(),U=0;U<be.length;U++){var ve=be[U];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Pu=!!up,hp=up=null}finally{yt=x,K.p=u,P.T=o}}n.current=r,Sn=2}}function Ib(){if(Sn===2){Sn=0;var n=ds,r=Ga,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=P.T,P.T=null;var u=K.p;K.p=2;var x=yt;yt|=4;try{ub(n,r.alternate,r)}finally{yt=x,K.p=u,P.T=o}}Sn=3}}function Bb(){if(Sn===4||Sn===3){Sn=0,en();var n=ds,r=Ga,o=Pr,u=wb;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Sn=5:(Sn=0,Ga=ds=null,Pb(n,n.pendingLanes));var x=n.pendingLanes;if(x===0&&(hs=null),de(o),r=r.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(wn,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=P.T,x=K.p,K.p=2,P.T=null;try{for(var E=n.onRecoverableError,D=0;D<u.length;D++){var U=u[D];E(U.value,{componentStack:U.stack})}}finally{P.T=r,K.p=x}}(Pr&3)!==0&&ku(),gr(n),x=n.pendingLanes,(o&261930)!==0&&(x&42)!==0?n===Zf?vl++:(vl=0,Zf=n):vl=0,bl(0)}}function Pb(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,Qo(r)))}function ku(){return jb(),Ib(),Bb(),zb()}function zb(){if(Sn!==5)return!1;var n=ds,r=Yf;Yf=0;var o=de(Pr),u=P.T,x=K.p;try{K.p=32>o?32:o,P.T=null,o=Xf,Xf=null;var E=ds,D=Pr;if(Sn=0,Ga=ds=null,Pr=0,(yt&6)!==0)throw Error(s(331));var U=yt;if(yt|=4,yb(E.current),_b(E,E.current,D,o),yt=U,bl(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(wn,E)}catch{}return!0}finally{K.p=x,P.T=u,Pb(n,r)}}function Hb(n,r,o){r=Hi(o,r),r=Rf(n.stateNode,r,2),n=ss(n,r,2),n!==null&&(mt(n,2),gr(n))}function Tt(n,r,o){if(n.tag===3)Hb(n,n,o);else for(;r!==null;){if(r.tag===3){Hb(r,n,o);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(hs===null||!hs.has(u))){n=Hi(o,n),o=$0(2),u=ss(r,o,2),u!==null&&(F0(o,u,r,n),mt(u,2),gr(u));break}}r=r.return}}function ep(n,r,o){var u=n.pingCache;if(u===null){u=n.pingCache=new xk;var x=new Set;u.set(r,x)}else x=u.get(r),x===void 0&&(x=new Set,u.set(r,x));x.has(o)||(qf=!0,x.add(o),n=Tk.bind(null,n,r,o),r.then(n,n))}function Tk(n,r,o){var u=n.pingCache;u!==null&&u.delete(r),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,Pt===n&&(ct&o)===o&&(an===4||an===3&&(ct&62914560)===ct&&300>pt()-yu?(yt&2)===0&&qa(n,0):Kf|=o,Wa===ct&&(Wa=0)),gr(n)}function $b(n,r){r===0&&(r=He()),n=$s(n,r),n!==null&&(mt(n,r),gr(n))}function Ak(n){var r=n.memoizedState,o=0;r!==null&&(o=r.retryLane),$b(n,o)}function Rk(n,r){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,x=n.memoizedState;x!==null&&(o=x.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),$b(n,o)}function Lk(n,r){return xt(n,r)}var Tu=null,Va=null,tp=!1,Au=!1,np=!1,ps=0;function gr(n){n!==Va&&n.next===null&&(Va===null?Tu=Va=n:Va=Va.next=n),Au=!0,tp||(tp=!0,Nk())}function bl(n,r){if(!np&&Au){np=!0;do for(var o=!1,u=Tu;u!==null;){if(n!==0){var x=u.pendingLanes;if(x===0)var E=0;else{var D=u.suspendedLanes,U=u.pingedLanes;E=(1<<31-Yt(42|n)+1)-1,E&=x&~(D&~U),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(o=!0,Gb(u,E))}else E=ct,E=ee(u,u===Pt?E:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(E&3)===0||ge(u,E)||(o=!0,Gb(u,E));u=u.next}while(o);np=!1}}function Mk(){Fb()}function Fb(){Au=tp=!1;var n=0;ps!==0&&Fk()&&(n=ps);for(var r=pt(),o=null,u=Tu;u!==null;){var x=u.next,E=Ub(u,r);E===0?(u.next=null,o===null?Tu=x:o.next=x,x===null&&(Va=o)):(o=u,(n!==0||(E&3)!==0)&&(Au=!0)),u=x}Sn!==0&&Sn!==5||bl(n),ps!==0&&(ps=0)}function Ub(n,r){for(var o=n.suspendedLanes,u=n.pingedLanes,x=n.expirationTimes,E=n.pendingLanes&-62914561;0<E;){var D=31-Yt(E),U=1<<D,Q=x[D];Q===-1?((U&o)===0||(U&u)!==0)&&(x[D]=we(U,r)):Q<=r&&(n.expiredLanes|=U),E&=~U}if(r=Pt,o=ct,o=ee(n,n===r?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===r&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&Wn(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||ge(n,o)){if(r=o&-o,r===n.callbackPriority)return r;switch(u!==null&&Wn(u),de(o)){case 2:case 8:o=Ut;break;case 32:o=wt;break;case 268435456:o=xn;break;default:o=wt}return u=Wb.bind(null,n),o=xt(o,u),n.callbackPriority=r,n.callbackNode=o,r}return u!==null&&u!==null&&Wn(u),n.callbackPriority=2,n.callbackNode=null,2}function Wb(n,r){if(Sn!==0&&Sn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(ku()&&n.callbackNode!==o)return null;var u=ct;return u=ee(n,n===Pt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Eb(n,u,r),Ub(n,pt()),n.callbackNode!=null&&n.callbackNode===o?Wb.bind(null,n):null)}function Gb(n,r){if(ku())return null;Eb(n,r,!0)}function Nk(){Wk(function(){(yt&6)!==0?xt(zt,Mk):Fb()})}function ip(){if(ps===0){var n=Oa;n===0&&(n=vi,vi<<=1,(vi&261888)===0&&(vi=256)),ps=n}return ps}function qb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Zr(""+n)}function Kb(n,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,n.id&&o.setAttribute("form",n.id),r.parentNode.insertBefore(o,r),n=new FormData(n),o.parentNode.removeChild(o),n}function Ok(n,r,o,u,x){if(r==="submit"&&o&&o.stateNode===x){var E=qb((x[Ke]||null).action),D=u.submitter;D&&(r=(r=D[Ke]||null)?qb(r.formAction):D.getAttribute("formAction"),r!==null&&(E=r,D=null));var U=new Hc("action","action",null,u,x);n.push({event:U,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ps!==0){var Q=D?Kb(x,D):new FormData(x);wf(o,{pending:!0,data:Q,method:x.method,action:E},null,Q)}}else typeof E=="function"&&(U.preventDefault(),Q=D?Kb(x,D):new FormData(x),wf(o,{pending:!0,data:Q,method:x.method,action:E},E,Q))},currentTarget:x}]})}}for(var rp=0;rp<zd.length;rp++){var sp=zd[rp],Dk=sp.toLowerCase(),jk=sp[0].toUpperCase()+sp.slice(1);Qi(Dk,"on"+jk)}Qi(Cv,"onAnimationEnd"),Qi(Ev,"onAnimationIteration"),Qi(kv,"onAnimationStart"),Qi("dblclick","onDoubleClick"),Qi("focusin","onFocus"),Qi("focusout","onBlur"),Qi(Z5,"onTransitionRun"),Qi(J5,"onTransitionStart"),Qi(Q5,"onTransitionCancel"),Qi(Tv,"onTransitionEnd"),Se("onMouseEnter",["mouseout","mouseover"]),Se("onMouseLeave",["mouseout","mouseover"]),Se("onPointerEnter",["pointerout","pointerover"]),Se("onPointerLeave",["pointerout","pointerover"]),rn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rn("onBeforeInput",["compositionend","keypress","textInput","paste"]),rn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yl="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(" "),Ik=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yl));function Vb(n,r){r=(r&4)!==0;for(var o=0;o<n.length;o++){var u=n[o],x=u.event;u=u.listeners;e:{var E=void 0;if(r)for(var D=u.length-1;0<=D;D--){var U=u[D],Q=U.instance,le=U.currentTarget;if(U=U.listener,Q!==E&&x.isPropagationStopped())break e;E=U,x.currentTarget=le;try{E(x)}catch(me){Uc(me)}x.currentTarget=null,E=Q}else for(D=0;D<u.length;D++){if(U=u[D],Q=U.instance,le=U.currentTarget,U=U.listener,Q!==E&&x.isPropagationStopped())break e;E=U,x.currentTarget=le;try{E(x)}catch(me){Uc(me)}x.currentTarget=null,E=Q}}}}function at(n,r){var o=r[On];o===void 0&&(o=r[On]=new Set);var u=n+"__bubble";o.has(u)||(Yb(r,n,2,!1),o.add(u))}function ap(n,r,o){var u=0;r&&(u|=4),Yb(o,n,u,r)}var Ru="_reactListening"+Math.random().toString(36).slice(2);function op(n){if(!n[Ru]){n[Ru]=!0,Bt.forEach(function(o){o!=="selectionchange"&&(Ik.has(o)||ap(o,!1,n),ap(o,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[Ru]||(r[Ru]=!0,ap("selectionchange",!1,r))}}function Yb(n,r,o,u){switch(Cy(r)){case 2:var x=uT;break;case 8:x=hT;break;default:x=xp}o=x.bind(null,r,o,n),x=void 0,!kd||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(x=!0),u?x!==void 0?n.addEventListener(r,o,{capture:!0,passive:x}):n.addEventListener(r,o,!0):x!==void 0?n.addEventListener(r,o,{passive:x}):n.addEventListener(r,o,!1)}function lp(n,r,o,u,x){var E=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var D=u.tag;if(D===3||D===4){var U=u.stateNode.containerInfo;if(U===x)break;if(D===4)for(D=u.return;D!==null;){var Q=D.tag;if((Q===3||Q===4)&&D.stateNode.containerInfo===x)return;D=D.return}for(;U!==null;){if(D=X(U),D===null)return;if(Q=D.tag,Q===5||Q===6||Q===26||Q===27){u=E=D;continue e}U=U.parentNode}}u=u.return}Ic(function(){var le=E,me=Ze(o),be=[];e:{var ce=Av.get(n);if(ce!==void 0){var ue=Hc,Ne=n;switch(n){case"keypress":if(Pc(o)===0)break e;case"keydown":case"keyup":ue=R5;break;case"focusin":Ne="focus",ue=Ld;break;case"focusout":Ne="blur",ue=Ld;break;case"beforeblur":case"afterblur":ue=Ld;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=iv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=_5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=N5;break;case Cv:case Ev:case kv:ue=y5;break;case Tv:ue=D5;break;case"scroll":case"scrollend":ue=m5;break;case"wheel":ue=I5;break;case"copy":case"cut":case"paste":ue=x5;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=sv;break;case"toggle":case"beforetoggle":ue=P5}var Ge=(r&4)!==0,Mt=!Ge&&(n==="scroll"||n==="scrollend"),re=Ge?ce!==null?ce+"Capture":null:ce;Ge=[];for(var ie=le,oe;ie!==null;){var ve=ie;if(oe=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||oe===null||re===null||(ve=Fo(ie,re),ve!=null&&Ge.push(Sl(ie,ve,oe))),Mt)break;ie=ie.return}0<Ge.length&&(ce=new ue(ce,Ne,null,o,me),be.push({event:ce,listeners:Ge}))}}if((r&7)===0){e:{if(ce=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",ce&&o!==je&&(Ne=o.relatedTarget||o.fromElement)&&(X(Ne)||Ne[It]))break e;if((ue||ce)&&(ce=me.window===me?me:(ce=me.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(Ne=o.relatedTarget||o.toElement,ue=le,Ne=Ne?X(Ne):null,Ne!==null&&(Mt=d(Ne),Ge=Ne.tag,Ne!==Mt||Ge!==5&&Ge!==27&&Ge!==6)&&(Ne=null)):(ue=null,Ne=le),ue!==Ne)){if(Ge=iv,ve="onMouseLeave",re="onMouseEnter",ie="mouse",(n==="pointerout"||n==="pointerover")&&(Ge=sv,ve="onPointerLeave",re="onPointerEnter",ie="pointer"),Mt=ue==null?ce:Te(ue),oe=Ne==null?ce:Te(Ne),ce=new Ge(ve,ie+"leave",ue,o,me),ce.target=Mt,ce.relatedTarget=oe,ve=null,X(me)===le&&(Ge=new Ge(re,ie+"enter",Ne,o,me),Ge.target=oe,Ge.relatedTarget=Mt,ve=Ge),Mt=ve,ue&&Ne)t:{for(Ge=Bk,re=ue,ie=Ne,oe=0,ve=re;ve;ve=Ge(ve))oe++;ve=0;for(var Fe=ie;Fe;Fe=Ge(Fe))ve++;for(;0<oe-ve;)re=Ge(re),oe--;for(;0<ve-oe;)ie=Ge(ie),ve--;for(;oe--;){if(re===ie||ie!==null&&re===ie.alternate){Ge=re;break t}re=Ge(re),ie=Ge(ie)}Ge=null}else Ge=null;ue!==null&&Xb(be,ce,ue,Ge,!1),Ne!==null&&Mt!==null&&Xb(be,Mt,Ne,Ge,!0)}}e:{if(ce=le?Te(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var _t=fv;else if(hv(ce))if(pv)_t=V5;else{_t=q5;var Ie=G5}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Xr(le.elementType)&&(_t=fv):_t=K5;if(_t&&(_t=_t(n,le))){dv(be,_t,o,me);break e}Ie&&Ie(n,ce,le),n==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&xa(ce,"number",ce.value)}switch(Ie=le?Te(le):window,n){case"focusin":(hv(Ie)||Ie.contentEditable==="true")&&(Ea=Ie,Id=le,Xo=null);break;case"focusout":Xo=Id=Ea=null;break;case"mousedown":Bd=!0;break;case"contextmenu":case"mouseup":case"dragend":Bd=!1,xv(be,o,me);break;case"selectionchange":if(X5)break;case"keydown":case"keyup":xv(be,o,me)}var et;if(Nd)e:{switch(n){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else Ca?cv(n,o)&&(ut="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(ut="onCompositionStart");ut&&(av&&o.locale!=="ko"&&(Ca||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&Ca&&(et=tv()):(Jr=me,Td="value"in Jr?Jr.value:Jr.textContent,Ca=!0)),Ie=Lu(le,ut),0<Ie.length&&(ut=new rv(ut,n,null,o,me),be.push({event:ut,listeners:Ie}),et?ut.data=et:(et=uv(o),et!==null&&(ut.data=et)))),(et=H5?$5(n,o):F5(n,o))&&(ut=Lu(le,"onBeforeInput"),0<ut.length&&(Ie=new rv("onBeforeInput","beforeinput",null,o,me),be.push({event:Ie,listeners:ut}),Ie.data=et)),Ok(be,n,le,o,me)}Vb(be,r)})}function Sl(n,r,o){return{instance:n,listener:r,currentTarget:o}}function Lu(n,r){for(var o=r+"Capture",u=[];n!==null;){var x=n,E=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||E===null||(x=Fo(n,o),x!=null&&u.unshift(Sl(n,x,E)),x=Fo(n,r),x!=null&&u.push(Sl(n,x,E))),n.tag===3)return u;n=n.return}return[]}function Bk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Xb(n,r,o,u,x){for(var E=r._reactName,D=[];o!==null&&o!==u;){var U=o,Q=U.alternate,le=U.stateNode;if(U=U.tag,Q!==null&&Q===u)break;U!==5&&U!==26&&U!==27||le===null||(Q=le,x?(le=Fo(o,E),le!=null&&D.unshift(Sl(o,le,Q))):x||(le=Fo(o,E),le!=null&&D.push(Sl(o,le,Q)))),o=o.return}D.length!==0&&n.push({event:r,listeners:D})}var Pk=/\r\n?/g,zk=/\u0000|\uFFFD/g;function Zb(n){return(typeof n=="string"?n:""+n).replace(Pk,`
9
+ `).replace(zk,"")}function Jb(n,r){return r=Zb(r),Zb(n)===r}function Lt(n,r,o,u,x,E){switch(o){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||qe(n,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&qe(n,""+u);break;case"className":xi(n,"class",u);break;case"tabIndex":xi(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":xi(n,o,u);break;case"style":Et(n,u,E);break;case"data":if(r!=="object"){xi(n,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Zr(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(o,"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 E=="function"&&(o==="formAction"?(r!=="input"&&Lt(n,r,"name",x.name,x,null),Lt(n,r,"formEncType",x.formEncType,x,null),Lt(n,r,"formMethod",x.formMethod,x,null),Lt(n,r,"formTarget",x.formTarget,x,null)):(Lt(n,r,"encType",x.encType,x,null),Lt(n,r,"method",x.method,x,null),Lt(n,r,"target",x.target,x,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Zr(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=ke);break;case"onScroll":u!=null&&at("scroll",n);break;case"onScrollEnd":u!=null&&at("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(o=u.__html,o!=null){if(x.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=Zr(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):n.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":at("beforetoggle",n),at("toggle",n),qn(n,"popover",u);break;case"xlinkActuate":ai(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ai(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ai(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ai(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ai(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ai(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ai(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ai(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ai(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":qn(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=wr.get(o)||o,qn(n,o,u))}}function cp(n,r,o,u,x,E){switch(o){case"style":Et(n,u,E);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(o=u.__html,o!=null){if(x.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"children":typeof u=="string"?qe(n,u):(typeof u=="number"||typeof u=="bigint")&&qe(n,""+u);break;case"onScroll":u!=null&&at("scroll",n);break;case"onScrollEnd":u!=null&&at("scrollend",n);break;case"onClick":u!=null&&(n.onclick=ke);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xt.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(x=o.endsWith("Capture"),r=o.slice(2,x?o.length-7:void 0),E=n[Ke]||null,E=E!=null?E[o]:null,typeof E=="function"&&n.removeEventListener(r,E,x),typeof u=="function")){typeof E!="function"&&E!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(r,u,x);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):qn(n,o,u)}}}function Pn(n,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",n),at("load",n);var u=!1,x=!1,E;for(E in o)if(o.hasOwnProperty(E)){var D=o[E];if(D!=null)switch(E){case"src":u=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Lt(n,r,E,D,o,null)}}x&&Lt(n,r,"srcSet",o.srcSet,o,null),u&&Lt(n,r,"src",o.src,o,null);return;case"input":at("invalid",n);var U=E=D=x=null,Q=null,le=null;for(u in o)if(o.hasOwnProperty(u)){var me=o[u];if(me!=null)switch(u){case"name":x=me;break;case"type":D=me;break;case"checked":Q=me;break;case"defaultChecked":le=me;break;case"value":E=me;break;case"defaultValue":U=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(s(137,r));break;default:Lt(n,r,u,me,o,null)}}Bs(n,E,U,Q,le,D,x,!1);return;case"select":at("invalid",n),u=D=E=null;for(x in o)if(o.hasOwnProperty(x)&&(U=o[x],U!=null))switch(x){case"value":E=U;break;case"defaultValue":D=U;break;case"multiple":u=U;default:Lt(n,r,x,U,o,null)}r=E,o=D,n.multiple=!!u,r!=null?Dn(n,!!u,r,!1):o!=null&&Dn(n,!!u,o,!0);return;case"textarea":at("invalid",n),E=x=u=null;for(D in o)if(o.hasOwnProperty(D)&&(U=o[D],U!=null))switch(D){case"value":u=U;break;case"defaultValue":x=U;break;case"children":E=U;break;case"dangerouslySetInnerHTML":if(U!=null)throw Error(s(91));break;default:Lt(n,r,D,U,o,null)}wa(n,u,x,E);return;case"option":for(Q in o)o.hasOwnProperty(Q)&&(u=o[Q],u!=null)&&(Q==="selected"?n.selected=u&&typeof u!="function"&&typeof u!="symbol":Lt(n,r,Q,u,o,null));return;case"dialog":at("beforetoggle",n),at("toggle",n),at("cancel",n),at("close",n);break;case"iframe":case"object":at("load",n);break;case"video":case"audio":for(u=0;u<yl.length;u++)at(yl[u],n);break;case"image":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"embed":case"source":case"link":at("error",n),at("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in o)if(o.hasOwnProperty(le)&&(u=o[le],u!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Lt(n,r,le,u,o,null)}return;default:if(Xr(r)){for(me in o)o.hasOwnProperty(me)&&(u=o[me],u!==void 0&&cp(n,r,me,u,o,void 0));return}}for(U in o)o.hasOwnProperty(U)&&(u=o[U],u!=null&&Lt(n,r,U,u,o,null))}function Hk(n,r,o,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,E=null,D=null,U=null,Q=null,le=null,me=null;for(ue in o){var be=o[ue];if(o.hasOwnProperty(ue)&&be!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":Q=be;default:u.hasOwnProperty(ue)||Lt(n,r,ue,null,u,be)}}for(var ce in u){var ue=u[ce];if(be=o[ce],u.hasOwnProperty(ce)&&(ue!=null||be!=null))switch(ce){case"type":E=ue;break;case"name":x=ue;break;case"checked":le=ue;break;case"defaultChecked":me=ue;break;case"value":D=ue;break;case"defaultValue":U=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,r));break;default:ue!==be&&Lt(n,r,ce,ue,u,be)}}zo(n,D,U,Q,le,me,E,x);return;case"select":ue=D=U=ce=null;for(E in o)if(Q=o[E],o.hasOwnProperty(E)&&Q!=null)switch(E){case"value":break;case"multiple":ue=Q;default:u.hasOwnProperty(E)||Lt(n,r,E,null,u,Q)}for(x in u)if(E=u[x],Q=o[x],u.hasOwnProperty(x)&&(E!=null||Q!=null))switch(x){case"value":ce=E;break;case"defaultValue":U=E;break;case"multiple":D=E;default:E!==Q&&Lt(n,r,x,E,u,Q)}r=U,o=D,u=ue,ce!=null?Dn(n,!!o,ce,!1):!!u!=!!o&&(r!=null?Dn(n,!!o,r,!0):Dn(n,!!o,o?[]:"",!1));return;case"textarea":ue=ce=null;for(U in o)if(x=o[U],o.hasOwnProperty(U)&&x!=null&&!u.hasOwnProperty(U))switch(U){case"value":break;case"children":break;default:Lt(n,r,U,null,u,x)}for(D in u)if(x=u[D],E=o[D],u.hasOwnProperty(D)&&(x!=null||E!=null))switch(D){case"value":ce=x;break;case"defaultValue":ue=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(s(91));break;default:x!==E&&Lt(n,r,D,x,u,E)}Dc(n,ce,ue);return;case"option":for(var Ne in o)ce=o[Ne],o.hasOwnProperty(Ne)&&ce!=null&&!u.hasOwnProperty(Ne)&&(Ne==="selected"?n.selected=!1:Lt(n,r,Ne,null,u,ce));for(Q in u)ce=u[Q],ue=o[Q],u.hasOwnProperty(Q)&&ce!==ue&&(ce!=null||ue!=null)&&(Q==="selected"?n.selected=ce&&typeof ce!="function"&&typeof ce!="symbol":Lt(n,r,Q,ce,u,ue));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ge in o)ce=o[Ge],o.hasOwnProperty(Ge)&&ce!=null&&!u.hasOwnProperty(Ge)&&Lt(n,r,Ge,null,u,ce);for(le in u)if(ce=u[le],ue=o[le],u.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,r));break;default:Lt(n,r,le,ce,u,ue)}return;default:if(Xr(r)){for(var Mt in o)ce=o[Mt],o.hasOwnProperty(Mt)&&ce!==void 0&&!u.hasOwnProperty(Mt)&&cp(n,r,Mt,void 0,u,ce);for(me in u)ce=u[me],ue=o[me],!u.hasOwnProperty(me)||ce===ue||ce===void 0&&ue===void 0||cp(n,r,me,ce,u,ue);return}}for(var re in o)ce=o[re],o.hasOwnProperty(re)&&ce!=null&&!u.hasOwnProperty(re)&&Lt(n,r,re,null,u,ce);for(be in u)ce=u[be],ue=o[be],!u.hasOwnProperty(be)||ce===ue||ce==null&&ue==null||Lt(n,r,be,ce,u,ue)}function Qb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $k(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var x=o[u],E=x.transferSize,D=x.initiatorType,U=x.duration;if(E&&U&&Qb(D)){for(D=0,U=x.responseEnd,u+=1;u<o.length;u++){var Q=o[u],le=Q.startTime;if(le>U)break;var me=Q.transferSize,be=Q.initiatorType;me&&Qb(be)&&(Q=Q.responseEnd,D+=me*(Q<U?1:(U-le)/(Q-le)))}if(--u,r+=8*(E+D)/(x.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var up=null,hp=null;function Mu(n){return n.nodeType===9?n:n.ownerDocument}function ey(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ty(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function dp(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var fp=null;function Fk(){var n=window.event;return n&&n.type==="popstate"?n===fp?!1:(fp=n,!0):(fp=null,!1)}var ny=typeof setTimeout=="function"?setTimeout:void 0,Uk=typeof clearTimeout=="function"?clearTimeout:void 0,iy=typeof Promise=="function"?Promise:void 0,Wk=typeof queueMicrotask=="function"?queueMicrotask:typeof iy<"u"?function(n){return iy.resolve(null).then(n).catch(Gk)}:ny;function Gk(n){setTimeout(function(){throw n})}function ms(n){return n==="head"}function ry(n,r){var o=r,u=0;do{var x=o.nextSibling;if(n.removeChild(o),x&&x.nodeType===8)if(o=x.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(x),Ja(r);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")xl(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,xl(o);for(var E=o.firstChild;E;){var D=E.nextSibling,U=E.nodeName;E[Si]||U==="SCRIPT"||U==="STYLE"||U==="LINK"&&E.rel.toLowerCase()==="stylesheet"||o.removeChild(E),E=D}}else o==="body"&&xl(n.ownerDocument.body);o=x}while(o);Ja(r)}function sy(n,r){var o=n;n=0;do{var u=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function pp(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":pp(o),De(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function qk(n,r,o,u){for(;n.nodeType===1;){var x=o;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[Si])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(E=n.getAttribute("rel"),E==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(E!==x.rel||n.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||n.getAttribute("title")!==(x.title==null?null:x.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(E=n.getAttribute("src"),(E!==(x.src==null?null:x.src)||n.getAttribute("type")!==(x.type==null?null:x.type)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&E&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var E=x.name==null?null:""+x.name;if(x.type==="hidden"&&n.getAttribute("name")===E)return n}else return n;if(n=Gi(n.nextSibling),n===null)break}return null}function Kk(n,r,o){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Gi(n.nextSibling),n===null))return null;return n}function ay(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Gi(n.nextSibling),n===null))return null;return n}function mp(n){return n.data==="$?"||n.data==="$~"}function gp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Vk(n,r){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||o.readyState!=="loading")r();else{var u=function(){r(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function Gi(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var _p=null;function oy(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(r===0)return Gi(n.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}n=n.nextSibling}return null}function ly(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return n;r--}else o!=="/$"&&o!=="/&"||r++}n=n.previousSibling}return null}function cy(n,r,o){switch(r=Mu(o),n){case"html":if(n=r.documentElement,!n)throw Error(s(452));return n;case"head":if(n=r.head,!n)throw Error(s(453));return n;case"body":if(n=r.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function xl(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);De(n)}var qi=new Map,uy=new Set;function Nu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var zr=K.d;K.d={f:Yk,r:Xk,D:Zk,C:Jk,L:Qk,m:eT,X:nT,S:tT,M:iT};function Yk(){var n=zr.f(),r=wu();return n||r}function Xk(n){var r=_e(n);r!==null&&r.tag===5&&r.type==="form"?T0(r):zr.r(n)}var Ya=typeof document>"u"?null:document;function hy(n,r,o){var u=Ya;if(u&&typeof r=="string"&&r){var x=oi(r);x='link[rel="'+n+'"][href="'+x+'"]',typeof o=="string"&&(x+='[crossorigin="'+o+'"]'),uy.has(x)||(uy.add(x),n={rel:n,crossOrigin:o,href:r},u.querySelector(x)===null&&(r=u.createElement("link"),Pn(r,"link",n),Qe(r),u.head.appendChild(r)))}}function Zk(n){zr.D(n),hy("dns-prefetch",n,null)}function Jk(n,r){zr.C(n,r),hy("preconnect",n,r)}function Qk(n,r,o){zr.L(n,r,o);var u=Ya;if(u&&n&&r){var x='link[rel="preload"][as="'+oi(r)+'"]';r==="image"&&o&&o.imageSrcSet?(x+='[imagesrcset="'+oi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(x+='[imagesizes="'+oi(o.imageSizes)+'"]')):x+='[href="'+oi(n)+'"]';var E=x;switch(r){case"style":E=Xa(n);break;case"script":E=Za(n)}qi.has(E)||(n=m({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:n,as:r},o),qi.set(E,n),u.querySelector(x)!==null||r==="style"&&u.querySelector(wl(E))||r==="script"&&u.querySelector(Cl(E))||(r=u.createElement("link"),Pn(r,"link",n),Qe(r),u.head.appendChild(r)))}}function eT(n,r){zr.m(n,r);var o=Ya;if(o&&n){var u=r&&typeof r.as=="string"?r.as:"script",x='link[rel="modulepreload"][as="'+oi(u)+'"][href="'+oi(n)+'"]',E=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Za(n)}if(!qi.has(E)&&(n=m({rel:"modulepreload",href:n},r),qi.set(E,n),o.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Cl(E)))return}u=o.createElement("link"),Pn(u,"link",n),Qe(u),o.head.appendChild(u)}}}function tT(n,r,o){zr.S(n,r,o);var u=Ya;if(u&&n){var x=nt(u).hoistableStyles,E=Xa(n);r=r||"default";var D=x.get(E);if(!D){var U={loading:0,preload:null};if(D=u.querySelector(wl(E)))U.loading=5;else{n=m({rel:"stylesheet",href:n,"data-precedence":r},o),(o=qi.get(E))&&vp(n,o);var Q=D=u.createElement("link");Qe(Q),Pn(Q,"link",n),Q._p=new Promise(function(le,me){Q.onload=le,Q.onerror=me}),Q.addEventListener("load",function(){U.loading|=1}),Q.addEventListener("error",function(){U.loading|=2}),U.loading|=4,Ou(D,r,u)}D={type:"stylesheet",instance:D,count:1,state:U},x.set(E,D)}}}function nT(n,r){zr.X(n,r);var o=Ya;if(o&&n){var u=nt(o).hoistableScripts,x=Za(n),E=u.get(x);E||(E=o.querySelector(Cl(x)),E||(n=m({src:n,async:!0},r),(r=qi.get(x))&&bp(n,r),E=o.createElement("script"),Qe(E),Pn(E,"link",n),o.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},u.set(x,E))}}function iT(n,r){zr.M(n,r);var o=Ya;if(o&&n){var u=nt(o).hoistableScripts,x=Za(n),E=u.get(x);E||(E=o.querySelector(Cl(x)),E||(n=m({src:n,async:!0,type:"module"},r),(r=qi.get(x))&&bp(n,r),E=o.createElement("script"),Qe(E),Pn(E,"link",n),o.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},u.set(x,E))}}function dy(n,r,o,u){var x=(x=he.current)?Nu(x):null;if(!x)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Xa(o.href),o=nt(x).hoistableStyles,u=o.get(r),u||(u={type:"style",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=Xa(o.href);var E=nt(x).hoistableStyles,D=E.get(n);if(D||(x=x.ownerDocument||x,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(n,D),(E=x.querySelector(wl(n)))&&!E._p&&(D.instance=E,D.state.loading=5),qi.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},qi.set(n,o),E||rT(x,n,o,D.state))),r&&u===null)throw Error(s(528,""));return D}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Za(o),o=nt(x).hoistableScripts,u=o.get(r),u||(u={type:"script",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Xa(n){return'href="'+oi(n)+'"'}function wl(n){return'link[rel="stylesheet"]['+n+"]"}function fy(n){return m({},n,{"data-precedence":n.precedence,precedence:null})}function rT(n,r,o,u){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=n.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),Pn(r,"link",o),Qe(r),n.head.appendChild(r))}function Za(n){return'[src="'+oi(n)+'"]'}function Cl(n){return"script[async]"+n}function py(n,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var u=n.querySelector('style[data-href~="'+oi(o.href)+'"]');if(u)return r.instance=u,Qe(u),u;var x=m({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Qe(u),Pn(u,"style",x),Ou(u,o.precedence,n),r.instance=u;case"stylesheet":x=Xa(o.href);var E=n.querySelector(wl(x));if(E)return r.state.loading|=4,r.instance=E,Qe(E),E;u=fy(o),(x=qi.get(x))&&vp(u,x),E=(n.ownerDocument||n).createElement("link"),Qe(E);var D=E;return D._p=new Promise(function(U,Q){D.onload=U,D.onerror=Q}),Pn(E,"link",u),r.state.loading|=4,Ou(E,o.precedence,n),r.instance=E;case"script":return E=Za(o.src),(x=n.querySelector(Cl(E)))?(r.instance=x,Qe(x),x):(u=o,(x=qi.get(E))&&(u=m({},o),bp(u,x)),n=n.ownerDocument||n,x=n.createElement("script"),Qe(x),Pn(x,"link",u),n.head.appendChild(x),r.instance=x);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Ou(u,o.precedence,n));return r.instance}function Ou(n,r,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,E=x,D=0;D<u.length;D++){var U=u[D];if(U.dataset.precedence===r)E=U;else if(E!==x)break}E?E.parentNode.insertBefore(n,E.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(n,r.firstChild))}function vp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function bp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var Du=null;function my(n,r,o){if(Du===null){var u=new Map,x=Du=new Map;x.set(o,u)}else x=Du,u=x.get(o),u||(u=new Map,x.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),x=0;x<o.length;x++){var E=o[x];if(!(E[Si]||E[Ee]||n==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var D=E.getAttribute(r)||"";D=n+D;var U=u.get(D);U?U.push(E):u.set(D,[E])}}return u}function gy(n,r,o){n=n.ownerDocument||n,n.head.insertBefore(o,r==="title"?n.querySelector("head > title"):null)}function sT(n,r,o){if(o===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(n=r.disabled,typeof r.precedence=="string"&&n==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function _y(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function aT(n,r,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var x=Xa(u.href),E=r.querySelector(wl(x));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=ju.bind(n),r.then(n,n)),o.state.loading|=4,o.instance=E,Qe(E);return}E=r.ownerDocument||r,u=fy(u),(x=qi.get(x))&&vp(u,x),E=E.createElement("link"),Qe(E);var D=E;D._p=new Promise(function(U,Q){D.onload=U,D.onerror=Q}),Pn(E,"link",u),o.instance=E}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=ju.bind(n),r.addEventListener("load",o),r.addEventListener("error",o))}}var yp=0;function oT(n,r){return n.stylesheets&&n.count===0&&Bu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend){var E=n.unsuspend;n.unsuspend=null,E()}},6e4+r);0<n.imgBytes&&yp===0&&(yp=62500*$k());var x=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend)){var E=n.unsuspend;n.unsuspend=null,E()}},(n.imgBytes>yp?50:800)+r);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function ju(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Iu=null;function Bu(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Iu=new Map,r.forEach(lT,n),Iu=null,ju.call(n))}function lT(n,r){if(!(r.state.loading&4)){var o=Iu.get(n);if(o)var u=o.get(null);else{o=new Map,Iu.set(n,o);for(var x=n.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<x.length;E++){var D=x[E];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(o.set(D.dataset.precedence,D),u=D)}u&&o.set(null,u)}x=r.instance,D=x.getAttribute("data-precedence"),E=o.get(D)||u,E===u&&o.set(null,x),o.set(D,x),this.count++,u=ju.bind(this),x.addEventListener("load",u),x.addEventListener("error",u),E?E.parentNode.insertBefore(x,E.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(x,n.firstChild)),r.state.loading|=4}}var El={$$typeof:y,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function cT(n,r,o,u,x,E,D,U,Q){this.tag=1,this.containerInfo=n,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=Ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ct(0),this.hiddenUpdates=Ct(null),this.identifierPrefix=u,this.onUncaughtError=x,this.onCaughtError=E,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function vy(n,r,o,u,x,E,D,U,Q,le,me,be){return n=new cT(n,r,o,D,Q,le,me,be,U),r=1,E===!0&&(r|=24),E=Ei(3,null,null,r),n.current=E,E.stateNode=n,r=Jd(),r.refCount++,n.pooledCache=r,r.refCount++,E.memoizedState={element:u,isDehydrated:o,cache:r},nf(E),n}function by(n){return n?(n=Aa,n):Aa}function yy(n,r,o,u,x,E){x=by(x),u.context===null?u.context=x:u.pendingContext=x,u=rs(r),u.payload={element:o},E=E===void 0?null:E,E!==null&&(u.callback=E),o=ss(n,u,r),o!==null&&(fi(o,n,r),il(o,n,r))}function Sy(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<r?o:r}}function Sp(n,r){Sy(n,r),(n=n.alternate)&&Sy(n,r)}function xy(n){if(n.tag===13||n.tag===31){var r=$s(n,67108864);r!==null&&fi(r,n,67108864),Sp(n,67108864)}}function wy(n){if(n.tag===13||n.tag===31){var r=Li();r=it(r);var o=$s(n,r);o!==null&&fi(o,n,r),Sp(n,r)}}var Pu=!0;function uT(n,r,o,u){var x=P.T;P.T=null;var E=K.p;try{K.p=2,xp(n,r,o,u)}finally{K.p=E,P.T=x}}function hT(n,r,o,u){var x=P.T;P.T=null;var E=K.p;try{K.p=8,xp(n,r,o,u)}finally{K.p=E,P.T=x}}function xp(n,r,o,u){if(Pu){var x=wp(u);if(x===null)lp(n,r,u,zu,o),Ey(n,u);else if(fT(x,n,r,o,u))u.stopPropagation();else if(Ey(n,u),r&4&&-1<dT.indexOf(n)){for(;x!==null;){var E=_e(x);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var D=Ht(E.pendingLanes);if(D!==0){var U=E;for(U.pendingLanes|=2,U.entangledLanes|=2;D;){var Q=1<<31-Yt(D);U.entanglements[1]|=Q,D&=~Q}gr(E),(yt&6)===0&&(Su=pt()+500,bl(0))}}break;case 31:case 13:U=$s(E,2),U!==null&&fi(U,E,2),wu(),Sp(E,2)}if(E=wp(u),E===null&&lp(n,r,u,zu,o),E===x)break;x=E}x!==null&&u.stopPropagation()}else lp(n,r,u,null,o)}}function wp(n){return n=Ze(n),Cp(n)}var zu=null;function Cp(n){if(zu=null,n=X(n),n!==null){var r=d(n);if(r===null)n=null;else{var o=r.tag;if(o===13){if(n=f(r),n!==null)return n;n=null}else if(o===31){if(n=c(r),n!==null)return n;n=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return zu=n,null}function Cy(n){switch(n){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(tn()){case zt:return 2;case Ut:return 8;case wt:case Ln:return 32;case xn:return 268435456;default:return 32}default:return 32}}var Ep=!1,gs=null,_s=null,vs=null,kl=new Map,Tl=new Map,bs=[],dT="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 Ey(n,r){switch(n){case"focusin":case"focusout":gs=null;break;case"dragenter":case"dragleave":_s=null;break;case"mouseover":case"mouseout":vs=null;break;case"pointerover":case"pointerout":kl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tl.delete(r.pointerId)}}function Al(n,r,o,u,x,E){return n===null||n.nativeEvent!==E?(n={blockedOn:r,domEventName:o,eventSystemFlags:u,nativeEvent:E,targetContainers:[x]},r!==null&&(r=_e(r),r!==null&&xy(r)),n):(n.eventSystemFlags|=u,r=n.targetContainers,x!==null&&r.indexOf(x)===-1&&r.push(x),n)}function fT(n,r,o,u,x){switch(r){case"focusin":return gs=Al(gs,n,r,o,u,x),!0;case"dragenter":return _s=Al(_s,n,r,o,u,x),!0;case"mouseover":return vs=Al(vs,n,r,o,u,x),!0;case"pointerover":var E=x.pointerId;return kl.set(E,Al(kl.get(E)||null,n,r,o,u,x)),!0;case"gotpointercapture":return E=x.pointerId,Tl.set(E,Al(Tl.get(E)||null,n,r,o,u,x)),!0}return!1}function ky(n){var r=X(n.target);if(r!==null){var o=d(r);if(o!==null){if(r=o.tag,r===13){if(r=f(o),r!==null){n.blockedOn=r,jt(n.priority,function(){wy(o)});return}}else if(r===31){if(r=c(o),r!==null){n.blockedOn=r,jt(n.priority,function(){wy(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Hu(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var o=wp(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);je=u,o.target.dispatchEvent(u),je=null}else return r=_e(o),r!==null&&xy(r),n.blockedOn=o,!1;r.shift()}return!0}function Ty(n,r,o){Hu(n)&&o.delete(r)}function pT(){Ep=!1,gs!==null&&Hu(gs)&&(gs=null),_s!==null&&Hu(_s)&&(_s=null),vs!==null&&Hu(vs)&&(vs=null),kl.forEach(Ty),Tl.forEach(Ty)}function $u(n,r){n.blockedOn===r&&(n.blockedOn=null,Ep||(Ep=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,pT)))}var Fu=null;function Ay(n){Fu!==n&&(Fu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fu===n&&(Fu=null);for(var r=0;r<n.length;r+=3){var o=n[r],u=n[r+1],x=n[r+2];if(typeof u!="function"){if(Cp(u||o)===null)continue;break}var E=_e(o);E!==null&&(n.splice(r,3),r-=3,wf(E,{pending:!0,data:x,method:o.method,action:u},u,x))}}))}function Ja(n){function r(Q){return $u(Q,n)}gs!==null&&$u(gs,n),_s!==null&&$u(_s,n),vs!==null&&$u(vs,n),kl.forEach(r),Tl.forEach(r);for(var o=0;o<bs.length;o++){var u=bs[o];u.blockedOn===n&&(u.blockedOn=null)}for(;0<bs.length&&(o=bs[0],o.blockedOn===null);)ky(o),o.blockedOn===null&&bs.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var x=o[u],E=o[u+1],D=x[Ke]||null;if(typeof E=="function")D||Ay(o);else if(D){var U=null;if(E&&E.hasAttribute("formAction")){if(x=E,D=E[Ke]||null)U=D.formAction;else if(Cp(x)!==null)continue}else U=D.action;typeof U=="function"?o[u+1]=U:(o.splice(u,3),u-=3),Ay(o)}}}function Ry(){function n(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(D){return x=D})},focusReset:"manual",scroll:"manual"})}function r(){x!==null&&(x(),x=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,x=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),x!==null&&(x(),x=null)}}}function kp(n){this._internalRoot=n}Uu.prototype.render=kp.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));var o=r.current,u=Li();yy(o,u,n,r,null,null)},Uu.prototype.unmount=kp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;yy(n.current,2,null,n,null,null),wu(),r[It]=null}};function Uu(n){this._internalRoot=n}Uu.prototype.unstable_scheduleHydration=function(n){if(n){var r=ot();n={blockedOn:null,target:n,priority:r};for(var o=0;o<bs.length&&r!==0&&r<bs[o].priority;o++);bs.splice(o,0,n),o===0&&ky(n)}};var Ly=t.version;if(Ly!=="19.2.7")throw Error(s(527,Ly,"19.2.7"));K.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=p(r),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var mT={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wu.isDisabled&&Wu.supportsFiber)try{wn=Wu.inject(mT),At=Wu}catch{}}return Ll.createRoot=function(n,r){if(!a(n))throw Error(s(299));var o=!1,u="",x=B0,E=P0,D=z0;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(x=r.onUncaughtError),r.onCaughtError!==void 0&&(E=r.onCaughtError),r.onRecoverableError!==void 0&&(D=r.onRecoverableError)),r=vy(n,1,!1,null,null,o,u,null,x,E,D,Ry),n[It]=r.current,op(n),new kp(r)},Ll.hydrateRoot=function(n,r,o){if(!a(n))throw Error(s(299));var u=!1,x="",E=B0,D=P0,U=z0,Q=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(x=o.identifierPrefix),o.onUncaughtError!==void 0&&(E=o.onUncaughtError),o.onCaughtError!==void 0&&(D=o.onCaughtError),o.onRecoverableError!==void 0&&(U=o.onRecoverableError),o.formState!==void 0&&(Q=o.formState)),r=vy(n,1,!0,r,o??null,u,x,Q,E,D,U,Ry),r.context=by(null),o=r.current,u=Li(),u=it(u),x=rs(u),x.callback=null,ss(o,x,u),o=u,r.current.lanes=o,mt(r,o),gr(r),n[It]=r.current,op(n),new Uu(r)},Ll.version="19.2.7",Ll}var $y;function nA(){if($y)return Lp.exports;$y=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(),Lp.exports=tA(),Lp.exports}var iA=nA();var Fy="popstate";function Uy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function rA(e={}){function t(s,a){let d=a.state?.masked,{pathname:f,search:c,hash:h}=d||s.location;return Hm("",{pathname:f,search:c,hash:h},a.state&&a.state.usr||null,a.state&&a.state.key||"default",d?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function i(s,a){return typeof a=="string"?a:hc(a)}return aA(t,i,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function sA(){return Math.random().toString(36).substring(2,10)}function Wy(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 Hm(e,t,i=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?No(t):t,state:i,key:t&&t.key||s||sA(),mask:a}}function hc({pathname:e="/",search:t="",hash:i=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function No(e){let t={};if(e){let i=e.indexOf("#");i>=0&&(t.hash=e.substring(i),e=e.substring(0,i));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function aA(e,t,i,s={}){let{window:a=document.defaultView,v5Compat:d=!1}=s,f=a.history,c="POP",h=null,p=g();p==null&&(p=0,f.replaceState({...f.state,idx:p},""));function g(){return(f.state||{idx:null}).idx}function m(){c="POP";let _=g(),b=_==null?null:_-p;p=_,h&&h({action:c,location:C.location,delta:b})}function S(_,b){c="PUSH";let v=Uy(_)?_:Hm(C.location,_,b);p=g()+1;let y=Wy(v,p),k=C.createHref(v.mask||v);try{f.pushState(y,"",k)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;a.location.assign(k)}d&&h&&h({action:c,location:C.location,delta:1})}function w(_,b){c="REPLACE";let v=Uy(_)?_:Hm(C.location,_,b);p=g();let y=Wy(v,p),k=C.createHref(v.mask||v);f.replaceState(y,"",k),d&&h&&h({action:c,location:C.location,delta:0})}function T(_){return oA(a,_)}let C={get action(){return c},get location(){return e(a,f)},listen(_){if(h)throw new Error("A history only accepts one active listener");return a.addEventListener(Fy,m),h=_,()=>{a.removeEventListener(Fy,m),h=null}},createHref(_){return t(a,_)},createURL:T,encodeLocation(_){let b=T(_);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:S,replace:w,go(_){return f.go(_)}};return C}function oA(e,t,i=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),Qt(s,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:hc(t);return a=a.replace(/ $/,"%20"),!i&&a.startsWith("//")&&(a=s+a),new URL(a,s)}function Ux(e,t,i="/"){return lA(e,t,i,!1)}function lA(e,t,i,s,a){let d=typeof t=="string"?No(t):t,f=Kr(d.pathname||"/",i);if(f==null)return null;let c=cA(e),h=null,p=SA(f);for(let g=0;h==null&&g<c.length;++g)h=bA(c[g],p,s);return h}function cA(e){let t=Wx(e);return uA(t),t}function Wx(e,t=[],i=[],s="",a=!1){let d=(f,c,h=a,p)=>{let g={relativePath:p===void 0?f.path||"":p,caseSensitive:f.caseSensitive===!0,childrenIndex:c,route:f};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(s)&&h)return;Qt(g.relativePath.startsWith(s),`Absolute route path "${g.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(s.length)}let m=ar([s,g.relativePath]),S=i.concat(g);f.children&&f.children.length>0&&(Qt(f.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Wx(f.children,t,S,m,h)),!(f.path==null&&!f.index)&&t.push({path:m,score:_A(m,f.index),routesMeta:S})};return e.forEach((f,c)=>{if(f.path===""||!f.path?.includes("?"))d(f,c);else for(let h of Gx(f.path))d(f,c,!0,h)}),t}function Gx(e){let t=e.split("/");if(t.length===0)return[];let[i,...s]=t,a=i.endsWith("?"),d=i.replace(/\?$/,"");if(s.length===0)return a?[d,""]:[d];let f=Gx(s.join("/")),c=[];return c.push(...f.map(h=>h===""?d:[d,h].join("/"))),a&&c.push(...f),c.map(h=>e.startsWith("/")&&h===""?"/":h)}function uA(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:vA(t.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var hA=/^:[\w-]+$/,dA=3,fA=2,pA=1,mA=10,gA=-2,Gy=e=>e==="*";function _A(e,t){let i=e.split("/"),s=i.length;return i.some(Gy)&&(s+=gA),t&&(s+=fA),i.filter(a=>!Gy(a)).reduce((a,d)=>a+(hA.test(d)?dA:d===""?pA:mA),s)}function vA(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function bA(e,t,i=!1){let{routesMeta:s}=e,a={},d="/",f=[];for(let c=0;c<s.length;++c){let h=s[c],p=c===s.length-1,g=d==="/"?t:t.slice(d.length)||"/",m=Oh({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},g),S=h.route;if(!m&&p&&i&&!s[s.length-1].route.index&&(m=Oh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!m)return null;Object.assign(a,m.params),f.push({params:a,pathname:ar([d,m.pathname]),pathnameBase:EA(ar([d,m.pathnameBase])),route:S}),m.pathnameBase!=="/"&&(d=ar([d,m.pathnameBase]))}return f}function Oh(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,s]=yA(e.path,e.caseSensitive,e.end),a=t.match(i);if(!a)return null;let d=a[0],f=d.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:s.reduce((p,{paramName:g,isOptional:m},S)=>{if(g==="*"){let T=c[S]||"";f=d.slice(0,d.length-T.length).replace(/(.)\/+$/,"$1")}const w=c[S];return m&&!w?p[g]=void 0:p[g]=(w||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:f,pattern:e}}function yA(e,t=!1,i=!0){lr(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 s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,c,h,p,g)=>{if(s.push({paramName:c,isOptional:h!=null}),h){let m=g.charAt(p+f.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function SA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return lr(!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 Kr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,s=e.charAt(i);return s&&s!=="/"?null:e.slice(i)||"/"}var xA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function wA(e,t="/"){let{pathname:i,search:s="",hash:a=""}=typeof e=="string"?No(e):e,d;return i?(i=qx(i),i.startsWith("/")?d=qy(i.substring(1),"/"):d=qy(i,t)):d=t,{pathname:d,search:kA(s),hash:TA(a)}}function qy(e,t){let i=Dh(t).split("/");return e.split("/").forEach(a=>{a===".."?i.length>1&&i.pop():a!=="."&&i.push(a)}),i.length>1?i.join("/"):"/"}function Dp(e,t,i,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function CA(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function Qg(e){let t=CA(e);return t.map((i,s)=>s===t.length-1?i.pathname:i.pathnameBase)}function ad(e,t,i,s=!1){let a;typeof e=="string"?a=No(e):(a={...e},Qt(!a.pathname||!a.pathname.includes("?"),Dp("?","pathname","search",a)),Qt(!a.pathname||!a.pathname.includes("#"),Dp("#","pathname","hash",a)),Qt(!a.search||!a.search.includes("#"),Dp("#","search","hash",a)));let d=e===""||a.pathname==="",f=d?"/":a.pathname,c;if(f==null)c=i;else{let m=t.length-1;if(!s&&f.startsWith("..")){let S=f.split("/");for(;S[0]==="..";)S.shift(),m-=1;a.pathname=S.join("/")}c=m>=0?t[m]:"/"}let h=wA(a,c),p=f&&f!=="/"&&f.endsWith("/"),g=(d||f===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(p||g)&&(h.pathname+="/"),h}var qx=e=>e.replace(/\/\/+/g,"/"),ar=e=>qx(e.join("/")),Dh=e=>e.replace(/\/+$/,""),EA=e=>Dh(e).replace(/^\/*/,"/"),kA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,TA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,AA=class{constructor(e,t,i,s=!1){this.status=e,this.statusText=t||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function RA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function LA(e){let t=e.map(i=>i.route.path).filter(Boolean);return ar(t)||"/"}var Kx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vx(e,t){let i=e;if(typeof i!="string"||!xA.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,a=!1;if(Kx)try{let d=new URL(window.location.href),f=i.startsWith("//")?new URL(d.protocol+i):new URL(i),c=Kr(f.pathname,t);f.origin===d.origin&&c!=null?i=c+f.search+f.hash:a=!0}catch{lr(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:a,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Yx=["POST","PUT","PATCH","DELETE"];new Set(Yx);var MA=["GET",...Yx];new Set(MA);var Oo=L.createContext(null);Oo.displayName="DataRouter";var od=L.createContext(null);od.displayName="DataRouterState";var Xx=L.createContext(!1);function NA(){return L.useContext(Xx)}var Zx=L.createContext({isTransitioning:!1});Zx.displayName="ViewTransition";var OA=L.createContext(new Map);OA.displayName="Fetchers";var DA=L.createContext(null);DA.displayName="Await";var ji=L.createContext(null);ji.displayName="Navigation";var Rc=L.createContext(null);Rc.displayName="Location";var Sr=L.createContext({outlet:null,matches:[],isDataRoute:!1});Sr.displayName="Route";var e_=L.createContext(null);e_.displayName="RouteError";var Jx="REACT_ROUTER_ERROR",jA="REDIRECT",IA="ROUTE_ERROR_RESPONSE";function BA(e){if(e.startsWith(`${Jx}:${jA}:{`))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 PA(e){if(e.startsWith(`${Jx}:${IA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new AA(t.status,t.statusText,t.data)}catch{}}function zA(e,{relative:t}={}){Qt(Do(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:s}=L.useContext(ji),{hash:a,pathname:d,search:f}=Mc(e,{relative:t}),c=d;return i!=="/"&&(c=d==="/"?i:ar([i,d])),s.createHref({pathname:c,search:f,hash:a})}function Do(){return L.useContext(Rc)!=null}function ur(){return Qt(Do(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Rc).location}var Qx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ew(e){L.useContext(ji).static||L.useLayoutEffect(e)}function Lc(){let{isDataRoute:e}=L.useContext(Sr);return e?JA():HA()}function HA(){Qt(Do(),"useNavigate() may be used only in the context of a <Router> component.");let e=L.useContext(Oo),{basename:t,navigator:i}=L.useContext(ji),{matches:s}=L.useContext(Sr),{pathname:a}=ur(),d=JSON.stringify(Qg(s)),f=L.useRef(!1);return ew(()=>{f.current=!0}),L.useCallback((h,p={})=>{if(lr(f.current,Qx),!f.current)return;if(typeof h=="number"){i.go(h);return}let g=ad(h,JSON.parse(d),a,p.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:ar([t,g.pathname])),(p.replace?i.replace:i.push)(g,p.state,p)},[t,i,d,a,e])}L.createContext(null);function Mc(e,{relative:t}={}){let{matches:i}=L.useContext(Sr),{pathname:s}=ur(),a=JSON.stringify(Qg(i));return L.useMemo(()=>ad(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function $A(e,t){return tw(e,t)}function tw(e,t,i){Qt(Do(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=L.useContext(ji),{matches:a}=L.useContext(Sr),d=a[a.length-1],f=d?d.params:{},c=d?d.pathname:"/",h=d?d.pathnameBase:"/",p=d&&d.route;{let _=p&&p.path||"";iw(c,!p||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${_}">) 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="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let g=ur(),m;if(t){let _=typeof t=="string"?No(t):t;Qt(h==="/"||_.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${_.pathname}" was given in the \`location\` prop.`),m=_}else m=g;let S=m.pathname||"/",w=S;if(h!=="/"){let _=h.replace(/^\//,"").split("/");w="/"+S.replace(/^\//,"").split("/").slice(_.length).join("/")}let T=i&&i.state.matches.length?i.state.matches.map(_=>Object.assign(_,{route:i.manifest[_.route.id]||_.route})):Ux(e,{pathname:w});lr(p||T!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),lr(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.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 C=qA(T&&T.map(_=>Object.assign({},_,{params:Object.assign({},f,_.params),pathname:ar([h,s.encodeLocation?s.encodeLocation(_.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?h:ar([h,s.encodeLocation?s.encodeLocation(_.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),a,i);return t&&C?L.createElement(Rc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},C):C}function FA(){let e=ZA(),t=RA(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:s},d={padding:"2px 4px",backgroundColor:s},f=null;return console.error("Error handled by React Router default ErrorBoundary:",e),f=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:d},"ErrorBoundary")," or"," ",L.createElement("code",{style:d},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},t),i?L.createElement("pre",{style:a},i):null,f)}var UA=L.createElement(FA,null),nw=class extends L.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 i=PA(e.digest);i&&(e=i)}let t=e!==void 0?L.createElement(Sr.Provider,{value:this.props.routeContext},L.createElement(e_.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?L.createElement(WA,{error:e},t):t}};nw.contextType=Xx;var jp=new WeakMap;function WA({children:e,error:t}){let{basename:i}=L.useContext(ji);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=BA(t.digest);if(s){let a=jp.get(t);if(a)throw a;let d=Vx(s.location,i);if(Kx&&!jp.get(t))if(d.isExternal||s.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:s.replace}));throw jp.set(t,f),f}return L.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return e}function GA({routeContext:e,match:t,children:i}){let s=L.useContext(Oo);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(Sr.Provider,{value:e},i)}function qA(e,t=[],i){let s=i?.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let a=e,d=s?.errors;if(d!=null){let g=a.findIndex(m=>m.route.id&&d?.[m.route.id]!==void 0);Qt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),a=a.slice(0,Math.min(a.length,g+1))}let f=!1,c=-1;if(i&&s){f=s.renderFallback;for(let g=0;g<a.length;g++){let m=a[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=g),m.route.id){let{loaderData:S,errors:w}=s,T=m.route.loader&&!S.hasOwnProperty(m.route.id)&&(!w||w[m.route.id]===void 0);if(m.route.lazy||T){i.isStatic&&(f=!0),c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}}let h=i?.onError,p=s&&h?(g,m)=>{h(g,{location:s.location,params:s.matches?.[0]?.params??{},pattern:LA(s.matches),errorInfo:m})}:void 0;return a.reduceRight((g,m,S)=>{let w,T=!1,C=null,_=null;s&&(w=d&&m.route.id?d[m.route.id]:void 0,C=m.route.errorElement||UA,f&&(c<0&&S===0?(iw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,_=null):c===S&&(T=!0,_=m.route.hydrateFallbackElement||null)));let b=t.concat(a.slice(0,S+1)),v=()=>{let y;return w?y=C:T?y=_:m.route.Component?y=L.createElement(m.route.Component,null):m.route.element?y=m.route.element:y=g,L.createElement(GA,{match:m,routeContext:{outlet:g,matches:b,isDataRoute:s!=null},children:y})};return s&&(m.route.ErrorBoundary||m.route.errorElement||S===0)?L.createElement(nw,{location:s.location,revalidation:s.revalidation,component:C,error:w,children:v(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:p}):v()},null)}function t_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KA(e){let t=L.useContext(Oo);return Qt(t,t_(e)),t}function VA(e){let t=L.useContext(od);return Qt(t,t_(e)),t}function YA(e){let t=L.useContext(Sr);return Qt(t,t_(e)),t}function n_(e){let t=YA(e),i=t.matches[t.matches.length-1];return Qt(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function XA(){return n_("useRouteId")}function ZA(){let e=L.useContext(e_),t=VA("useRouteError"),i=n_("useRouteError");return e!==void 0?e:t.errors?.[i]}function JA(){let{router:e}=KA("useNavigate"),t=n_("useNavigate"),i=L.useRef(!1);return ew(()=>{i.current=!0}),L.useCallback(async(a,d={})=>{lr(i.current,Qx),i.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...d}))},[e,t])}var Ky={};function iw(e,t,i){!t&&!Ky[e]&&(Ky[e]=!0,lr(!1,i))}L.memo(QA);function QA({routes:e,manifest:t,future:i,state:s,isStatic:a,onError:d}){return tw(e,void 0,{manifest:t,state:s,isStatic:a,onError:d})}function Vy({to:e,replace:t,state:i,relative:s}){Qt(Do(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=L.useContext(ji);lr(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=L.useContext(Sr),{pathname:f}=ur(),c=Lc(),h=ad(e,Qg(d),f,s==="path"),p=JSON.stringify(h);return L.useEffect(()=>{c(JSON.parse(p),{replace:t,state:i,relative:s})},[c,p,s,t,i]),null}function so(e){Qt(!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 eR({basename:e="/",children:t=null,location:i,navigationType:s="POP",navigator:a,static:d=!1,useTransitions:f}){Qt(!Do(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),h=L.useMemo(()=>({basename:c,navigator:a,static:d,useTransitions:f,future:{}}),[c,a,d,f]);typeof i=="string"&&(i=No(i));let{pathname:p="/",search:g="",hash:m="",state:S=null,key:w="default",mask:T}=i,C=L.useMemo(()=>{let _=Kr(p,c);return _==null?null:{location:{pathname:_,search:g,hash:m,state:S,key:w,mask:T},navigationType:s}},[c,p,g,m,S,w,s,T]);return lr(C!=null,`<Router basename="${c}"> is not able to match the URL "${p}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:L.createElement(ji.Provider,{value:h},L.createElement(Rc.Provider,{children:t,value:C}))}function tR({children:e,location:t}){return $A($m(e),t)}function $m(e,t=[]){let i=[];return L.Children.forEach(e,(s,a)=>{if(!L.isValidElement(s))return;let d=[...t,a];if(s.type===L.Fragment){i.push.apply(i,$m(s.props.children,d));return}Qt(s.type===so,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Qt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let f={id:s.props.id||d.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(f.children=$m(s.props.children,d)),i.push(f)}),i}var mh="get",gh="application/x-www-form-urlencoded";function ld(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function nR(e){return ld(e)&&e.tagName.toLowerCase()==="button"}function iR(e){return ld(e)&&e.tagName.toLowerCase()==="form"}function rR(e){return ld(e)&&e.tagName.toLowerCase()==="input"}function sR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function aR(e,t){return e.button===0&&(!t||t==="_self")&&!sR(e)}var Gu=null;function oR(){if(Gu===null)try{new FormData(document.createElement("form"),0),Gu=!1}catch{Gu=!0}return Gu}var lR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ip(e){return e!=null&&!lR.has(e)?(lr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${gh}"`),null):e}function cR(e,t){let i,s,a,d,f;if(iR(e)){let c=e.getAttribute("action");s=c?Kr(c,t):null,i=e.getAttribute("method")||mh,a=Ip(e.getAttribute("enctype"))||gh,d=new FormData(e)}else if(nR(e)||rR(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||c.getAttribute("action");if(s=h?Kr(h,t):null,i=e.getAttribute("formmethod")||c.getAttribute("method")||mh,a=Ip(e.getAttribute("formenctype"))||Ip(c.getAttribute("enctype"))||gh,d=new FormData(c,e),!oR()){let{name:p,type:g,value:m}=e;if(g==="image"){let S=p?`${p}.`:"";d.append(`${S}x`,"0"),d.append(`${S}y`,"0")}else p&&d.append(p,m)}}else{if(ld(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=mh,s=null,a=gh,f=e}return d&&a==="text/plain"&&(f=d,d=void 0),{action:s,method:i.toLowerCase(),encType:a,formData:d,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function i_(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function rw(e,t,i,s){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${s}`:a.pathname=`${a.pathname}.${s}`:a.pathname==="/"?a.pathname=`_root.${s}`:t&&Kr(a.pathname,t)==="/"?a.pathname=`${Dh(t)}/_root.${s}`:a.pathname=`${Dh(a.pathname)}.${s}`,a}async function uR(e,t){if(e.id in t)return t[e.id];try{let i=await import(e.module);return t[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function hR(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 dR(e,t,i){let s=await Promise.all(e.map(async a=>{let d=t.routes[a.route.id];if(d){let f=await uR(d,i);return f.links?f.links():[]}return[]}));return gR(s.flat(1).filter(hR).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Yy(e,t,i,s,a,d){let f=(h,p)=>i[p]?h.route.id!==i[p].route.id:!0,c=(h,p)=>i[p].pathname!==h.pathname||i[p].route.path?.endsWith("*")&&i[p].params["*"]!==h.params["*"];return d==="assets"?t.filter((h,p)=>f(h,p)||c(h,p)):d==="data"?t.filter((h,p)=>{let g=s.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(f(h,p)||c(h,p))return!0;if(h.route.shouldRevalidate){let m=h.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function fR(e,t,{includeHydrateFallback:i}={}){return pR(e.map(s=>{let a=t.routes[s.route.id];if(!a)return[];let d=[a.module];return a.clientActionModule&&(d=d.concat(a.clientActionModule)),a.clientLoaderModule&&(d=d.concat(a.clientLoaderModule)),i&&a.hydrateFallbackModule&&(d=d.concat(a.hydrateFallbackModule)),a.imports&&(d=d.concat(a.imports)),d}).flat(1))}function pR(e){return[...new Set(e)]}function mR(e){let t={},i=Object.keys(e).sort();for(let s of i)t[s]=e[s];return t}function gR(e,t){let i=new Set;return new Set(t),e.reduce((s,a)=>{let d=JSON.stringify(mR(a));return i.has(d)||(i.add(d),s.push({key:d,link:a})),s},[])}function r_(){let e=L.useContext(Oo);return i_(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function _R(){let e=L.useContext(od);return i_(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var s_=L.createContext(void 0);s_.displayName="FrameworkContext";function a_(){let e=L.useContext(s_);return i_(e,"You must render this element inside a <HydratedRouter> element"),e}function vR(e,t){let i=L.useContext(s_),[s,a]=L.useState(!1),[d,f]=L.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:p,onMouseLeave:g,onTouchStart:m}=t,S=L.useRef(null);L.useEffect(()=>{if(e==="render"&&f(!0),e==="viewport"){let C=b=>{b.forEach(v=>{f(v.isIntersecting)})},_=new IntersectionObserver(C,{threshold:.5});return S.current&&_.observe(S.current),()=>{_.disconnect()}}},[e]),L.useEffect(()=>{if(s){let C=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(C)}}},[s]);let w=()=>{a(!0)},T=()=>{a(!1),f(!1)};return i?e!=="intent"?[d,S,{}]:[d,S,{onFocus:Ml(c,w),onBlur:Ml(h,T),onMouseEnter:Ml(p,w),onMouseLeave:Ml(g,T),onTouchStart:Ml(m,w)}]:[!1,S,{}]}function Ml(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function bR({page:e,...t}){let i=NA(),{router:s}=r_(),a=L.useMemo(()=>Ux(s.routes,e,s.basename),[s.routes,e,s.basename]);return a?i?L.createElement(SR,{page:e,matches:a,...t}):L.createElement(xR,{page:e,matches:a,...t}):null}function yR(e){let{manifest:t,routeModules:i}=a_(),[s,a]=L.useState([]);return L.useEffect(()=>{let d=!1;return dR(e,t,i).then(f=>{d||a(f)}),()=>{d=!0}},[e,t,i]),s}function SR({page:e,matches:t,...i}){let s=ur(),{future:a}=a_(),{basename:d}=r_(),f=L.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=rw(e,d,a.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,p=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?h=!0:p.push(g.route.id);return h&&p.length>0&&c.searchParams.set("_routes",p.join(",")),[c.pathname+c.search]},[d,a.v8_trailingSlashAwareDataRequests,e,s,t]);return L.createElement(L.Fragment,null,f.map(c=>L.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...i})))}function xR({page:e,matches:t,...i}){let s=ur(),{future:a,manifest:d,routeModules:f}=a_(),{basename:c}=r_(),{loaderData:h,matches:p}=_R(),g=L.useMemo(()=>Yy(e,t,p,d,s,"data"),[e,t,p,d,s]),m=L.useMemo(()=>Yy(e,t,p,d,s,"assets"),[e,t,p,d,s]),S=L.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let C=new Set,_=!1;if(t.forEach(v=>{let y=d.routes[v.route.id];!y||!y.hasLoader||(!g.some(k=>k.route.id===v.route.id)&&v.route.id in h&&f[v.route.id]?.shouldRevalidate||y.hasClientLoader?_=!0:C.add(v.route.id))}),C.size===0)return[];let b=rw(e,c,a.v8_trailingSlashAwareDataRequests,"data");return _&&C.size>0&&b.searchParams.set("_routes",t.filter(v=>C.has(v.route.id)).map(v=>v.route.id).join(",")),[b.pathname+b.search]},[c,a.v8_trailingSlashAwareDataRequests,h,s,d,g,t,e,f]),w=L.useMemo(()=>fR(m,d),[m,d]),T=yR(m);return L.createElement(L.Fragment,null,S.map(C=>L.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...i})),w.map(C=>L.createElement("link",{key:C,rel:"modulepreload",href:C,...i})),T.map(({key:C,link:_})=>L.createElement("link",{key:C,nonce:i.nonce,..._,crossOrigin:_.crossOrigin??i.crossOrigin})))}function wR(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var CR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{CR&&(window.__reactRouterVersion="7.17.0")}catch{}function ER({basename:e,children:t,useTransitions:i,window:s}){let a=L.useRef();a.current==null&&(a.current=rA({window:s,v5Compat:!0}));let d=a.current,[f,c]=L.useState({action:d.action,location:d.location}),h=L.useCallback(p=>{i===!1?c(p):L.startTransition(()=>c(p))},[i]);return L.useLayoutEffect(()=>d.listen(h),[d,h]),L.createElement(eR,{basename:e,children:t,location:f.location,navigationType:f.action,navigator:d,useTransitions:i})}var sw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dc=L.forwardRef(function({onClick:t,discover:i="render",prefetch:s="none",relative:a,reloadDocument:d,replace:f,mask:c,state:h,target:p,to:g,preventScrollReset:m,viewTransition:S,defaultShouldRevalidate:w,...T},C){let{basename:_,navigator:b,useTransitions:v}=L.useContext(ji),y=typeof g=="string"&&sw.test(g),k=Vx(g,_);g=k.to;let M=zA(g,{relative:a}),R=ur(),N=null;if(c){let G=ad(c,[],R.mask?R.mask.pathname:"/",!0);_!=="/"&&(G.pathname=G.pathname==="/"?_:ar([_,G.pathname])),N=b.createHref(G)}let[A,I,$]=vR(s,T),H=RR(g,{replace:f,mask:c,state:h,target:p,preventScrollReset:m,relative:a,viewTransition:S,defaultShouldRevalidate:w,useTransitions:v});function q(G){t&&t(G),G.defaultPrevented||H(G)}let B=!(k.isExternal||d),Y=L.createElement("a",{...T,...$,href:(B?N:void 0)||k.absoluteURL||M,onClick:B?q:t,ref:wR(C,I),target:p,"data-discover":!y&&i==="render"?"true":void 0});return A&&!y?L.createElement(L.Fragment,null,Y,L.createElement(bR,{page:M})):Y});dc.displayName="Link";var kR=L.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:s="",end:a=!1,style:d,to:f,viewTransition:c,children:h,...p},g){let m=Mc(f,{relative:p.relative}),S=ur(),w=L.useContext(od),{navigator:T,basename:C}=L.useContext(ji),_=w!=null&&DR(m)&&c===!0,b=T.encodeLocation?T.encodeLocation(m).pathname:m.pathname,v=S.pathname,y=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;i||(v=v.toLowerCase(),y=y?y.toLowerCase():null,b=b.toLowerCase()),y&&C&&(y=Kr(y,C)||y);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let M=v===b||!a&&v.startsWith(b)&&v.charAt(k)==="/",R=y!=null&&(y===b||!a&&y.startsWith(b)&&y.charAt(b.length)==="/"),N={isActive:M,isPending:R,isTransitioning:_},A=M?t:void 0,I;typeof s=="function"?I=s(N):I=[s,M?"active":null,R?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let $=typeof d=="function"?d(N):d;return L.createElement(dc,{...p,"aria-current":A,className:I,ref:g,style:$,to:f,viewTransition:c},typeof h=="function"?h(N):h)});kR.displayName="NavLink";var TR=L.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:s,replace:a,state:d,method:f=mh,action:c,onSubmit:h,relative:p,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:S,...w},T)=>{let{useTransitions:C}=L.useContext(ji),_=NR(),b=OR(c,{relative:p}),v=f.toLowerCase()==="get"?"get":"post",y=typeof c=="string"&&sw.test(c),k=M=>{if(h&&h(M),M.defaultPrevented)return;M.preventDefault();let R=M.nativeEvent.submitter,N=R?.getAttribute("formmethod")||f,A=()=>_(R||M.currentTarget,{fetcherKey:t,method:N,navigate:i,replace:a,state:d,relative:p,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:S});C&&i!==!1?L.startTransition(()=>A()):A()};return L.createElement("form",{ref:T,method:v,action:b,onSubmit:s?h:k,...w,"data-discover":!y&&e==="render"?"true":void 0})});TR.displayName="Form";function AR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aw(e){let t=L.useContext(Oo);return Qt(t,AR(e)),t}function RR(e,{target:t,replace:i,mask:s,state:a,preventScrollReset:d,relative:f,viewTransition:c,defaultShouldRevalidate:h,useTransitions:p}={}){let g=Lc(),m=ur(),S=Mc(e,{relative:f});return L.useCallback(w=>{if(aR(w,t)){w.preventDefault();let T=i!==void 0?i:hc(m)===hc(S),C=()=>g(e,{replace:T,mask:s,state:a,preventScrollReset:d,relative:f,viewTransition:c,defaultShouldRevalidate:h});p?L.startTransition(()=>C()):C()}},[m,g,S,i,s,a,t,e,d,f,c,h,p])}var LR=0,MR=()=>`__${String(++LR)}__`;function NR(){let{router:e}=aw("useSubmit"),{basename:t}=L.useContext(ji),i=XA(),s=e.fetch,a=e.navigate;return L.useCallback(async(d,f={})=>{let{action:c,method:h,encType:p,formData:g,body:m}=cR(d,t);if(f.navigate===!1){let S=f.fetcherKey||MR();await s(S,i,f.action||c,{defaultShouldRevalidate:f.defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:g,body:m,formMethod:f.method||h,formEncType:f.encType||p,flushSync:f.flushSync})}else await a(f.action||c,{defaultShouldRevalidate:f.defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:g,body:m,formMethod:f.method||h,formEncType:f.encType||p,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[s,a,t,i])}function OR(e,{relative:t}={}){let{basename:i}=L.useContext(ji),s=L.useContext(Sr);Qt(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),d={...Mc(e||".",{relative:t})},f=ur();if(e==null){d.search=f.search;let c=new URLSearchParams(d.search),h=c.getAll("index");if(h.some(g=>g==="")){c.delete("index"),h.filter(m=>m).forEach(m=>c.append("index",m));let g=c.toString();d.search=g?`?${g}`:""}}return(!e||e===".")&&a.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:ar([i,d.pathname])),hc(d)}function DR(e,{relative:t}={}){let i=L.useContext(Zx);Qt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=aw("useViewTransitionState"),a=Mc(e,{relative:t});if(!i.isTransitioning)return!1;let d=Kr(i.currentLocation.pathname,s)||i.currentLocation.pathname,f=Kr(i.nextLocation.pathname,s)||i.nextLocation.pathname;return Oh(a.pathname,f)!=null||Oh(a.pathname,d)!=null}var js=Fx();const jR=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];class dt extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}}async function IR(e){const t=await fetch("/api/v1/theaters",{signal:e});await Xn(t);const i=await t.json();if(!Array.isArray(i.theaters))throw new dt(t.status,"Invalid Theater response");return{theaters:i.theaters.map(s=>hw(s,t.status))}}async function BR(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/status${i}`,{signal:t});return await Xn(s),qR(await s.json(),s.status)}async function PR(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const i=t.size>0?`?${t}`:"",s=await fetch(`/api/v1/updates/release-notes${i}`,{signal:e.signal});return await Xn(s),VR(await s.json(),s.status)}async function zR(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await Xn(t),KR(await t.json(),t.status)}async function ow(e,t){const i=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await Xn(i);const s=await i.json();return hw(s,i.status)}async function HR(e,t){const i=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await Xn(i),QR(await i.json(),i.status)}async function lw(e,t){const i=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await Xn(i);const s=await i.json();if(typeof s.folderGrantId!="string")throw new dt(i.status,"Invalid folder grant response");return s.folderGrantId}async function $R(e,t,i){const s=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t}),signal:i});return await Xn(s),await s.json()}async function FR(e,t,i,s){const a=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t,name:i}),signal:s});return await Xn(a),await a.json()}async function UR(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Xn(i)}async function _i(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/operations${i}`,{signal:t});await Xn(s);const a=await s.json();if(!Array.isArray(a.operations))throw new dt(s.status,"Invalid operations response");return a.operations.map(d=>uw(d,s.status))}async function ia(e,t){const s=await fetch("/api/v1/operations/groups",{signal:t});await Xn(s);const a=await s.json();if(!Array.isArray(a.groups))throw new dt(s.status,"Invalid groups response");return a.groups.map(d=>o_(d,s.status))}async function WR(e,t){const i=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await Xn(i);const s=await i.json();return o_(s.group,i.status)}async function Bp(e,t,i){const s=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await Xn(s);const a=await s.json();return o_(a.group,s.status)}async function GR(e,t){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Xn(i)}async function cw(e,t,i){return _h(e,{title:t},i)}async function _h(e,t,i){const s=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await Xn(s);const a=await s.json();return uw(a.operation,s.status)}function uw(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||fc(i)||fc(i.payload))throw new dt(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,accent:typeof i.accent=="string"?i.accent:null,groupId:i.groupId===null?null:typeof i.groupId=="string"?i.groupId:void 0,ts:i.ts}}function o_(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.name!="string"||typeof i.color!="string"||typeof i.order!="number"||typeof i.createdAt!="number")throw new dt(t,"Invalid group response");return{id:i.id,theaterId:i.theaterId,name:i.name,color:i.color,order:i.order,createdAt:i.createdAt}}function hw(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string"||typeof i.createdAt!="string"||typeof i.lastOpenedAt!="string"||typeof i.hasWiki!="boolean"||typeof i.activeAdmiralCount!="number"||fc(i))throw new dt(t,"Invalid Theater response");return i}function qR(e,t){const i=e;if(!i||typeof i.workspaces!="number"||typeof i.version!="string"||i.channel!=="stable"&&i.channel!=="local"&&i.channel!=="desktop"&&i.channel!=="unknown"||typeof i.updateAvailable!="boolean"||typeof i.port!="number"||i.portMode!=="dynamic"&&i.portMode!=="static"||i.requestedPort!==null&&typeof i.requestedPort!="number"||typeof i.effectivePort!="number"||typeof i.portHonored!="boolean"||i.wikiServerStatus!=="available"&&i.wikiServerStatus!=="unavailable"&&i.wikiServerStatus!=="unknown")throw new dt(t,"Invalid status response");return{workspaces:i.workspaces,version:i.version,channel:i.channel,updateAvailable:i.updateAvailable,latestVersion:typeof i.latestVersion=="string"?i.latestVersion:void 0,port:i.port,portMode:i.portMode,requestedPort:i.requestedPort,effectivePort:i.effectivePort,portHonored:i.portHonored,wikiServerStatus:i.wikiServerStatus}}function KR(e,t){const i=e;if(!i||i.status!=="accepted")throw new dt(t,"Invalid update response");return{status:"accepted"}}function VR(e,t){const i=e;if(!i||!Array.isArray(i.notes)||i.sourceRef!=="main"||typeof i.fetchedAt!="number"||typeof i.stale!="boolean"||"url"in i||"token"in i||"path"in i)throw new dt(t,"Invalid release notes response");return{notes:i.notes.map(s=>YR(s,t)),sourceRef:"main",fetchedAt:i.fetchedAt,stale:i.stale}}function YR(e,t){const i=e;if(!i||typeof i.version!="string"||i.date!==null&&typeof i.date!="string"||!Array.isArray(i.sections)||typeof i.localizationFallback!="boolean")throw new dt(t,"Invalid release notes response");return{version:i.version,date:i.date,sections:i.sections.map(s=>XR(s,t)),localizationFallback:i.localizationFallback}}function XR(e,t){const i=e;if(!i||i.heading!=="Added"&&i.heading!=="Changed"&&i.heading!=="Fixed"&&i.heading!=="Removed"&&i.heading!=="Breaking Changes"||!Array.isArray(i.items))throw new dt(t,"Invalid release notes response");return{heading:i.heading,items:i.items.map(s=>ZR(s,t))}}function ZR(e,t){const i=e;if(!i||!Array.isArray(i.packageTags)||!i.packageTags.every(s=>typeof s=="string")||typeof i.text!="string"||"product"in i&&!JR(i.product))throw new dt(t,"Invalid release notes response");return"product"in i?{packageTags:i.packageTags,text:i.text,product:i.product}:{packageTags:i.packageTags,text:i.text}}function JR(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function QR(e,t){const i=e;if(!i||typeof i.path!="string"||i.parentPath!==null&&typeof i.parentPath!="string"||!Array.isArray(i.roots)||!Array.isArray(i.entries)||fc(i))throw new dt(t,"Invalid folder list response");return{path:i.path,parentPath:i.parentPath??null,roots:i.roots.filter(s=>typeof s=="string"),entries:i.entries.map(s=>e3(s,t)),truncated:i.truncated===!0?!0:void 0}}function e3(e,t){const i=e;if(!i||typeof i.name!="string"||typeof i.path!="string"||i.kind!=="dir"||typeof i.accessible!="boolean"||fc(i))throw new dt(t,"Invalid folder entry response");return{name:i.name,path:i.path,kind:"dir",accessible:i.accessible}}function fc(e){if(!e||typeof e!="object")return!1;const t=e;return jR.some(i=>i in t)}async function Xn(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const i=await e.json();typeof i.error=="string"?t=i.error:typeof i.message=="string"&&(t=i.message)}catch{}throw new dt(e.status,t)}function Xy(e,t){return e!==null&&e===t?e:null}function t3(e,t){return e&&t}function n3(e,t){return e?!1:t}const i3="__unassigned__";function r3(e){const t=new Map(e.theaters.map(s=>[s.id,s])),i=[];for(const s of e.operations)s.theaterId&&i.push(o3(s,t.get(s.theaterId)));return i}function s3(e,t){const i=dw(t);return i.length===0?e:e.filter(s=>{const a=l3(s);return i.every(d=>a.includes(d))})}function a3(e){const t=[],i=new Map;for(const s of e){const a=s.theaterId??i3,d=i.get(a);if(d!==void 0){const f=t[d];f&&(t[d]={...f,entries:[...f.entries,s]});continue}i.set(a,t.length),t.push({theaterId:s.theaterId,theaterLabel:s.theaterLabel,entries:[s]})}return t}function dw(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function o3(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function l3(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const c3=200,u3=.5,h3="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",d3=["monospace","serif","sans-serif"],Kl=new Map;function f3(e,t={}){const i=cd(e);if(!i)return!1;const s=i.toLocaleLowerCase(),a=Kl.get(s);if(a!==void 0)return a;const d=t.document??globalThis.document;if(!d)return!1;const f=d.createElement("canvas").getContext("2d");if(!f)return!1;const c=d3.some(h=>{const p=Zy(f,`${fw(i)}, ${h}`),g=Zy(f,h);return Math.abs(p-g)>u3});return p3(s,c,t.maxEntries??c3),c}function fw(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function jh(e,t){const i=cd(e);return i?`${fw(i)}, ${t}`:t}function cd(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function Zy(e,t){return e.font=`28px ${t}`,e.measureText(h3).width}function p3(e,t,i){if(Kl.size>=Math.max(1,i)){const s=Kl.keys().next().value;s&&Kl.delete(s)}Kl.set(e,t)}const _o={min:12,max:18,step:1,defaultValue:14},ic={source:"builtin",id:"manrope",size:_o.defaultValue},Ih=[{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 m3(e){if(!e||typeof e!="object")return ic;const t=e,i=g3(t.size);if(t.source==="builtin"&&v3(t.id))return{source:"builtin",id:t.id,size:i};if(t.source==="system"&&typeof t.familyName=="string"){const s=cd(t.familyName);if(s)return{source:"system",familyName:s,size:i}}return ic}function g3(e){return typeof e!="number"||!Number.isInteger(e)||e<_o.min||e>_o.max?_o.defaultValue:e}function pw(e){return e.source==="system"?jh(e.familyName,Ih[0].family):_3(e.id).family}function _3(e){return Ih.find(t=>t.id===e)??Ih[0]}function v3(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const Fm="fleet-console.activeTheaterId",mw="fleet-console.commissioningSeen",gw="fleet-console.whatsNewSeenVersion",_w="fleet-console.notificationPreferences",vw=1,b3="instrument",qu={globalMute:!1,dnd:!1,mutedTheaterIds:{}},Um=new Set;let Jy=0,Wm=null,We={connection:"connecting",connectionError:null,activeTheme:b3,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,operationNotifications:{},notificationPreferences:V3(),codexReader:null,codexReaderExpanded:!1};function pc(){return We}function bw(e){return Um.add(e),()=>{Um.delete(e)}}function rt(e){We={...We,...e},W3()}function y3(e){We.operationsViewActive!==e&&rt({operationsViewActive:e})}function Bh(e){E3(e),rt({activeTheme:e})}function Gm(e){T3(e)}function S3(e){rt({version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...Tw({...We,version:e.version})})}function x3(){rt({releaseNotesLoading:!0,releaseNotesError:null})}function w3(e){const t={...We,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:We.selectedReleaseNoteKey&&Rw(e.notes,We.selectedReleaseNoteKey)?We.selectedReleaseNoteKey:Aw(e.notes)};rt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...Tw(t)})}function C3(e){rt({releaseNotesLoading:!1,releaseNotesError:e})}function E3(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function k3(){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 T3(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",pw(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function A3(e){const t=kw(e,We.activeTheaterId);rt({theaters:e,activeTheaterId:t})}function R3(e){A3(e.theaters)}function Ni(e){rt({operations:e,operationsHydrated:!0})}function L3(e){const t=new Set(e.map(s=>s.id)),i=We.operations.filter(s=>!t.has(s.id));rt({operations:[...e,...i],operationsHydrated:!0})}function M3(e){const t=We.operations.findIndex(s=>s.id===e.id);if(t===-1)return;const i=[...We.operations];i[t]=e,rt({operations:i})}function ra(e){rt({groups:e})}function N3(e){ud(e),rt({activeTheaterId:e})}function gi(e){We.activeOperationId!==e&&rt({activeOperationId:e})}function O3(e,t){if(t==="idle"){yw(e);return}We.operationStatus[e]!==t&&rt({operationStatus:{...We.operationStatus,[e]:t}})}function yw(e){if(!(e in We.operationStatus))return;const t={...We.operationStatus};delete t[e],rt({operationStatus:t})}function D3(e){if(!e.operationId)return;const t=We.operations.find(f=>f.id===e.operationId);if(!t)return;const i=t.theaterId??null,s=We.theaters.find(f=>f.id===i)?.label??i??"Unknown",a=t.title,d=q3(e.kind);Jy+=1,rt({operationNotifications:{...We.operationNotifications,[e.operationId]:{kind:d,operationId:e.operationId,theaterId:i,theaterLabel:s,operationLabel:a,lastRaisedSeq:Jy}}})}function Sw(){rt({addingTheater:!0,theaterError:null})}function xw(e){const t=[e,...We.theaters.filter(i=>i.id!==e.id)];ud(e.id),rt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function j3(){rt({addingTheater:!1,theaterError:null})}function qm(e){rt({addingTheater:!1,theaterError:e})}function mc(e){const t=We.operations.find(i=>i.id===e);t&&(ud(t.theaterId),rt({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:Ew(We.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function Pp(){We.pendingOperationFocus!==null&&rt({pendingOperationFocus:null})}function I3(e,t,i){if(e.length===0)return null;const s=t?e.indexOf(t):-1,a=s===-1?i>0?0:e.length-1:(s+i+e.length)%e.length;return e[a]??null}function l_(e,t){if(t.length===0)return[...e].sort(Km);const i=new Map(t.map((s,a)=>[s,a]));return[...e].sort((s,a)=>{const d=i.get(s.id),f=i.get(a.id);return d!==void 0&&f!==void 0?d-f:d!==void 0?-1:f!==void 0?1:Km(s,a)})}function ww(e,t,i,s=[]){const a=l_(e,i),d=new Set(s),f=[...t].sort((h,p)=>h.order-p.order||h.createdAt-p.createdAt),c=new Map;for(const h of f)c.set(h.id,[]);c.set(null,[]);for(const h of a){const p=h.groupId??null;p!==null&&c.has(p)?c.get(p).push(h):c.get(null).push(h)}return[...f.filter(h=>!d.has(h.id)).flatMap(h=>c.get(h.id)??[]),...c.get(null)??[]]}function Km(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function zp(){rt({operationSearchOpen:!1})}function Cw(){rt({operationSearchOpen:!We.operationSearchOpen})}function B3(){We.releaseNotes.length===0||We.whatsNewOpen||rt({whatsNewOpen:!0,selectedReleaseNoteKey:We.selectedReleaseNoteKey??Aw(We.releaseNotes)})}function Ku(){We.whatsNewOpen&&(We.automaticWhatsNewVersion&&J3(We.automaticWhatsNewVersion),rt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function Qy(e){Rw(We.releaseNotes,e)&&rt({selectedReleaseNoteKey:e})}function Nl(){X3(!0),We.onboardingOpen&&rt({onboardingOpen:!1})}function Gr(e){rt({codexReader:e,codexReaderExpanded:!1})}function vh(){We.codexReader!==null&&rt({codexReaderExpanded:!0})}function P3(){rt({codexReaderExpanded:!1})}function Hp(){rt({codexReader:null,codexReaderExpanded:!1})}function e1(){if(We.bootstrapped)return;const e=We.theaters.length===0&&!Y3();rt({bootstrapped:!0,onboardingOpen:e?!0:We.onboardingOpen})}function t1(e){const t=We.theaters.filter(f=>f.id!==e),i=kw(t,We.activeTheaterId===e?null:We.activeTheaterId),s=G3(We.operationNotifications,e),a=new Set(We.operations.filter(f=>f.theaterId===e).map(f=>f.id)),d=We.activeOperationId&&a.has(We.activeOperationId)?null:We.activeOperationId;ud(i),rt({theaters:t,activeTheaterId:i,activeOperationId:d,operationNotifications:s})}function z3(e){const t=Ew(We.operationNotifications,e);t!==We.operationNotifications&&rt({operationNotifications:t})}function H3(e){const t={...We.notificationPreferences,globalMute:e};u_(t),rt({notificationPreferences:t})}function $3(e){const t={...We.notificationPreferences,dnd:e};u_(t),rt({notificationPreferences:t})}function F3(e){const t={...We.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const i={...We.notificationPreferences,mutedTheaterIds:t};u_(i),rt({notificationPreferences:i})}function U3(e){return r3(e)}function W3(){for(const e of Um)e()}function Ew(e,t){if(!e[t])return e;const i={...e};return delete i[t],i}function G3(e,t){let i=!1;const s={};for(const[a,d]of Object.entries(e)){if(d.theaterId===t){i=!0;continue}s[a]=d}return i?s:e}function kw(e,t){const i=new Set(e.map(a=>a.id)),s=K3();return s&&i.has(s)?s:t&&i.has(t)?t:e[0]?.id??null}function q3(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function Tw(e){const t=e.releaseNotes.findIndex(s=>s.version!=="Unreleased"),i=t>=0?e.releaseNotes[t]:void 0;return!i||!e.version||i.version!==e.version||Z3()===i.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:i.version,selectedReleaseNoteKey:c_(i.version,t)}}function Aw(e){return e[0]?c_(e[0].version,0):null}function Rw(e,t){return e.some((i,s)=>c_(i.version,s)===t)}function c_(e,t){return`${e}:${t}`}function K3(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Fm)}catch{return null}}function ud(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Fm,e):window.localStorage.removeItem(Fm)}catch{}}function V3(){if(typeof window>"u")return qu;try{const e=window.localStorage.getItem(_w);if(!e)return qu;const t=JSON.parse(e);return Q3(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:qu}catch{return qu}}function Y3(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(mw)==="1"}catch{return!1}}function X3(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(mw,"1")}catch{}}function Z3(){if(Wm!==null)return Wm;if(typeof window>"u")return null;try{return window.localStorage.getItem(gw)}catch{return null}}function J3(e){if(Wm=e,!(typeof window>"u"))try{window.localStorage.setItem(gw,e)}catch{}}function u_(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_w,JSON.stringify({version:vw,preferences:e}))}catch{}}function Q3(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==vw||!t.preferences||typeof t.preferences!="object")return!1;const i=t.preferences;return typeof i.globalMute=="boolean"&&typeof i.dnd=="boolean"&&!!i.mutedTheaterIds&&typeof i.mutedTheaterIds=="object"}function hr(){return L.useSyncExternalStore(bw,pc,pc)}const eL=[{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 (open panels only)"},{combos:[["Alt","Shift","F"]],description:"Formation view including minimized panels"},{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"}]}],Vl="data-keyboard-shortcuts-open",tL='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Lw(){return document.body.getAttribute(Vl)==="true"}function nL(){return!Lw()}function iL({onClose:e}){const t=L.useRef(null);L.useEffect(()=>{const s=t.current,a=document.querySelector(".console-shell"),d=document.body.getAttribute(Vl);return document.body.setAttribute(Vl,"true"),a&&(a.inert=!0),s?.focus(),()=>{d===null?document.body.removeAttribute(Vl):document.body.setAttribute(Vl,d),a&&(a.inert=!1)}},[e]);const i=s=>{if(s.key==="Escape"){s.preventDefault(),e();return}if(s.key!=="Tab")return;const a=[...t.current?.querySelectorAll(tL)??[]];if(a.length===0){s.preventDefault(),t.current?.focus();return}const d=a[0],f=a[a.length-1],c=document.activeElement;(c===t.current||!t.current?.contains(c)||(s.shiftKey?c===d:c===f))&&(s.preventDefault(),(s.shiftKey?f:d)?.focus())};return js.createPortal(l.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:l.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:i,onMouseDown:s=>s.stopPropagation(),children:[l.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[l.jsx("strong",{children:"Keyboard Shortcuts"}),l.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),eL.map(s=>l.jsxs("section",{className:"keyboard-shortcuts-group",children:[l.jsx("h3",{children:s.title}),l.jsx("dl",{children:s.entries.map(a=>l.jsxs("div",{children:[l.jsx("dt",{children:a.combos.map((d,f)=>l.jsxs("span",{children:[f>0?" or ":null,d.map(c=>l.jsx("kbd",{children:c==="Mod"?"⌘/Ctrl":c},c))]},d.join("+")))}),l.jsx("dd",{children:a.description})]},`${s.title}:${a.description}`))})]},s.title))]})}),document.body)}const rL=1400,sL="https://github.com/sbluemin/fleet-harness",aL="https://github.com/sbluemin/fleet-harness/stargazers",oL="https://api.github.com/repos/sbluemin/fleet-harness",h_="fleet-console.github-stars",lL=360*60*1e3,n1='[role="menuitem"]:not([disabled])';function cL(){const e=hr();return l.jsxs("div",{className:"side-bar-brand-foot",children:[l.jsx(hL,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),l.jsx(dL,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function uL({className:e="brand-foot-home"}){return l.jsxs(dc,{className:e,to:"/operations","aria-label":"Operations",children:[l.jsx(wL,{}),l.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function hL({latestVersion:e,updateAvailable:t}){const i=L.useRef(null),s=L.useRef(null),a=L.useRef(null),[d,f]=L.useState(!1),c=Lc();Mw(i,s,a,d,f);const h=p=>{f(!1),c(p),window.requestAnimationFrame(()=>{const g=document.querySelector("main h2, h2");g?.focus?.(),g&&document.activeElement!==g&&(g.setAttribute("tabindex","-1"),g.focus())})};return l.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-system-menu",children:[l.jsxs("button",{ref:s,type:"button",className:"brand-foot-system-trigger",onClick:()=>f(p=>!p),"aria-haspopup":"menu","aria-expanded":d,"aria-label":"System Menu",title:"System Menu",children:[l.jsx(i1,{}),l.jsx("span",{children:"System Menu"})]}),d?l.jsxs("div",{ref:a,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>h("/settings"),children:[l.jsx(i1,{}),l.jsx("span",{children:"Settings"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>h("/carrier-settings"),children:[l.jsx(CL,{}),l.jsx("span",{children:"Carriers"})]}),t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),l.jsx(fL,{latestVersion:e})]}):null]}):null]})}function dL({releaseDisabled:e,version:t}){const i=L.useRef(null),s=L.useRef(null),a=L.useRef(null),[d,f]=L.useState(!1),[c,h]=L.useState(!1);return Mw(i,s,a,d,f),l.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-help-menu",children:[l.jsx("button",{ref:s,type:"button",className:"brand-foot-help-trigger",onClick:()=>f(p=>!p),"aria-haspopup":"menu","aria-expanded":d,"aria-label":"Help",title:"Help",children:l.jsx(EL,{})}),d?l.jsxs("div",{ref:a,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[l.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{f(!1),B3()},children:[l.jsx(kL,{}),l.jsx("span",{children:"What's New"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{f(!1),h(!0)},children:[l.jsx(TL,{}),l.jsx("span",{children:"Keyboard Shortcuts"})]}),l.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),l.jsx(pL,{menuItem:!0,version:t})]}):null,c?l.jsx(iL,{onClose:()=>{h(!1),s.current?.focus()}}):null]})}function Mw(e,t,i,s,a){L.useEffect(()=>{if(!s)return;const d=window.requestAnimationFrame(()=>{i.current?.querySelector(n1)?.focus()}),f=h=>{h.target instanceof Node&&e.current?.contains(h.target)||a(!1)},c=h=>{if(h.key==="Escape"){a(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(h.key))return;const p=[...i.current?.querySelectorAll(n1)??[]];if(p.length===0)return;h.preventDefault();const g=p.findIndex(S=>S===document.activeElement),m=h.key==="Home"||h.key==="ArrowDown"&&g===p.length-1?0:h.key==="End"||h.key==="ArrowUp"&&g<=0?p.length-1:h.key==="ArrowDown"?g+1:g-1;p[m]?.focus()};return window.addEventListener("pointerdown",f,!0),window.addEventListener("keydown",c,!0),()=>{window.cancelAnimationFrame(d),window.removeEventListener("pointerdown",f,!0),window.removeEventListener("keydown",c,!0)}},[i,s,e,a,t])}function fL({latestVersion:e}){const[t,i]=L.useState("idle"),[s,a]=L.useState(null),d=L.useRef(null),f=mL(t,s,e);L.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]);const c=async()=>{if(!f.disabled){d.current!==null&&(window.clearTimeout(d.current),d.current=null),i("applying"),a(null);try{if((await zR()).status!=="accepted"){i("error"),a("invalid_response");return}i("accepted"),d.current=window.setTimeout(()=>{d.current=null,i("completed")},rL)}catch(h){const p=h instanceof dt?h.message:"network_error";a(p),i(_L(p)?"blocked":"error")}}};return l.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${f.tone}`,onClick:c,disabled:f.disabled,title:f.title,"aria-live":"polite",children:f.label})}function pL({menuItem:e=!1,version:t}){const i=vL(),s=i.count!==null;return l.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[l.jsx("a",{className:"brand-foot-github-link",href:sL,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:l.jsx(AL,{})}),l.jsxs("a",{className:"brand-foot-github-stars",href:aL,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":s?`GitHub stars ${i.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[l.jsx(RL,{}),s?l.jsx("span",{className:"brand-foot-github-stars-count",children:xL(i.count)}):null]}),l.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function mL(e,t,i){const s=i?`Latest version ${i}`:"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"?gL(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:s,tone:"warn",disabled:!1}}function gL(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",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 _L(e){return e==="local_channel"||e==="update_already_in_progress"||e==="update_not_available"}function vL(){const[e,t]=L.useState(()=>{const i=bL();return i===null?{count:null,status:"idle"}:{count:i,status:"ready"}});return L.useEffect(()=>{if(yL())return;let i=!1;return t(s=>s.status==="ready"?s:{...s,status:"loading"}),fetch(oL,{headers:{Accept:"application/vnd.github+json"}}).then(s=>s.ok?s.json():Promise.reject(new Error(`status ${s.status}`))).then(s=>{if(i)return;const a=typeof s.stargazers_count=="number"?s.stargazers_count:null;if(a===null){t(d=>({count:d.count,status:d.count===null?"error":"ready"}));return}SL(a),t({count:a,status:"ready"})}).catch(()=>{i||t(s=>({count:s.count,status:s.count===null?"error":"ready"}))}),()=>{i=!0}},[]),e}function bL(){try{const e=window.localStorage.getItem(h_);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function yL(){try{const e=window.localStorage.getItem(h_);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<lL}catch{return!1}}function SL(e){try{window.localStorage.setItem(h_,JSON.stringify({count:e,at:Date.now()}))}catch{}}function xL(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function wL(){return l.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),l.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),l.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),l.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),l.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),l.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function CL(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"4",cy:"4.2",r:"1.15",fill:"currentColor"}),l.jsx("circle",{cx:"4",cy:"8",r:"1.15",fill:"currentColor"}),l.jsx("circle",{cx:"4",cy:"11.8",r:"1.15",fill:"currentColor"}),l.jsx("path",{d:"M7.2 4.2h6M7.2 8h6M7.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function i1(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),l.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function EL(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.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"}),l.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function kL(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function TL(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function AL(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 RL(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 LL=new Set(["path","cwd","realpath","token","ticket","gitdir","folderGrantId"]);class or extends Error{status;constructor(t,i){super(i),this.status=t}}async function ML(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{signal:t});return await dd(i),Ow(await i.json(),i.status)}async function Nw(e,t,i){t!==null&&Dw(t);const s=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t}),signal:i});return await dd(s),Ow(await s.json(),s.status)}async function NL(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/worktrees`,{signal:t});return await dd(i),DL(await i.json(),i.status)}async function OL(e,t,i){t!==null&&Dw(t);const s=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/directories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:t}),signal:i});return await dd(s),jL(await s.json(),s.status)}function Ow(e,t=200){gc(e,t);const i=e;if(i.kind!=="root"&&i.kind!=="worktree"&&i.kind!=="directory"||!jw(i.label))throw new or(t,"Invalid path context response");if(i.relPath!==null&&(typeof i.relPath!="string"||!hd(i.relPath)))throw new or(t,"Invalid path context response");if(i.kind==="root"!=(i.relPath===null))throw new or(t,"Invalid path context response");return{kind:i.kind,relPath:i.relPath,label:i.label}}function DL(e,t=200){gc(e,t);const i=e;if(typeof i.isGitRepo!="boolean"||!Array.isArray(i.worktrees))throw new or(t,"Invalid worktrees response");return{isGitRepo:i.isGitRepo,worktrees:i.worktrees.map(s=>{gc(s,t);const a=s;if(typeof a.relPath!="string"||!hd(a.relPath)||a.branch!==null&&typeof a.branch!="string"||typeof a.isCurrent!="boolean")throw new or(t,"Invalid worktrees response");return{relPath:a.relPath,branch:a.branch,isCurrent:a.isCurrent}})}}function jL(e,t=200){gc(e,t);const i=e;if(!Array.isArray(i.directories))throw new or(t,"Invalid directories response");return i.directories.map(s=>{gc(s,t);const a=s;if(typeof a.relPath!="string"||!hd(a.relPath)||!jw(a.label))throw new or(t,"Invalid directories response");return{relPath:a.relPath,label:a.label}})}function Dw(e){if(!hd(e))throw new or(400,"Invalid relative path")}function hd(e){return e.length>0&&e.length<=4096&&!e.includes("\0")&&!e.includes("\\")&&!e.startsWith("/")&&!/^[A-Za-z]:/.test(e)&&!e.split("/").some(t=>t===""||t==="."||t==="..")}function jw(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/.test(e)}function gc(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new or(t,"Invalid path context response");for(const i of Object.keys(e))if(LL.has(i.toLowerCase()))throw new or(t,"Unsafe path context response")}async function dd(e){if(e.ok)return;let t=e.statusText||"Request failed";try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new or(e.status,t)}function IL({theaterId:e,parentPath:t,selectedRelPath:i,isDisabled:s,loadDirectories:a,onSelect:d}){const[f,c]=L.useState(null),[h,p]=L.useState(null);return L.useEffect(()=>{const g=new AbortController;return c(null),p(null),a(t,g.signal).then(c).catch(m=>{g.signal.aborted||p(m instanceof Error?m.message:"Unable to load directories")}),()=>g.abort()},[e,t,a]),h?L.createElement("div",{className:"rail-context-tree-status"},h):f?L.createElement("div",{className:"rail-context-tree",role:"tree","aria-label":"Directories"},f.map(g=>L.createElement(Iw,{key:g.relPath,directory:g,theaterId:e,depth:0,selectedRelPath:i,isDisabled:s,loadDirectories:a,onSelect:d}))):L.createElement("div",{className:"rail-context-tree-status"},"Loading directories…")}function Iw({directory:e,theaterId:t,depth:i,selectedRelPath:s,isDisabled:a,loadDirectories:d,onSelect:f}){const[c,h]=L.useState(!1),[p,g]=L.useState(null),[m,S]=L.useState(!1),w=L.useCallback(()=>{if(c){h(!1);return}if(h(!0),p)return;const _=new AbortController;S(!0),d(e.relPath,_.signal).then(g).catch(()=>g([])).finally(()=>S(!1))},[p,e.relPath,c,d]),T=L.createElement("div",{className:`rail-context-tree-row${i>0?" is-nested":""}`,style:{paddingLeft:`${i*16}px`}},L.createElement("button",{className:`rail-context-expand${c?" is-expanded":""}`,type:"button",disabled:a,"aria-label":`${c?"Collapse":"Expand"} ${e.label}`,onClick:w},"▸"),L.createElement("button",{className:`rail-context-select${s===e.relPath?" is-selected":""}`,type:"button",disabled:a,onClick:()=>f(e.relPath)},L.createElement("span",{className:"rail-context-folder","aria-hidden":"true"}),L.createElement("span",{className:"rail-context-badge rail-context-badge--directory"},"DIR"),L.createElement("span",{className:"rail-context-row-label"},e.label))),C=c&&p?.map(_=>L.createElement(Iw,{key:_.relPath,directory:_,theaterId:t,depth:i+1,selectedRelPath:s,isDisabled:a,loadDirectories:d,onSelect:f}));return L.createElement("div",{className:"rail-context-tree-node",role:"treeitem","aria-expanded":c},T,c&&m?L.createElement("div",{className:"rail-context-tree-status"},"Loading…"):null,C)}const Bw=L.forwardRef(function({className:t,theaterId:i,theaterLabel:s,context:a,isMutating:d,onSelect:f,onClose:c},h){const[p,g]=L.useState(null);L.useEffect(()=>{const w=new AbortController;return NL(i,w.signal).then(g).catch(()=>g({isGitRepo:!1,worktrees:[]})),()=>w.abort()},[i]),L.useEffect(()=>{const w=T=>{T.key==="Escape"&&c()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);const m=L.useCallback((w,T)=>OL(i,w,T),[i]),S=L.useCallback(w=>{d||f(w)},[d,f]);return l.jsxs("div",{ref:h,className:`rail-context-deck${t?` ${t}`:""}`,role:"dialog","aria-label":"Path context",children:[l.jsx("div",{className:"rail-context-deck-caption",children:"Path context · applies to all path-aware panels"}),l.jsxs("button",{className:`rail-context-row${a.relPath===null?" is-selected":""}`,type:"button",disabled:d,onClick:()=>S(null),children:[l.jsx("span",{className:"rail-context-badge rail-context-badge--root",children:"ROOT"}),l.jsx("span",{className:"rail-context-row-label",children:s}),l.jsx("span",{className:"rail-context-row-secondary",children:"THEATER"})]}),l.jsxs("section",{className:"rail-context-section","aria-label":"Directories",children:[l.jsx("h3",{children:"DIRECTORIES"}),l.jsx(IL,{theaterId:i,parentPath:null,selectedRelPath:a.relPath,isDisabled:d,loadDirectories:m,onSelect:S},`${i}:${a.relPath??"root"}`)]}),p?.isGitRepo?l.jsxs("section",{className:"rail-context-section","aria-label":"Worktrees",children:[l.jsx("h3",{children:"WORKTREES"}),p.worktrees.map(w=>l.jsxs("button",{className:`rail-context-row${a.relPath===w.relPath?" is-selected":""}`,type:"button",title:w.relPath,disabled:d,onClick:()=>S(w.relPath),children:[l.jsx("span",{className:"rail-context-badge rail-context-badge--worktree",children:"WORKTREE"}),l.jsx("span",{className:"rail-context-row-label",children:w.relPath.split("/").at(-1)}),w.branch?l.jsx("span",{className:"rail-context-row-secondary",children:w.branch}):null]},w.relPath))]}):null,l.jsx("div",{className:"rail-context-deck-hint",children:"Selected once · delivered to plugins via SDK"})]})}),Vm="fleet-console.rail.activePanelId",Pw="fleet-console.rail.chromeExpanded",Ym=new Set,la=new Map,Xm=new Map,vo=new Map,rc=new Map;let Ph=null,Yl=0,St={activeRailPanelId:WL(),railChromeExpanded:GL(),panelExtraWidth:0,pathContextTheaterId:null,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextMutationInProgress:!1,pathContextError:null,isPathContextDeckOpen:!1};function BL(e,t,i){return!e||t===null||i}function fd(e){return Ym.add(e),()=>{Ym.delete(e)}}function pd(){return St}function PL(e){const t=St.activeRailPanelId===e?null:e;Di({...St,activeRailPanelId:t,panelExtraWidth:0,isPathContextDeckOpen:!1}),Gw(t)}function zL(){St.activeRailPanelId!==null&&(Di({...St,activeRailPanelId:null,panelExtraWidth:0,isPathContextDeckOpen:!1}),Gw(null))}function HL(e){St.railChromeExpanded!==e&&(Di({...St,railChromeExpanded:e,isPathContextDeckOpen:!1}),qL(e))}function zw(){HL(!St.railChromeExpanded)}function $L(e,t){if(e!==St.activeRailPanelId)return;const i=t===null||!Number.isFinite(t)?0:t,s=Math.max(0,Math.round(i)),a=typeof window<"u"?Math.min(s,Math.max(0,window.innerWidth-548)):s;a!==St.panelExtraWidth&&Di({...St,panelExtraWidth:a})}function Hw(e){Ph?.abort(),Ph=null,Yl+=1;const t=e?la.get(e):void 0;Di({...St,pathContextTheaterId:e,pathContext:t?.context??null,pathContextHydrated:t?.isHydrated??!1,pathContextLoading:t?.isLoading??!1,pathContextMutationInProgress:e!==null&&qw(e),pathContextError:t?.error??null,isPathContextDeckOpen:!1})}async function FL(e,t){St.pathContextTheaterId!==e&&Hw(e),Ph?.abort();const i=new AbortController;Ph=i;const s=++Yl,a=rc.get(e)??0;la.set(e,{context:null,isHydrated:!1,isLoading:!0,error:null}),St.pathContextTheaterId===e&&Di({...St,pathContext:null,pathContextHydrated:!1,pathContextLoading:!0,pathContextError:null});try{if(await(Xm.get(e)??Promise.resolve()),i.signal.aborted||s!==Yl)return;const d=await t(i.signal);if(i.signal.aborted||s!==Yl||a!==(rc.get(e)??0))return;const f={context:d,isHydrated:!0,isLoading:!1,error:null};la.set(e,f),St.pathContextTheaterId===e&&Di({...St,pathContext:d,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null})}catch(d){if(i.signal.aborted||s!==Yl||a!==(rc.get(e)??0))return;const f=d instanceof Error?d.message:"Unable to load path context";la.set(e,{context:null,isHydrated:!1,isLoading:!1,error:f}),St.pathContextTheaterId===e&&Di({...St,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextError:f})}}async function $w(e,t){if(St.pathContextTheaterId!==e)return null;rc.set(e,(rc.get(e)??0)+1),VL(e);const s=(Xm.get(e)??Promise.resolve()).then(()=>KL(e,t));return Xm.set(e,s.then(()=>{})),s}function bh(e){e!==St.isPathContextDeckOpen&&Di({...St,isPathContextDeckOpen:e})}function Fw(){return L.useSyncExternalStore(fd,pd).activeRailPanelId}function Uw(){return L.useSyncExternalStore(fd,pd).railChromeExpanded}function UL(){return L.useSyncExternalStore(fd,pd).panelExtraWidth}function Ww(){return L.useSyncExternalStore(fd,pd)}function WL(){try{return localStorage.getItem(Vm)}catch{return null}}function GL(){try{return localStorage.getItem(Pw)!=="0"}catch{return!0}}function Gw(e){try{e===null?localStorage.removeItem(Vm):localStorage.setItem(Vm,e)}catch{}}function qL(e){try{localStorage.setItem(Pw,e?"1":"0")}catch{}}async function KL(e,t){try{const i=await t(new AbortController().signal),s={context:i,isHydrated:!0,isLoading:!1,error:null};return la.set(e,s),St.pathContextTheaterId===e&&Di({...St,pathContext:i,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null,isPathContextDeckOpen:!1}),i}catch(i){const s=i instanceof Error?i.message:"Unable to save path context",a=la.get(e);return la.set(e,{context:a?.context??null,isHydrated:a?.isHydrated??!1,isLoading:!1,error:s}),St.pathContextTheaterId===e&&Di({...St,pathContextError:s}),null}finally{YL(e)}}function qw(e){return(vo.get(e)??0)>0}function VL(e){vo.set(e,(vo.get(e)??0)+1),St.pathContextTheaterId===e&&Di({...St,pathContextMutationInProgress:!0,pathContextError:null})}function YL(e){const t=(vo.get(e)??1)-1;t>0?vo.set(e,t):vo.delete(e),St.pathContextTheaterId===e&&Di({...St,pathContextMutationInProgress:qw(e)})}function Di(e){St=e;for(const t of Ym)t()}function Kw(e){const{sizeRange:t}=e,[i,s]=L.useState(""),[a,d]=L.useState(e.size),f=L.useRef(Promise.resolve()),c=L.useId(),h=L.useMemo(()=>XL(e),[e]),p=L.useMemo(()=>ZL(h,i),[h,i]),g=L.useMemo(()=>p.map((R,N)=>({row:R,index:N})),[p]),[m,S]=L.useState(()=>JL(h,e.selected)),w=h.find(R=>zh(R.selection,e.selected))??null,T=g[Math.min(m,Math.max(0,g.length-1))]?.row??null,C=`${c}-built-ins`,_=`${c}-installed`;L.useEffect(()=>{d(e.size)},[e.size]),L.useEffect(()=>{m>=g.length&&S(Math.max(0,g.length-1))},[m,g.length]);const b=L.useCallback(R=>{const N=s1(R,t);d(N),f.current=f.current.catch(()=>{}).then(()=>e.onSizeCommit(N))},[e.onSizeCommit,t]),v=L.useCallback(R=>{p.length&&S(N=>(N+R+p.length)%p.length)},[p.length]),y=L.useCallback(()=>{T&&!T.unavailable&&e.onSelectionChange(T.selection)},[T,e]),k=L.useCallback((R,N)=>{S(R),e.onSelectionChange(N)},[e]),M=R=>{R.key==="ArrowDown"?(R.preventDefault(),v(1)):R.key==="ArrowUp"?(R.preventDefault(),v(-1)):R.key==="Home"?(R.preventDefault(),S(0)):R.key==="End"?(R.preventDefault(),S(Math.max(0,p.length-1))):(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),y())};return l.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:l.jsxs("div",{className:"fc-font-browser__panes",children:[l.jsxs("div",{className:"fc-font-browser__chooser",children:[l.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${c}-search`,children:"Search fonts"}),l.jsx("input",{id:`${c}-search`,className:"fc-font-browser__search",type:"search",value:i,disabled:e.disabled,placeholder:"Search installed fonts",onChange:R=>{s(R.currentTarget.value),S(0)}}),e.loading?l.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?l.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,l.jsxs("div",{id:c,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":T?Vw(c,m):void 0,"aria-busy":e.loading||void 0,onKeyDown:M,children:[l.jsx(r1,{groupId:C,label:"Built-in",rows:g.filter(({row:R})=>R.source==="builtin"),activeRow:T,selected:e.selected,listboxId:c,disabled:e.disabled,onSelect:k}),l.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),l.jsx(r1,{groupId:_,label:"Installed on this machine",rows:g.filter(({row:R})=>R.source==="system"),activeRow:T,selected:e.selected,listboxId:c,disabled:e.disabled,onSelect:k}),!e.loading&&!g.length?l.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),l.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[l.jsxs("div",{className:"fc-font-browser__preview-head",children:[l.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),l.jsx("span",{className:`fc-font-browser__availability${w?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:w?.unavailable?"Unavailable":"Available"})]}),l.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:w?.previewFamily??e.fallbackStack,fontSize:`${a}px`},children:e.previewText}),l.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[l.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||a<=t.min,onClick:()=>b(a-t.step),"aria-label":"Decrease font size",children:"−"}),l.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[a,"px"]}),l.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||a>=t.max,onClick:()=>b(a+t.step),"aria-label":"Increase font size",children:"+"})]}),l.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:a,disabled:e.disabled,"aria-label":"Font size slider",onChange:R=>d(s1(Number(R.currentTarget.value),t)),onPointerUp:R=>b(Number(R.currentTarget.value)),onKeyUp:R=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(R.key)&&b(Number(R.currentTarget.value))}})]})]})})}function r1({groupId:e,label:t,rows:i,activeRow:s,selected:a,listboxId:d,disabled:f,onSelect:c}){return l.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[l.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),i.map(({row:h,index:p})=>l.jsxs("button",{id:Vw(d,p),type:"button",className:`fc-font-browser__row${zh(h.selection,s?.selection??null)?" is-active":""}${h.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":zh(h.selection,a),disabled:f||h.unavailable,onClick:()=>c(p,h.selection),children:[l.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:h.previewFamily},children:h.label}),h.description?l.jsx("span",{className:"fc-font-browser__row-meta",children:h.description}):null,h.unavailable?l.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},h.id))]})}function XL(e){const t=new Set,i=e.builtIns.flatMap(d=>{const f=[d.id,d.label,...d.aliases??[]].map(sc);return f.some(c=>t.has(c))?[]:(f.forEach(c=>t.add(c)),[{id:`builtin-${d.id}`,label:d.label,family:d.family,previewFamily:d.family,source:"builtin",selection:{source:"builtin",id:d.id},description:d.description,unavailable:!1}])}),s=e.installedFonts.map(d=>({id:`system-${sc(d.family)}`,label:d.family,family:d.family,previewFamily:jh(d.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:d.family},description:d.monospace?"Monospace":"System font",unavailable:!f3(d.family)})),a=e.selected.source==="system"?e.selected.familyName:null;return a!==null&&!s.some(d=>d.family===a)&&s.unshift({id:`system-${sc(a)}`,label:e.selectedSystemFont??a,family:a,previewFamily:jh(a,e.fallbackStack),source:"system",selection:{source:"system",familyName:a},description:"Saved system font",unavailable:!0}),[...i,...s]}function ZL(e,t){const i=sc(t);return i?e.filter(s=>sc(`${s.label} ${s.description??""}`).includes(i)):e}function sc(e){return e.trim().toLocaleLowerCase()}function Vw(e,t){return`${e}-option-${t}`}function JL(e,t){const i=e.findIndex(s=>zh(s.selection,t));return i>=0?i:0}function zh(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function s1(e,t){if(!Number.isFinite(e))return t.defaultValue;const i=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,i))}const QL="/api/v1/settings/fonts/system";class uo extends Error{status;constructor(t,i=null){super(t),this.name="SystemFontsFetchError",this.status=i}}function eM(e){if(!Xw(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new uo("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(tM)}}async function Yw(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new uo("System font fetching is unavailable in this environment.");let i;try{i=await t(QL,{method:"GET",signal:e.signal})}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?a:new uo("System fonts could not be loaded.")}if(!i.ok)throw new uo("System fonts could not be loaded.",i.status);let s;try{s=await i.json()}catch{throw new uo("System font response is not valid JSON.",i.status)}return eM(s)}function tM(e){if(!Xw(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new uo("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function nM(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Xw(e,t){return nM(e)&&Object.keys(e).length===t.length&&t.every(i=>Object.hasOwn(e,i))}const a1=250,iM=5e3,o1=1,rM=1013,sM=4e3,aM=4001;function oM(e){const t=new AbortController,i=new TextEncoder;let s=a1,a=null,d=null,f=null,c=!1;const h=()=>{d?.dispose(),d=null},p=(S,w)=>{f={cols:S,rows:w},a?.readyState===o1&&a.send(JSON.stringify({type:"resize",cols:S,rows:w}))},g=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:S}=await cM(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await m(lM(S,e.location,e.wsPath),e),s=a1}catch(S){if(t.signal.aborted)return;e.onStatus?.("connecting",S instanceof Error?S.message:String(S))}await hM(s,t.signal),s=Math.min(s*2,iM)}},m=async(S,w)=>{await new Promise((T,C)=>{const _=(w.webSocketFactory??uM)(S);a=_,_.binaryType="arraybuffer",_.onopen=()=>{w.onStatus?.("live"),h(),d=w.terminal.onData(b=>{_.readyState===o1&&_.send(i.encode(b))}),f&&p(f.cols,f.rows)},_.onmessage=b=>{b.data instanceof ArrayBuffer&&w.terminal.write(new Uint8Array(b.data))},_.onerror=()=>{C(new Error("Terminal WebSocket error"))},_.onclose=b=>{h(),a===_&&(a=null);const v=b?.code;v===sM?(t.abort(),w.onStatus?.("closed","terminal_replaced")):v===aM?(t.abort(),w.onStatus?.("closed","terminal_closed"),w.onExit?.()):v===rM&&(t.abort(),w.onStatus?.("closed","terminal_unavailable")),T()}})};return{start:()=>{c||(c=!0,g())},resize:p,dispose:()=>{t.abort(),h(),e.onStatus?.("closed"),a?.close(),a=null}}}function lM(e,t=window.location,i){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${i}?ticket=${encodeURIComponent(e)}`}async function cM(e,t,i){const s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:i});if(!s.ok)throw new Error(`Terminal ticket request failed: ${s.status}`);const a=await s.json();if(typeof a.ticket!="string"||typeof a.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:a.ticket,ttlMs:a.ttlMs}}function uM(e){return new WebSocket(e)}async function hM(e,t){await new Promise(i=>{const s=()=>{clearTimeout(a),t.removeEventListener("abort",s),i()},a=setTimeout(s,e);t.addEventListener("abort",s)})}var $p={exports:{}},l1;function dM(){return l1||(l1=1,(function(e,t){(function(i,s){e.exports=s()})(self,(()=>(()=>{var i={};return(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),s.FitAddon=void 0,s.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const d=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(d._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,d=a._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;const f=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),p=Math.max(0,parseInt(c.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),m=h-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),S=p-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-f;return{cols:Math.max(2,Math.floor(S/d.css.cell.width)),rows:Math.max(1,Math.floor(m/d.css.cell.height))}}}})(),i})()))})($p)),$p.exports}var fM=dM(),yh={exports:{}},pM=yh.exports,c1;function mM(){return c1||(c1=1,(function(e,t){(function(i,s){e.exports=s()})(pM,(()=>(()=>{var i={433:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV11=void 0;const p=h(938),g=[[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]],m=[[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]],S=[[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]],w=[[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]];let T;function C(_,b){let v,y=0,k=b.length-1;if(_<b[0][0]||_>b[k][1])return!1;for(;k>=y;)if(v=y+k>>1,_>b[v][1])y=v+1;else{if(!(_<b[v][0]))return!0;k=v-1}return!1}c.UnicodeV11=class{constructor(){if(this.version="11",!T){T=new Uint8Array(65536),T.fill(1),T[0]=0,T.fill(0,1,32),T.fill(0,127,160);for(let _=0;_<g.length;++_)T.fill(0,g[_][0],g[_][1]+1);for(let _=0;_<S.length;++_)T.fill(2,S[_][0],S[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?T[_]:C(_,m)?0:C(_,w)?2:1}charProperties(_,b){let v=this.wcwidth(_),y=v===0&&b!==0;if(y){const k=p.UnicodeService.extractWidth(b);k===0?y=!1:k>v&&(v=k)}return p.UnicodeService.createPropertyValue(0,v,y)}}},345:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let p=0;p<this._listeners.length;p++)if(this._listeners[p]===h)return void this._listeners.splice(p,1)}}})),this._event}fire(h,p){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,h,p)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,p){return h((g=>p.fire(g)))},c.runAndSubscribe=function(h,p){return p(void 0),h((g=>p(g)))}},490:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const p=h(938),g=[[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]],m=[[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]];let S;c.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let w=0;w<g.length;++w)S.fill(0,g[w][0],g[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?S[w]:(function(T,C){let _,b=0,v=C.length-1;if(T<C[0][0]||T>C[v][1])return!1;for(;v>=b;)if(_=b+v>>1,T>C[_][1])b=_+1;else{if(!(T<C[_][0]))return!0;v=_-1}return!1})(w,m)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,T){let C=this.wcwidth(w),_=C===0&&T!==0;if(_){const b=p.UnicodeService.extractWidth(T);b===0?_=!1:b>C&&(C=b)}return p.UnicodeService.createPropertyValue(0,C,_)}}},938:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const p=h(345),g=h(490);class m{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,T,C=!1){return(16777215&w)<<3|(3&T)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const w=new g.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let T=0,C=0;const _=w.length;for(let b=0;b<_;++b){let v=w.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=_)return T+this.wcwidth(v);const M=w.charCodeAt(b);56320<=M&&M<=57343?v=1024*(v-55296)+M-56320+65536:T+=this.wcwidth(M)}const y=this.charProperties(v,C);let k=m.extractWidth(y);m.extractShouldJoin(y)&&(k-=m.extractWidth(C)),T+=k,C=y}return T}charProperties(w,T){return this._activeProvider.charProperties(w,T)}}c.UnicodeService=m}},s={};function a(f){var c=s[f];if(c!==void 0)return c.exports;var h=s[f]={exports:{}};return i[f](h,h.exports,a),h.exports}var d={};return(()=>{var f=d;Object.defineProperty(f,"__esModule",{value:!0}),f.Unicode11Addon=void 0;const c=a(433);f.Unicode11Addon=class{activate(h){h.unicode.register(new c.UnicodeV11)}dispose(){}}})(),d})()))})(yh)),yh.exports}var gM=mM();var _M=(e,t,i,s)=>{for(var a=t,d=e.length-1,f;d>=0;d--)(f=e[d])&&(a=f(a)||a);return a},vM=(e,t)=>(i,s)=>t(i,s,e),bM=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?u1.isErrorNoTelemetry(e)?new u1(e.message+`
12
+
13
+ `+e.stack):new Error(e.message+`
14
+
15
+ `+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)}},yM=new bM;function Fp(e){SM(e)||yM.onUnexpectedError(e)}var Zm="Canceled";function SM(e){return e instanceof xM?!0:e instanceof Error&&e.name===Zm&&e.message===Zm}var xM=class extends Error{constructor(){super(Zm),this.name=this.message}},u1=class Jm extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Jm)return t;let i=new Jm;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},wM;(e=>{function t(d){return d<0}e.isLessThan=t;function i(d){return d<=0}e.isLessThanOrEqual=i;function s(d){return d>0}e.isGreaterThan=s;function a(d){return d===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(wM||={});function CM(e,t){let i=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(i,arguments))),a}}var Zw;(e=>{function t(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*a(k){yield k}e.single=a;function d(k){return t(k)?k:a(k)}e.wrap=d;function f(k){return k||i}e.from=f;function*c(k){for(let M=k.length-1;M>=0;M--)yield k[M]}e.reverse=c;function h(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=h;function p(k){return k[Symbol.iterator]().next().value}e.first=p;function g(k,M){let R=0;for(let N of k)if(M(N,R++))return!0;return!1}e.some=g;function m(k,M){for(let R of k)if(M(R))return R}e.find=m;function*S(k,M){for(let R of k)M(R)&&(yield R)}e.filter=S;function*w(k,M){let R=0;for(let N of k)yield M(N,R++)}e.map=w;function*T(k,M){let R=0;for(let N of k)yield*M(N,R++)}e.flatMap=T;function*C(...k){for(let M of k)yield*M}e.concat=C;function _(k,M,R){let N=R;for(let A of k)N=M(N,A);return N}e.reduce=_;function*b(k,M,R=k.length){for(M<0&&(M+=k.length),R<0?R+=k.length:R>k.length&&(R=k.length);M<R;M++)yield k[M]}e.slice=b;function v(k,M=Number.POSITIVE_INFINITY){let R=[];if(M===0)return[R,k];let N=k[Symbol.iterator]();for(let A=0;A<M;A++){let I=N.next();if(I.done)return[R,e.empty()];R.push(I.value)}return[R,{[Symbol.iterator](){return N}}]}e.consume=v;async function y(k){let M=[];for await(let R of k)M.push(R);return Promise.resolve(M)}e.asyncToArray=y})(Zw||={});function Jw(e){if(Zw.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}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 Qw(...e){return Vn(()=>Jw(e))}function Vn(e){return{dispose:CM(()=>{e()})}}var eC=class tC{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{Jw(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?tC.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)}};eC.DISABLE_DISPOSED_WARNING=!1;var bo=eC,cr=class{constructor(){this._store=new bo,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)}};cr.None=Object.freeze({dispose(){}});var Ol=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}},d_=typeof process<"u"&&"title"in process,md=d_?"node":navigator.userAgent,EM=d_?"node":navigator.platform,kM=md.includes("Firefox"),TM=md.includes("Edge"),nC=/^((?!chrome|android).)*safari/i.test(md);function AM(){if(!nC)return 0;let e=md.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}EM.indexOf("Linux")>=0;var RM="",kn=0,Tn=0,An=0,un=0,Vi={css:"#00000000",rgba:0},ii;(e=>{function t(a,d,f,c){return c!==void 0?`#${ea(a)}${ea(d)}${ea(f)}${ea(c)}`:`#${ea(a)}${ea(d)}${ea(f)}`}e.toCss=t;function i(a,d,f,c=255){return(a<<24|d<<16|f<<8|c)>>>0}e.toRgba=i;function s(a,d,f,c){return{css:e.toCss(a,d,f,c),rgba:e.toRgba(a,d,f,c)}}e.toColor=s})(ii||={});var Xl;(e=>{function t(h,p){if(un=(p.rgba&255)/255,un===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,m=p.rgba>>16&255,S=p.rgba>>8&255,w=h.rgba>>24&255,T=h.rgba>>16&255,C=h.rgba>>8&255;kn=w+Math.round((g-w)*un),Tn=T+Math.round((m-T)*un),An=C+Math.round((S-C)*un);let _=ii.toCss(kn,Tn,An),b=ii.toRgba(kn,Tn,An);return{css:_,rgba:b}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,p,g){let m=ca.ensureContrastRatio(h.rgba,p.rgba,g);if(m)return ii.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=s;function a(h){let p=(h.rgba|255)>>>0;return[kn,Tn,An]=ca.toChannels(p),{css:ii.toCss(kn,Tn,An),rgba:p}}e.opaque=a;function d(h,p){return un=Math.round(p*255),[kn,Tn,An]=ca.toChannels(h.rgba),{css:ii.toCss(kn,Tn,An,un),rgba:ii.toRgba(kn,Tn,An,un)}}e.opacity=d;function f(h,p){return un=h.rgba&255,d(h,un*p/255)}e.multiplyOpacity=f;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(Xl||={});var LM;(e=>{let t,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let d=a.getContext("2d",{willReadFrequently:!0});d&&(t=d,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return kn=parseInt(a.slice(1,2).repeat(2),16),Tn=parseInt(a.slice(2,3).repeat(2),16),An=parseInt(a.slice(3,4).repeat(2),16),ii.toColor(kn,Tn,An);case 5:return kn=parseInt(a.slice(1,2).repeat(2),16),Tn=parseInt(a.slice(2,3).repeat(2),16),An=parseInt(a.slice(3,4).repeat(2),16),un=parseInt(a.slice(4,5).repeat(2),16),ii.toColor(kn,Tn,An,un);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let d=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(d)return kn=parseInt(d[1]),Tn=parseInt(d[2]),An=parseInt(d[3]),un=Math.round((d[5]===void 0?1:parseFloat(d[5]))*255),ii.toColor(kn,Tn,An,un);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[kn,Tn,An,un]=t.getImageData(0,0,1,1).data,un!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ii.toRgba(kn,Tn,An,un),css:a}}e.toColor=s})(LM||={});var ei;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,a,d){let f=s/255,c=a/255,h=d/255,p=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return p*.2126+g*.7152+m*.0722}e.relativeLuminance2=i})(ei||={});var ca;(e=>{function t(f,c){if(un=(c&255)/255,un===1)return c;let h=c>>24&255,p=c>>16&255,g=c>>8&255,m=f>>24&255,S=f>>16&255,w=f>>8&255;return kn=m+Math.round((h-m)*un),Tn=S+Math.round((p-S)*un),An=w+Math.round((g-w)*un),ii.toRgba(kn,Tn,An)}e.blend=t;function i(f,c,h){let p=ei.relativeLuminance(f>>8),g=ei.relativeLuminance(c>>8);if(Hr(p,g)<h){if(g<p){let w=s(f,c,h),T=Hr(p,ei.relativeLuminance(w>>8));if(T<h){let C=a(f,c,h),_=Hr(p,ei.relativeLuminance(C>>8));return T>_?w:C}return w}let m=a(f,c,h),S=Hr(p,ei.relativeLuminance(m>>8));if(S<h){let w=s(f,c,h),T=Hr(p,ei.relativeLuminance(w>>8));return S>T?m:w}return m}}e.ensureContrastRatio=i;function s(f,c,h){let p=f>>24&255,g=f>>16&255,m=f>>8&255,S=c>>24&255,w=c>>16&255,T=c>>8&255,C=Hr(ei.relativeLuminance2(S,w,T),ei.relativeLuminance2(p,g,m));for(;C<h&&(S>0||w>0||T>0);)S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),T-=Math.max(0,Math.ceil(T*.1)),C=Hr(ei.relativeLuminance2(S,w,T),ei.relativeLuminance2(p,g,m));return(S<<24|w<<16|T<<8|255)>>>0}e.reduceLuminance=s;function a(f,c,h){let p=f>>24&255,g=f>>16&255,m=f>>8&255,S=c>>24&255,w=c>>16&255,T=c>>8&255,C=Hr(ei.relativeLuminance2(S,w,T),ei.relativeLuminance2(p,g,m));for(;C<h&&(S<255||w<255||T<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),C=Hr(ei.relativeLuminance2(S,w,T),ei.relativeLuminance2(p,g,m));return(S<<24|w<<16|T<<8|255)>>>0}e.increaseLuminance=a;function d(f){return[f>>24&255,f>>16&255,f>>8&255,f&255]}e.toChannels=d})(ca||={});function ea(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Hr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function bn(e){if(!e)throw new Error("value must not be falsy");return e}function f_(e){return 57508<=e&&e<=57558}function MM(e){return 57520<=e&&e<=57527}function NM(e){return 57344<=e&&e<=63743}function OM(e){return 9472<=e&&e<=9631}function DM(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 jM(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!DM(e)&&!f_(e)&&!NM(e)}function iC(e){return f_(e)||OM(e)}function IM(){return{css:{canvas:Vu(),cell:Vu()},device:{canvas:Vu(),cell:Vu(),char:{width:0,height:0,left:0,top:0}}}}function Vu(){return{width:0,height:0}}function BM(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var zn=0,En=0,_r=!1,$r=!1,Yu=!1,pi,Up=0,PM=class{constructor(e,t,i,s,a,d){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=a,this._themeService=d,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,En=0,zn=0,$r=!1,_r=!1,Yu=!1,pi=this._themeService.colors,Up=0,e.getCode()!==0&&e.extended.underlineStyle===4){let a=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Up=t*s%(Math.round(a)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",a=>{a.backgroundColorRGB&&(En=a.backgroundColorRGB.rgba>>8&16777215,$r=!0),a.foregroundColorRGB&&(zn=a.foregroundColorRGB.rgba>>8&16777215,_r=!0)}),Yu=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Yu){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:En=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:En=(this.result.fg&16777215)<<8|255;break;default:En=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:En=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:En=(this.result.bg&16777215)<<8|255;break}En=ca.blend(En,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else En=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if($r=!0,pi.selectionForeground&&(zn=pi.selectionForeground.rgba>>8&16777215,_r=!0),iC(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)zn=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:zn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:zn=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:zn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:zn=(this.result.fg&16777215)<<8|255;break;default:zn=this._themeService.colors.foreground.rgba}zn=ca.blend(zn,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}_r=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",a=>{a.backgroundColorRGB&&(En=a.backgroundColorRGB.rgba>>8&16777215,$r=!0),a.foregroundColorRGB&&(zn=a.foregroundColorRGB.rgba>>8&16777215,_r=!0)}),$r&&(Yu?En=e.bg&-16777216&-134217729|En|50331648:En=e.bg&-16777216|En|50331648),_r&&(zn=e.fg&-16777216&-67108865|zn|50331648),this.result.fg&67108864&&($r&&!_r&&((this.result.bg&50331648)===0?zn=this.result.fg&-134217728|pi.background.rgba>>8&16777215&16777215|50331648:zn=this.result.fg&-134217728|this.result.bg&67108863,_r=!0),!$r&&_r&&((this.result.fg&50331648)===0?En=this.result.bg&-67108864|pi.foreground.rgba>>8&16777215&16777215|50331648:En=this.result.bg&-67108864|this.result.fg&67108863,$r=!0)),pi=void 0,this.result.bg=$r?En:this.result.bg,this.result.fg=_r?zn:this.result.fg,this.result.ext&=536870911,this.result.ext|=Up<<29&3758096384}},zM=.5,rC=kM||TM?"bottom":"ideographic",HM={"▀":[{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}]},$M={"░":[[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]]},FM={"─":{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`}},_c={"":{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}};_c[""]=_c[""];_c[""]=_c[""];function UM(e,t,i,s,a,d,f,c){let h=HM[t];if(h)return WM(e,h,i,s,a,d),!0;let p=$M[t];if(p)return GM(e,p,i,s,a,d),!0;let g=FM[t];if(g)return qM(e,g,i,s,a,d,c),!0;let m=_c[t];return m?(KM(e,m,i,s,a,d,f,c),!0):!1}function WM(e,t,i,s,a,d){for(let f=0;f<t.length;f++){let c=t[f],h=a/8,p=d/8;e.fillRect(i+c.x*h,s+c.y*p,c.w*h,c.h*p)}}var h1=new Map;function GM(e,t,i,s,a,d){let f=h1.get(t);f||(f=new Map,h1.set(t,f));let c=e.fillStyle;if(typeof c!="string")throw new Error(`Unexpected fillStyle type "${c}"`);let h=f.get(c);if(!h){let p=t[0].length,g=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=p,m.height=g;let S=bn(m.getContext("2d")),w=new ImageData(p,g),T,C,_,b;if(c.startsWith("#"))T=parseInt(c.slice(1,3),16),C=parseInt(c.slice(3,5),16),_=parseInt(c.slice(5,7),16),b=c.length>7&&parseInt(c.slice(7,9),16)||1;else if(c.startsWith("rgba"))[T,C,_,b]=c.substring(5,c.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${c}" when drawing pattern glyph`);for(let v=0;v<g;v++)for(let y=0;y<p;y++)w.data[(v*p+y)*4]=T,w.data[(v*p+y)*4+1]=C,w.data[(v*p+y)*4+2]=_,w.data[(v*p+y)*4+3]=t[v][y]*(b*255);S.putImageData(w,0,0),h=bn(e.createPattern(m,null)),f.set(c,h)}e.fillStyle=h,e.fillRect(i,s,a,d)}function qM(e,t,i,s,a,d,f){e.strokeStyle=e.fillStyle;for(let[c,h]of Object.entries(t)){e.beginPath(),e.lineWidth=f*Number.parseInt(c);let p;if(typeof h=="function"){let g=.15/d*a;p=h(.15,g)}else p=h;for(let g of p.split(" ")){let m=g[0],S=sC[m];if(!S){console.error(`Could not find drawing instructions for "${m}"`);continue}let w=g.substring(1).split(",");!w[0]||!w[1]||S(e,aC(w,a,d,i,s,!0,f))}e.stroke(),e.closePath()}}function KM(e,t,i,s,a,d,f,c){let h=new Path2D;h.rect(i,s,a,d),e.clip(h),e.beginPath();let p=f/12;e.lineWidth=c*p;for(let g of t.d.split(" ")){let m=g[0],S=sC[m];if(!S){console.error(`Could not find drawing instructions for "${m}"`);continue}let w=g.substring(1).split(",");!w[0]||!w[1]||S(e,aC(w,a,d,i,s,!1,c,(t.leftPadding??0)*(p/2),(t.rightPadding??0)*(p/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function d1(e,t,i=0){return Math.max(Math.min(e,t),i)}var sC={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 aC(e,t,i,s,a,d,f,c=0,h=0){let p=e.map(g=>parseFloat(g)||parseInt(g));if(p.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<p.length;g+=2)p[g]*=t-c*f-h*f,d&&p[g]!==0&&(p[g]=d1(Math.round(p[g]+.5)-.5,t,0)),p[g]+=s+c*f;for(let g=1;g<p.length;g+=2)p[g]*=i,d&&p[g]!==0&&(p[g]=d1(Math.round(p[g]+.5)-.5,i,0)),p[g]+=a;return p}var f1=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},p1=class{constructor(){this._data=new f1}set(e,t,i,s,a){this._data.get(e,t)||this._data.set(e,t,new f1),this._data.get(e,t).set(i,s,a)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},oC=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,i=0,s=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),a=e.timeRemaining(),i*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},VM=class extends oC{_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())}}},YM=class extends oC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},XM=!d_&&"requestIdleCallback"in window?YM:VM,ho=class lC{constructor(){this.fg=0,this.bg=0,this.extended=new cC}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 lC;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}},cC=class uC{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}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 uC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ZM=globalThis.performance&&typeof globalThis.performance.now=="function",JM=class hC{static create(t){return new hC(t)}constructor(t){this._now=ZM&&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}},qr;(e=>{e.None=()=>cr.None;function t(q,B){return m(q,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function i(q){return(B,Y=null,G)=>{let P=!1,K;return K=q(V=>{if(!P)return K?K.dispose():P=!0,B.call(Y,V)},null,G),P&&K.dispose(),K}}e.once=i;function s(q,B,Y){return p((G,P=null,K)=>q(V=>G.call(P,B(V)),null,K),Y)}e.map=s;function a(q,B,Y){return p((G,P=null,K)=>q(V=>{B(V),G.call(P,V)},null,K),Y)}e.forEach=a;function d(q,B,Y){return p((G,P=null,K)=>q(V=>B(V)&&G.call(P,V),null,K),Y)}e.filter=d;function f(q){return q}e.signal=f;function c(...q){return(B,Y=null,G)=>{let P=Qw(...q.map(K=>K(V=>B.call(Y,V))));return g(P,G)}}e.any=c;function h(q,B,Y,G){let P=Y;return s(q,K=>(P=B(P,K),P),G)}e.reduce=h;function p(q,B){let Y,G={onWillAddFirstListener(){Y=q(P.fire,P)},onDidRemoveLastListener(){Y?.dispose()}},P=new Kt(G);return B?.add(P),P.event}function g(q,B){return B instanceof Array?B.push(q):B&&B.add(q),q}function m(q,B,Y=100,G=!1,P=!1,K,V){let O,z,j,W=0,Z,ne={leakWarningThreshold:K,onWillAddFirstListener(){O=q(he=>{W++,z=B(z,he),G&&!j&&(te.fire(z),z=void 0),Z=()=>{let J=z;z=void 0,j=void 0,(!G||W>1)&&te.fire(J),W=0},typeof Y=="number"?(clearTimeout(j),j=setTimeout(Z,Y)):j===void 0&&(j=0,queueMicrotask(Z))})},onWillRemoveListener(){P&&W>0&&Z?.()},onDidRemoveLastListener(){Z=void 0,O.dispose()}},te=new Kt(ne);return V?.add(te),te.event}e.debounce=m;function S(q,B=0,Y){return e.debounce(q,(G,P)=>G?(G.push(P),G):[P],B,void 0,!0,void 0,Y)}e.accumulate=S;function w(q,B=(G,P)=>G===P,Y){let G=!0,P;return d(q,K=>{let V=G||!B(K,P);return G=!1,P=K,V},Y)}e.latch=w;function T(q,B,Y){return[e.filter(q,B,Y),e.filter(q,G=>!B(G),Y)]}e.split=T;function C(q,B=!1,Y=[],G){let P=Y.slice(),K=q(z=>{P?P.push(z):O.fire(z)});G&&G.add(K);let V=()=>{P?.forEach(z=>O.fire(z)),P=null},O=new Kt({onWillAddFirstListener(){K||(K=q(z=>O.fire(z)),G&&G.add(K))},onDidAddFirstListener(){P&&(B?setTimeout(V):V())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return G&&G.add(O),O.event}e.buffer=C;function _(q,B){return(Y,G,P)=>{let K=B(new v);return q(function(V){let O=K.evaluate(V);O!==b&&Y.call(G,O)},void 0,P)}}e.chain=_;let b=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(Y=>(B(Y),Y)),this}filter(B){return this.steps.push(Y=>B(Y)?Y:b),this}reduce(B,Y){let G=Y;return this.steps.push(P=>(G=B(G,P),G)),this}latch(B=(Y,G)=>Y===G){let Y=!0,G;return this.steps.push(P=>{let K=Y||!B(P,G);return Y=!1,G=P,K?P:b}),this}evaluate(B){for(let Y of this.steps)if(B=Y(B),B===b)break;return B}}function y(q,B,Y=G=>G){let G=(...O)=>V.fire(Y(...O)),P=()=>q.on(B,G),K=()=>q.removeListener(B,G),V=new Kt({onWillAddFirstListener:P,onDidRemoveLastListener:K});return V.event}e.fromNodeEventEmitter=y;function k(q,B,Y=G=>G){let G=(...O)=>V.fire(Y(...O)),P=()=>q.addEventListener(B,G),K=()=>q.removeEventListener(B,G),V=new Kt({onWillAddFirstListener:P,onDidRemoveLastListener:K});return V.event}e.fromDOMEventEmitter=k;function M(q){return new Promise(B=>i(q)(B))}e.toPromise=M;function R(q){let B=new Kt;return q.then(Y=>{B.fire(Y)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=R;function N(q,B){return q(Y=>B.fire(Y))}e.forward=N;function A(q,B,Y){return B(Y),q(G=>B(G))}e.runAndSubscribe=A;class I{constructor(B,Y){this._observable=B,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new Kt(G),Y&&Y.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,Y){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function $(q,B){return new I(q,B).emitter.event}e.fromObservable=$;function H(q){return(B,Y,G)=>{let P=0,K=!1,V={beginUpdate(){P++},endUpdate(){P--,P===0&&(q.reportChanges(),K&&(K=!1,B.call(Y)))},handlePossibleChange(){},handleChange(){K=!0}};q.addObserver(V),q.reportChanges();let O={dispose(){q.removeObserver(V)}};return G instanceof bo?G.add(O):Array.isArray(G)&&G.push(O),O}}e.fromObservableLight=H})(qr||={});var Qm=class eg{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${eg._idPool++}`,eg.all.add(this)}start(t){this._stopWatch=new JM,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}}};Qm.all=new Set,Qm._idPool=0;var QM=Qm,e4=-1,dC=class fC{constructor(t,i,s=(fC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[d,f]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${f}):`;console.warn(c),console.warn(d);let h=new i4(c,d);this._errorHandler(h)}return()=>{let d=this._stacks.get(t.value)||0;this._stacks.set(t.value,d-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,a]of this._stacks)(!t||i<a)&&(t=[s,a],i=a);return t}};dC._idPool=1;var t4=dC,n4=class pC{constructor(t){this.value=t}static create(){let t=new Error;return new pC(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},i4=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},r4=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},s4=0,Wp=class{constructor(t){this.value=t,this.id=s4++}},a4=2,o4,Kt=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new t4(t?.onListenerError??Fp,this._options?.leakWarningThreshold??e4):void 0,this._perfMon=this._options?._profName?new QM(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,i,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let c=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(c);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new r4(`${c}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||Fp)(p),cr.None}if(this._disposed)return cr.None;i&&(t=t.bind(i));let a=new Wp(t),d;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=n4.create(),d=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Wp?(this._deliveryQueue??=new l4,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let f=Vn(()=>{d?.(),this._removeListener(a)});return s instanceof bo?s.add(f):Array.isArray(s)&&s.push(f),f},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 i=this._listeners,s=i.indexOf(t);if(s===-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--,i[s]=void 0;let a=this._deliveryQueue.current===this;if(this._size*a4<=i.length){let d=0;for(let f=0;f<i.length;f++)i[f]?i[d++]=i[f]:a&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=d}}_deliver(t,i){if(!t)return;let s=this._options?.onListenerError||Fp;if(!s){t.value(i);return}try{t.value(i)}catch(a){s(a)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[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 Wp)this._deliver(this._listeners,t);else{let i=this._deliveryQueue;i.enqueue(this,t,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},l4=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},m1={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}},Dl=2,jl,Cs=class ao{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new p1,this._cacheMapCombined=new p1,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new ho,this._textureSize=512,this._onAddTextureAtlasCanvas=new Kt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Kt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=mC(t,this._config.deviceCellWidth*4+Dl*2,this._config.deviceCellHeight+Dl*2),this._tmpCtx=bn(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 XM;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}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(ao.maxAtlasPages&&this._pages.length>=Math.max(4,ao.maxAtlasPages)){let i=this._pages.filter(p=>p.canvas.width*2<=(ao.maxTextureSize||4096)).sort((p,g)=>g.canvas.width!==p.canvas.width?g.canvas.width-p.canvas.width:g.percentageUsed-p.percentageUsed),s=-1,a=0;for(let p=0;p<i.length;p++)if(i[p].canvas.width!==a)s=p,a=i[p].canvas.width;else if(p-s===3)break;let d=i.slice(s,s+4),f=d.map(p=>p.glyphs[0].texturePage).sort((p,g)=>p>g?1:-1),c=this.pages.length-d.length,h=this._mergePages(d,c);h.version++;for(let p=f.length-1;p>=0;p--)this._deletePage(f[p]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let t=new Gp(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let s=t[0].canvas.width*2,a=new Gp(this._document,s,t);for(let[d,f]of t.entries()){let c=d*f.canvas.width%s,h=Math.floor(d/2)*f.canvas.height;a.ctx.drawImage(f.canvas,c,h);for(let g of f.glyphs)g.texturePage=i,g.sizeClipSpace.x=g.size.x/s,g.sizeClipSpace.y=g.size.y/s,g.texturePosition.x+=c,g.texturePosition.y+=h,g.texturePositionClipSpace.x=g.texturePosition.x/s,g.texturePositionClipSpace.y=g.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(f.canvas);let p=this._activePages.indexOf(f);p!==-1&&this._activePages.splice(p,1)}return a}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let s=this._pages[i];for(let a of s.glyphs)a.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,i,s,a,d,f){return this._getFromCacheMap(this._cacheMapCombined,t,i,s,a,d,f)}getRasterizedGlyph(t,i,s,a,d,f){return this._getFromCacheMap(this._cacheMap,t,i,s,a,d,f)}_getFromCacheMap(t,i,s,a,d,f,c){return jl=t.get(i,s,a,d),jl||(jl=this._drawToCache(i,s,a,d,f,c),t.set(i,s,a,d,jl)),jl}_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,i,s,a){if(this._config.allowTransparency)return Vi;let d;switch(t){case 16777216:case 33554432:d=this._getColorFromAnsiIndex(i);break;case 50331648:let f=ho.toColorRGB(i);d=ii.toColor(f[0],f[1],f[2]);break;default:s?d=Xl.opaque(this._config.colors.foreground):d=this._config.colors.background;break}return this._config.allowTransparency||(d=Xl.opaque(d)),d}_getForegroundColor(t,i,s,a,d,f,c,h,p,g){let m=this._getMinimumContrastColor(t,i,s,a,d,f,c,p,h,g);if(m)return m;let S;switch(d){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&p&&f<8&&(f+=8),S=this._getColorFromAnsiIndex(f);break;case 50331648:let w=ho.toColorRGB(f);S=ii.toColor(w[0],w[1],w[2]);break;default:c?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Xl.opaque(S)),h&&(S=Xl.multiplyOpacity(S,zM)),S}_resolveBackgroundRgba(t,i,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,s,a){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&a&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,s,a,d,f,c,h,p,g){if(this._config.minimumContrastRatio===1||g)return;let m=this._getContrastCache(p),S=m.getColor(t,a);if(S!==void 0)return S||void 0;let w=this._resolveBackgroundRgba(i,s,c),T=this._resolveForegroundRgba(d,f,c,h),C=ca.ensureContrastRatio(w,T,this._config.minimumContrastRatio/(p?2:1));if(!C){m.setColor(t,a,null);return}let _=ii.toColor(C>>24&255,C>>16&255,C>>8&255);return m.setColor(t,a,_),_}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,a,d,f){let c=typeof t=="number"?String.fromCharCode(t):t;f&&this._tmpCanvas.parentElement!==f&&(this._tmpCanvas.style.display="none",f.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+Dl*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let p=Math.min(this._config.deviceCellHeight+Dl*4,this._textureSize);if(this._tmpCanvas.height<p&&(this._tmpCanvas.height=p),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=a,!!this._workAttributeData.isInvisible())return m1;let g=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),_=!!this._workAttributeData.isOverline(),b=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(m){let z=b;b=y,y=z;let j=v;v=k,k=j}let M=this._getBackgroundColor(k,y,m,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let R=g?this._config.fontWeightBold:this._config.fontWeight,N=w?"italic":"";this._tmpCtx.font=`${N} ${R} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=rC;let A=c.length===1&&f_(c.charCodeAt(0)),I=c.length===1&&MM(c.charCodeAt(0)),$=this._getForegroundColor(i,k,y,s,v,b,m,S,g,iC(c.charCodeAt(0)));this._tmpCtx.fillStyle=$.css;let H=I?0:Dl*2,q=!1;this._config.customGlyphs!==!1&&(q=UM(this._tmpCtx,c,H,H,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!A,Y;if(typeof t=="number"?Y=this._unicodeService.wcwidth(t):Y=this._unicodeService.getStringCellWidth(t),T){this._tmpCtx.save();let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=z%2===1?.5:0;if(this._tmpCtx.lineWidth=z,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${ho.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let J=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&J<8&&(J+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(J).css}this._tmpCtx.beginPath();let W=H,Z=Math.ceil(H+this._config.deviceCharHeight)-j-(d?z*2:0),ne=Z+z,te=Z+z*2,he=this._workAttributeData.getUnderlineVariantOffset();for(let J=0;J<Y;J++){this._tmpCtx.save();let F=W+J*this._config.deviceCellWidth,ae=W+(J+1)*this._config.deviceCellWidth,fe=F+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(F,Z),this._tmpCtx.lineTo(ae,Z),this._tmpCtx.moveTo(F,te),this._tmpCtx.lineTo(ae,te);break;case 3:let Ce=z<=1?te:Math.ceil(H+this._config.deviceCharHeight-z/2)-j,pe=z<=1?Z:Math.ceil(H+this._config.deviceCharHeight+z/2)-j,xe=new Path2D;xe.rect(F,Z,this._config.deviceCellWidth,te-Z),this._tmpCtx.clip(xe),this._tmpCtx.moveTo(F-this._config.deviceCellWidth/2,ne),this._tmpCtx.bezierCurveTo(F-this._config.deviceCellWidth/2,pe,F,pe,F,ne),this._tmpCtx.bezierCurveTo(F,Ce,fe,Ce,fe,ne),this._tmpCtx.bezierCurveTo(fe,pe,ae,pe,ae,ne),this._tmpCtx.bezierCurveTo(ae,Ce,ae+this._config.deviceCellWidth/2,Ce,ae+this._config.deviceCellWidth/2,ne);break;case 4:let Le=he===0?0:he>=z?z*2-he:z-he;he>=z||Le===0?(this._tmpCtx.setLineDash([Math.round(z),Math.round(z)]),this._tmpCtx.moveTo(F+Le,Z),this._tmpCtx.lineTo(ae,Z)):(this._tmpCtx.setLineDash([Math.round(z),Math.round(z)]),this._tmpCtx.moveTo(F,Z),this._tmpCtx.lineTo(F+Le,Z),this._tmpCtx.moveTo(F+Le+z,Z),this._tmpCtx.lineTo(ae,Z)),he=BM(ae-F,z,he);break;case 5:let Pe=.6,Ue=.3,Ae=ae-F,ye=Math.floor(Pe*Ae),Oe=Math.floor(Ue*Ae),xt=Ae-ye-Oe;this._tmpCtx.setLineDash([ye,Oe,xt]),this._tmpCtx.moveTo(F,Z),this._tmpCtx.lineTo(ae,Z);break;default:this._tmpCtx.moveTo(F,Z),this._tmpCtx.lineTo(ae,Z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!q&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let J=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in J&&J.actualBoundingBoxDescent>0){this._tmpCtx.save();let F=new Path2D;F.rect(W,Z-Math.ceil(z/2),this._config.deviceCellWidth*Y,te-Z+Math.ceil(z/2)),this._tmpCtx.clip(F),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(c,H,H+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(_){let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=z%2===1?.5:0;this._tmpCtx.lineWidth=z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(H,H+j),this._tmpCtx.lineTo(H+this._config.deviceCharWidth*Y,H+j),this._tmpCtx.stroke()}if(q||this._tmpCtx.fillText(c,H,H+this._config.deviceCharHeight),c==="_"&&!this._config.allowTransparency){let z=qp(this._tmpCtx.getImageData(H,H,this._config.deviceCellWidth,this._config.deviceCellHeight),M,$,B);if(z)for(let j=1;j<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,H,H+this._config.deviceCharHeight-j),z=qp(this._tmpCtx.getImageData(H,H,this._config.deviceCellWidth,this._config.deviceCellHeight),M,$,B),!!z);j++);}if(C){let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),j=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(H,H+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.lineTo(H+this._config.deviceCharWidth*Y,H+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.stroke()}this._tmpCtx.restore();let G=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=c4(G):P=qp(G,M,$,B),P)return m1;let K=this._findGlyphBoundingBox(G,this._workBoundingBox,h,I,q,H),V,O;for(;;){if(this._activePages.length===0){let z=this._createNewPage();V=z,O=z.currentRow,O.height=K.size.y;break}V=this._activePages[this._activePages.length-1],O=V.currentRow;for(let z of this._activePages)K.size.y<=z.currentRow.height&&(V=z,O=z.currentRow);for(let z=this._activePages.length-1;z>=0;z--)for(let j of this._activePages[z].fixedRows)j.height<=O.height&&K.size.y<=j.height&&(V=this._activePages[z],O=j);if(K.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Gp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),V=this._overflowSizePage,O=this._overflowSizePage.currentRow,O.x+K.size.x>=V.canvas.width&&(O.x=0,O.y+=O.height,O.height=0);break}if(O.y+K.size.y>=V.canvas.height||O.height>K.size.y+2){let z=!1;if(V.currentRow.y+V.currentRow.height+K.size.y>=V.canvas.height){let j;for(let W of this._activePages)if(W.currentRow.y+W.currentRow.height+K.size.y<W.canvas.height){j=W;break}if(j)V=j;else if(ao.maxAtlasPages&&this._pages.length>=ao.maxAtlasPages&&O.y+K.size.y<=V.canvas.height&&O.height>=K.size.y&&O.x+K.size.x<=V.canvas.width)z=!0;else{let W=this._createNewPage();V=W,O=W.currentRow,O.height=K.size.y,z=!0}}z||(V.currentRow.height>0&&V.fixedRows.push(V.currentRow),O={x:0,y:V.currentRow.y+V.currentRow.height,height:K.size.y},V.fixedRows.push(O),V.currentRow={x:0,y:O.y+O.height,height:0})}if(O.x+K.size.x<=V.canvas.width)break;O===V.currentRow?(O.x=0,O.y+=O.height,O.height=0):V.fixedRows.splice(V.fixedRows.indexOf(O),1)}return K.texturePage=this._pages.indexOf(V),K.texturePosition.x=O.x,K.texturePosition.y=O.y,K.texturePositionClipSpace.x=O.x/V.canvas.width,K.texturePositionClipSpace.y=O.y/V.canvas.height,K.sizeClipSpace.x/=V.canvas.width,K.sizeClipSpace.y/=V.canvas.height,O.height=Math.max(O.height,K.size.y),O.x+=K.size.x,V.ctx.putImageData(G,K.texturePosition.x-this._workBoundingBox.left,K.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,K.size.x,K.size.y),V.addGlyph(K),V.version++,K}_findGlyphBoundingBox(t,i,s,a,d,f){i.top=0;let c=a?this._config.deviceCellHeight:this._tmpCanvas.height,h=a?this._config.deviceCellWidth:s,p=!1;for(let g=0;g<c;g++){for(let m=0;m<h;m++){let S=g*this._tmpCanvas.width*4+m*4+3;if(t.data[S]!==0){i.top=g,p=!0;break}}if(p)break}i.left=0,p=!1;for(let g=0;g<f+h;g++){for(let m=0;m<c;m++){let S=m*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.left=g,p=!0;break}}if(p)break}i.right=h,p=!1;for(let g=f+h-1;g>=f;g--){for(let m=0;m<c;m++){let S=m*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.right=g,p=!0;break}}if(p)break}i.bottom=c,p=!1;for(let g=c-1;g>=0;g--){for(let m=0;m<h;m++){let S=g*this._tmpCanvas.width*4+m*4+3;if(t.data[S]!==0){i.bottom=g,p=!0;break}}if(p)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+f+(a||d?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+f+(a||d?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Gp=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=mC(e,t,t),this.ctx=bn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.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 qp(e,t,i,s){let a=t.rgba>>>24,d=t.rgba>>>16&255,f=t.rgba>>>8&255,c=i.rgba>>>24,h=i.rgba>>>16&255,p=i.rgba>>>8&255,g=Math.floor((Math.abs(a-c)+Math.abs(d-h)+Math.abs(f-p))/12),m=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===a&&e.data[S+1]===d&&e.data[S+2]===f||s&&Math.abs(e.data[S]-a)+Math.abs(e.data[S+1]-d)+Math.abs(e.data[S+2]-f)<g?e.data[S+3]=0:m=!1;return m}function c4(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function mC(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function u4(e,t,i,s,a,d,f,c){let h={foreground:d.foreground,background:d.background,cursor:Vi,cursorAccent:Vi,selectionForeground:Vi,selectionBackgroundTransparent:Vi,selectionBackgroundOpaque:Vi,selectionInactiveBackgroundTransparent:Vi,selectionInactiveBackgroundOpaque:Vi,overviewRulerBorder:Vi,scrollbarSliderBackground:Vi,scrollbarSliderHoverBackground:Vi,scrollbarSliderActiveBackground:Vi,ansi:d.ansi.slice(),contrastCache:d.contrastCache,halfContrastCache:d.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:f,deviceMaxTextureSize:c,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:h}}function g1(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].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 h4(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Zi=[];function gC(e,t,i,s,a,d,f,c,h){let p=u4(s,a,d,f,t,i,c,h);for(let S=0;S<Zi.length;S++){let w=Zi[S],T=w.ownedBy.indexOf(e);if(T>=0){if(g1(w.config,p))return w.atlas;w.ownedBy.length===1?(w.atlas.dispose(),Zi.splice(S,1)):w.ownedBy.splice(T,1);break}}for(let S=0;S<Zi.length;S++){let w=Zi[S];if(g1(w.config,p))return w.ownedBy.push(e),w.atlas}let g=e._core,m={atlas:new Cs(document,p,g.unicodeService),config:p,ownedBy:[e]};return Zi.push(m),m.atlas}function _1(e){for(let t=0;t<Zi.length;t++){let i=Zi[t].ownedBy.indexOf(e);if(i!==-1){Zi[t].ownedBy.length===1?(Zi[t].atlas.dispose(),Zi.splice(t,1)):Zi[t].ownedBy.splice(i,1);break}}}var Xu=600,d4=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=Xu){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Xu-(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=Xu-(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})},Xu)},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 v1(e,t,i){let s=new t.ResizeObserver(a=>{let d=a.find(h=>h.target===e);if(!d)return;if(!("devicePixelContentBoxSize"in d)){s?.disconnect(),s=void 0;return}let f=d.devicePixelContentBoxSize[0].inlineSize,c=d.devicePixelContentBoxSize[0].blockSize;f>0&&c>0&&i(f,c)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Vn(()=>s?.disconnect())}function f4(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var b1=class _C extends ho{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new cC,this.combinedData=""}static fromCharData(t){let i=new _C;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?f4(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 i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},vC=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function bC(e,t,i){let s=bn(e.createProgram());if(e.attachShader(s,bn(y1(e,e.VERTEX_SHADER,t))),e.attachShader(s,bn(y1(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function y1(e,t,i){let s=bn(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function p4(e,t){let i=Math.min(e.length*2,t),s=new Float32Array(i);for(let a=0;a<e.length;a++)s[a]=e[a];return s}var m4=class{constructor(e){this.texture=e,this.version=-1}},g4=`#version 300 es
18
+ layout (location = 0) in vec2 a_unitquad;
19
+ layout (location = 1) in vec2 a_cellpos;
20
+ layout (location = 2) in vec2 a_offset;
21
+ layout (location = 3) in vec2 a_size;
22
+ layout (location = 4) in float a_texpage;
23
+ layout (location = 5) in vec2 a_texcoord;
24
+ layout (location = 6) in vec2 a_texsize;
25
+
26
+ uniform mat4 u_projection;
27
+ uniform vec2 u_resolution;
28
+
29
+ out vec2 v_texcoord;
30
+ flat out int v_texpage;
31
+
32
+ void main() {
33
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
34
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
35
+ v_texpage = int(a_texpage);
36
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
37
+ }`;function _4(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
38
+ precision lowp float;
39
+
40
+ in vec2 v_texcoord;
41
+ flat in int v_texpage;
42
+
43
+ uniform sampler2D u_texture[${e}];
44
+
45
+ out vec4 outColor;
46
+
47
+ void main() {
48
+ if (v_texpage == 0) {
49
+ outColor = texture(u_texture[0], v_texcoord);
50
+ } ${t}
51
+ }`}var Es=11,Qa=Es*Float32Array.BYTES_PER_ELEMENT,v4=2,on=0,qt,Kp=0,Il=0,b4=class extends cr{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let a=this._gl;Cs.maxAtlasPages===void 0&&(Cs.maxAtlasPages=Math.min(32,bn(a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS))),Cs.maxTextureSize=bn(a.getParameter(a.MAX_TEXTURE_SIZE))),this._program=bn(bC(a,g4,_4(Cs.maxAtlasPages))),this._register(Vn(()=>a.deleteProgram(this._program))),this._projectionLocation=bn(a.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=bn(a.getUniformLocation(this._program,"u_resolution")),this._textureLocation=bn(a.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=a.createVertexArray(),a.bindVertexArray(this._vertexArrayObject);let d=new Float32Array([0,0,1,0,0,1,1,1]),f=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(f))),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let c=new Uint8Array([0,1,2,3]),h=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(h))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,h),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this._attributesBuffer=bn(a.createBuffer()),this._register(Vn(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,2,a.FLOAT,!1,Qa,0),a.vertexAttribDivisor(2,1),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,a.FLOAT,!1,Qa,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(3,1),a.enableVertexAttribArray(4),a.vertexAttribPointer(4,1,a.FLOAT,!1,Qa,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(4,1),a.enableVertexAttribArray(5),a.vertexAttribPointer(5,2,a.FLOAT,!1,Qa,5*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(5,1),a.enableVertexAttribArray(6),a.vertexAttribPointer(6,2,a.FLOAT,!1,Qa,7*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(6,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,Qa,9*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.useProgram(this._program);let p=new Int32Array(Cs.maxAtlasPages);for(let g=0;g<Cs.maxAtlasPages;g++)p[g]=g;a.uniform1iv(this._textureLocation,p),a.uniformMatrix4fv(this._projectionLocation,!1,vC),this._atlasTextures=[];for(let g=0;g<Cs.maxAtlasPages;g++){let m=new m4(bn(a.createTexture()));this._register(Vn(()=>a.deleteTexture(m.texture))),a.activeTexture(a.TEXTURE0+g),a.bindTexture(a.TEXTURE_2D,m.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[g]=m}a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,s,a,d,f,c,h){this._updateCell(this._vertices.attributes,e,t,i,s,a,d,f,c,h)}_updateCell(e,t,i,s,a,d,f,c,h,p){if(on=(i*this._terminal.cols+t)*Es,s===0||s===void 0){e.fill(0,on,on+Es-1-v4);return}this._atlas&&(c&&c.length>1?qt=this._atlas.getRasterizedGlyphCombinedChar(c,a,d,f,!1,this._terminal.element):qt=this._atlas.getRasterizedGlyph(s,a,d,f,!1,this._terminal.element),Kp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),a!==p&&qt.offset.x>Kp?(Il=qt.offset.x-Kp,e[on]=-(qt.offset.x-Il)+this._dimensions.device.char.left,e[on+1]=-qt.offset.y+this._dimensions.device.char.top,e[on+2]=(qt.size.x-Il)/this._dimensions.device.canvas.width,e[on+3]=qt.size.y/this._dimensions.device.canvas.height,e[on+4]=qt.texturePage,e[on+5]=qt.texturePositionClipSpace.x+Il/this._atlas.pages[qt.texturePage].canvas.width,e[on+6]=qt.texturePositionClipSpace.y,e[on+7]=qt.sizeClipSpace.x-Il/this._atlas.pages[qt.texturePage].canvas.width,e[on+8]=qt.sizeClipSpace.y):(e[on]=-qt.offset.x+this._dimensions.device.char.left,e[on+1]=-qt.offset.y+this._dimensions.device.char.top,e[on+2]=qt.size.x/this._dimensions.device.canvas.width,e[on+3]=qt.size.y/this._dimensions.device.canvas.height,e[on+4]=qt.texturePage,e[on+5]=qt.texturePositionClipSpace.x,e[on+6]=qt.texturePositionClipSpace.y,e[on+7]=qt.sizeClipSpace.x,e[on+8]=qt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&jM(s,h,qt.size.x,this._dimensions.device.cell.width)&&(e[on+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*Es;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let s=0;s<e.rows;s++)for(let a=0;a<e.cols;a++)this._vertices.attributes[i+9]=a/e.cols,this._vertices.attributes[i+10]=s/e.rows,i+=Es}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let a=0;a<e.lineLengths.length;a++){let d=a*this._terminal.cols*Es,f=this._vertices.attributes.subarray(d,d+e.lineLengths[a]*Es);i.set(f,s),s+=f.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let a=0;a<this._atlas.pages.length;a++)this._atlas.pages[a].version!==this._atlasTextures[a].version&&this._bindAtlasPageTexture(t,this._atlas,a);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/Es)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},y4=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,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let a=e.buffers.active.ydisp,d=t[1]-a,f=i[1]-a,c=Math.max(d,0),h=Math.min(f,e.rows-1);if(c>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=d,this.viewportEndRow=f,this.viewportCappedStartRow=c,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function S4(){return new y4}var Hh=4,Sh=1,xh=2,Vp=3,x4=2147483648,w4=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=S4()}resize(e,t){let i=e*t*Hh;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},C4=`#version 300 es
52
+ layout (location = 0) in vec2 a_position;
53
+ layout (location = 1) in vec2 a_size;
54
+ layout (location = 2) in vec4 a_color;
55
+ layout (location = 3) in vec2 a_unitquad;
56
+
57
+ uniform mat4 u_projection;
58
+
59
+ out vec4 v_color;
60
+
61
+ void main() {
62
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
63
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
64
+ v_color = a_color;
65
+ }`,E4=`#version 300 es
66
+ precision lowp float;
67
+
68
+ in vec4 v_color;
69
+
70
+ out vec4 outColor;
71
+
72
+ void main() {
73
+ outColor = v_color;
74
+ }`,Wr=8,Yp=Wr*Float32Array.BYTES_PER_ELEMENT,k4=20*Wr,S1=class{constructor(){this.attributes=new Float32Array(k4),this.count=0}},Fr=0,x1=0,w1=0,C1=0,E1=0,k1=0,T1=0,T4=class extends cr{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new S1,this._verticesCursor=new S1;let a=this._gl;this._program=bn(bC(a,C4,E4)),this._register(Vn(()=>a.deleteProgram(this._program))),this._projectionLocation=bn(a.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=a.createVertexArray(),a.bindVertexArray(this._vertexArrayObject);let d=new Float32Array([0,0,1,0,0,1,1,1]),f=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(f))),a.bindBuffer(a.ARRAY_BUFFER,f),a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let c=new Uint8Array([0,1,2,3]),h=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(h))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,h),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this._attributesBuffer=bn(a.createBuffer()),this._register(Vn(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,a.FLOAT,!1,Yp,0),a.vertexAttribDivisor(0,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,Yp,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,4,a.FLOAT,!1,Yp,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(2,1),this._updateCachedColors(s.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,vC),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,i=this._vertices,s=1,a,d,f,c,h,p,g,m,S,w,T;for(a=0;a<t.rows;a++){for(f=-1,c=0,h=0,p=!1,d=0;d<t.cols;d++)g=(a*t.cols+d)*Hh,m=e.cells[g+Sh],S=e.cells[g+xh],w=!!(S&67108864),(m!==c||S!==h&&(p||w))&&((c!==0||p&&h!==0)&&(T=s++*Wr,this._updateRectangle(i,T,h,c,f,d,a)),f=d,c=m,h=S,p=w);(c!==0||p&&h!==0)&&(T=s++*Wr,this._updateRectangle(i,T,h,c,f,t.cols,a))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,a=0;(i.style==="bar"||i.style==="outline")&&(s=a++*Wr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=a++*Wr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=a++*Wr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=a++*Wr,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=a}_updateRectangle(e,t,i,s,a,d,f){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Fr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Fr=(i&16777215)<<8;break;default:Fr=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Fr=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Fr=(s&16777215)<<8;break;default:Fr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=p4(e.attributes,this._terminal.rows*this._terminal.cols*Wr)),x1=a*this._dimensions.device.cell.width,w1=f*this._dimensions.device.cell.height,C1=(Fr>>24&255)/255,E1=(Fr>>16&255)/255,k1=(Fr>>8&255)/255,T1=1,this._addRectangle(e.attributes,t,x1,w1,(d-a)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,C1,E1,k1,T1)}_addRectangle(e,t,i,s,a,d,f,c,h,p){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=a/this._dimensions.device.canvas.width,e[t+3]=d/this._dimensions.device.canvas.height,e[t+4]=f,e[t+5]=c,e[t+6]=h,e[t+7]=p}_addRectangleFloat(e,t,i,s,a,d,f){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=a/this._dimensions.device.canvas.width,e[t+3]=d/this._dimensions.device.canvas.height,e[t+4]=f[0],e[t+5]=f[1],e[t+6]=f[2],e[t+7]=f[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])}},A4=class extends cr{constructor(e,t,i,s,a,d,f,c){super(),this._container=t,this._alpha=a,this._coreBrowserService=d,this._optionsService=f,this._themeService=c,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=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(e,h),this.reset(e)})),this._register(Vn(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=bn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=gC(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+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(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=rC,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},R4=class extends A4{constructor(e,t,i,s,a,d,f){super(i,e,"link",t,!0,a,d,f),this._register(s.onShowLinkUnderline(c=>this._handleShowLinkUnderline(c))),this._register(s.onHideLinkUnderline(c=>this._handleHideLinkUnderline(c)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&h4(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},sa=typeof window=="object"?window:globalThis,tg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Kt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Kt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};tg.INSTANCE=new tg;var yC=tg;function L4(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}yC.INSTANCE.onDidChangeZoomLevel;yC.INSTANCE.onDidChangeFullscreen;var jo=typeof navigator=="object"?navigator.userAgent:"";jo.indexOf("Firefox")>=0;jo.indexOf("AppleWebKit")>=0;var M4=jo.indexOf("Chrome")>=0;!M4&&jo.indexOf("Safari")>=0;jo.indexOf("Electron/")>=0;jo.indexOf("Android")>=0;var Xp=!1;if(typeof sa.matchMedia=="function"){let e=sa.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=sa.matchMedia("(display-mode: fullscreen)");Xp=e.matches,L4(sa,e,({matches:i})=>{Xp&&t.matches||(Xp=i)})}var fo="en",Zp=!1,SC=!1,Zu,wh=fo,A1=fo,N4,Ur,ua=globalThis,Mi;typeof ua.vscode<"u"&&typeof ua.vscode.process<"u"?Mi=ua.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Mi=process);var O4=typeof Mi?.versions?.electron=="string",D4=O4&&Mi?.type==="renderer";if(typeof Mi=="object"){Mi.platform,Mi.platform,Zp=Mi.platform==="linux",Zp&&Mi.env.SNAP&&Mi.env.SNAP_REVISION,Mi.env.CI||Mi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zu=fo,wh=fo;let e=Mi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zu=t.userLocale,A1=t.osLocale,wh=t.resolvedLanguage||fo,N4=t.languagePack?.translationsConfigFile}catch{}SC=!0}else typeof navigator=="object"&&!D4?(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,Zp=Ur.indexOf("Linux")>=0,Ur?.indexOf("Mobi")>=0,wh=globalThis._VSCODE_NLS_LANGUAGE||fo,Zu=navigator.language.toLowerCase(),A1=Zu):console.error("Unable to resolve platform.");var R1=SC,yr=Ur,Ss=wh,j4;(e=>{function t(){return Ss}e.value=t;function i(){return Ss.length===2?Ss==="en":Ss.length>=3?Ss[0]==="e"&&Ss[1]==="n"&&Ss[2]==="-":!1}e.isDefaultVariant=i;function s(){return Ss==="en"}e.isDefault=s})(j4||={});var I4=typeof ua.postMessage=="function"&&!ua.importScripts;(()=>{if(I4){let e=[];ua.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let d=e[s];if(d.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),d.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),ua.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var B4=!!(yr&&yr.indexOf("Chrome")>=0);yr&&yr.indexOf("Firefox")>=0;!B4&&yr&&yr.indexOf("Safari")>=0;yr&&yr.indexOf("Edg/")>=0;yr&&yr.indexOf("Android")>=0;var eo=typeof navigator=="object"?navigator:{};R1||document.queryCommandSupported&&document.queryCommandSupported("copy")||eo&&eo.clipboard&&eo.clipboard.writeText,R1||eo&&eo.clipboard&&eo.clipboard.readText;var p_=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}},Jp=new p_,L1=new p_,M1=new p_;new Array(230);var P4;(e=>{function t(c){return Jp.keyCodeToStr(c)}e.toString=t;function i(c){return Jp.strToKeyCode(c)}e.fromString=i;function s(c){return L1.keyCodeToStr(c)}e.toUserSettingsUS=s;function a(c){return M1.keyCodeToStr(c)}e.toUserSettingsGeneral=a;function d(c){return L1.strToKeyCode(c)||M1.strToKeyCode(c)}e.fromUserSettings=d;function f(c){if(c>=98&&c<=113)return null;switch(c){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Jp.keyCodeToStr(c)}e.toElectronAccelerator=f})(P4||={});var xC=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),z4;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof H4?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:qr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xC})})(z4||={});var H4=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?xC:(this._emitter||(this._emitter=new Kt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},$4;(e=>{async function t(s){let a,d=await Promise.all(s.map(f=>f.then(c=>c,c=>{a||(a=c)})));if(typeof a<"u")throw a;return d}e.settled=t;function i(s){return new Promise(async(a,d)=>{try{await s(a,d)}catch(f){d(f)}})}e.withAsyncBody=i})($4||={});var N1=class Yi{static fromArray(t){return new Yi(i=>{i.emitMany(t)})}static fromPromise(t){return new Yi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Yi(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Yi(async i=>{await Promise.all(t.map(async s=>{for await(let a of s)i.emitOne(a)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Kt,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 qr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Yi(async s=>{for await(let a of t)s.emitOne(i(a))})}map(t){return Yi.map(this,t)}static filter(t,i){return new Yi(async s=>{for await(let a of t)i(a)&&s.emitOne(a)})}filter(t){return Yi.filter(this,t)}static coalesce(t){return Yi.filter(t,i=>!!i)}coalesce(){return Yi.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Yi.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())}};N1.EMPTY=N1.fromArray([]);var{getWindow:F4}=(function(){let e=new Map,t={window:sa,disposables:new bo};e.set(sa.vscodeWindowId,t);let i=new Kt,s=new Kt,a=new Kt;function d(f,c){return(typeof f=="number"?e.get(f):void 0)??(c?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(f){if(e.has(f.vscodeWindowId))return cr.None;let c=new bo,h={window:f,disposables:c.add(new bo)};return e.set(f.vscodeWindowId,h),c.add(Vn(()=>{e.delete(f.vscodeWindowId),s.fire(f)})),c.add(ng(f,W4.BEFORE_UNLOAD,()=>{a.fire(f)})),i.fire(h),c},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(f){return f.vscodeWindowId},hasWindow(f){return e.has(f)},getWindowById:d,getWindow(f){let c=f;if(c?.ownerDocument?.defaultView)return c.ownerDocument.defaultView.window;let h=f;return h?.view?h.view.window:sa},getDocument(f){return F4(f).document}}})(),U4=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!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 ng(e,t,i,s){return new U4(e,t,i,s)}var W4={BEFORE_UNLOAD:"beforeunload"},G4=class extends cr{constructor(e,t,i,s,a,d,f,c,h){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=a,this._decorationService=d,this._optionsService=f,this._themeService=c,this._cursorBlinkStateManager=new Ol,this._charAtlasDisposable=this._register(new Ol),this._observerDisposable=this._register(new Ol),this._model=new w4,this._workCell=new b1,this._workCell2=new b1,this._rectangleRenderer=this._register(new Ol),this._glyphRenderer=this._register(new Ol),this._onChangeTextureAtlas=this._register(new Kt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Kt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Kt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Kt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Kt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let p={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",p),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new PM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new R4(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,f,this._themeService)],this.dimensions=IM(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(f.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(ng(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(ng(this._canvas,"webglcontextrestored",g=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,_1(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=v1(this._canvas,this._coreBrowserService.window,(g,m)=>this._setCanvasDevicePixelDimensions(g,m)),this._register(this._coreBrowserService.onWindowChange(g=>{this._observerDisposable.value=v1(this._canvas,g,(m,S)=>this._setCanvasDevicePixelDimensions(m,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Vn(()=>{for(let g of this._renderLayers)g.dispose();this._canvas.parentElement?.removeChild(this._canvas),_1(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(e,t){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 e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new T4(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new b4(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 e=gC(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!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Qw(qr.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),qr.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){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,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),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 d4(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,a,d,f,c,h,p,g=0,m=!0,S,w,T,C,_,b,v,y,k;e=O1(e,i.rows-1,0),t=O1(t,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",R=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=R-i.buffer.ydisp,A=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,$=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let H=!1;for(d=e;d<=t;d++)for(f=d+i.buffer.ydisp,c=i.buffer.lines.get(f),this._model.lineLengths[d]=0,T=R===f,g=0,h=this._characterJoinerService.getJoinedCharacters(f),y=0;y<i.cols;y++){if(a=this._cellColorResolver.result.bg,c.loadCell(y,s),y===0&&(a=this._cellColorResolver.result.bg),p=!1,m=y>=g,S=y,h.length>0&&y===h[0][0]&&m){w=h.shift();let q=this._model.selection.isCellSelected(this._terminal,w[0],f);for(v=w[0]+1;v<w[1];v++)m&&=q===this._model.selection.isCellSelected(this._terminal,v,f);m&&=!T||A<w[0]||A>=w[1],m?(p=!0,s=new q4(s,c.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):g=w[1]}if(C=s.getChars(),_=s.getCode(),v=(d*i.cols+y)*Hh,this._cellColorResolver.resolve(s,y,f,this.dimensions.device.cell.width),$&&f===R&&(y===A&&(this._model.cursor={x:A,y:N,width:s.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=A+s.getWidth()-1),y>=A&&y<=I&&(this._coreBrowserService.isFocused&&M==="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)),_!==0&&(this._model.lineLengths[d]=y+1),!(this._model.cells[v]===_&&this._model.cells[v+Sh]===this._cellColorResolver.result.bg&&this._model.cells[v+xh]===this._cellColorResolver.result.fg&&this._model.cells[v+Vp]===this._cellColorResolver.result.ext)&&(H=!0,C.length>1&&(_|=x4),this._model.cells[v]=_,this._model.cells[v+Sh]=this._cellColorResolver.result.bg,this._model.cells[v+xh]=this._cellColorResolver.result.fg,this._model.cells[v+Vp]=this._cellColorResolver.result.ext,b=s.getWidth(),this._glyphRenderer.value.updateCell(y,d,_,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,C,b,a),p)){for(s=this._workCell,y++;y<=S;y++)k=(d*i.cols+y)*Hh,this._glyphRenderer.value.updateCell(y,d,0,0,0,0,RM,0,0),this._model.cells[k]=0,this._model.cells[k+Sh]=this._cellColorResolver.result.bg,this._model.cells[k+xh]=this._cellColorResolver.result.fg,this._model.cells[k+Vp]=this._cellColorResolver.result.ext;y--}}H&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},q4=class extends ho{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}};function O1(e,t,i=0){return Math.max(Math.min(e,t),i)}var D1="di$target",j1="di$dependencies",Qp=new Map;function xr(e){if(Qp.has(e))return Qp.get(e);let t=function(i,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");K4(t,i,a)};return t._id=e,Qp.set(e,t),t}function K4(e,t,i){t[D1]===t?t[j1].push({id:e,index:i}):(t[j1]=[{id:e,index:i}],t[D1]=t)}xr("BufferService");xr("CoreMouseService");xr("CoreService");xr("CharsetService");xr("InstantiationService");xr("LogService");var V4=xr("OptionsService");xr("OscLinkService");xr("UnicodeService");xr("DecorationService");var Y4={trace:0,debug:1,info:2,warn:3,error:4,off:5},X4="xterm.js: ",I1=class extends cr{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=Y4[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":X4)+t,...i)}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)}};I1=_M([vM(0,V4)],I1);var Z4=class extends cr{constructor(e){if(nC&&AM()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Kt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Kt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Kt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Kt),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,s=t.optionsService,a=t,d=a._renderService,f=a._characterJoinerService,c=a._charSizeService,h=a._coreBrowserService,p=a._decorationService;a._logService;let g=a._themeService;this._renderer=this._register(new G4(e,f,c,h,i,p,s,g,this._preserveDrawingBuffer)),this._register(qr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(qr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(qr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(qr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),d.setRenderer(this._renderer),this._register(Vn(()=>{if(this._terminal._core._store._isDisposed)return;let m=this._terminal._core._renderService;m.setRenderer(this._terminal._core._createRenderer()),m.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},em={exports:{}},B1;function J4(){return B1||(B1=1,(function(e,t){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,c,h){var p=this&&this.__decorate||function(v,y,k,M){var R,N=arguments.length,A=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(y,k,A):R(y,k))||A);return N>3&&A&&Object.defineProperty(y,k,A),A},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=h(9042),S=h(9924),w=h(844),T=h(4725),C=h(2585),_=h(3656);let b=c.AccessibilityManager=class extends w.Disposable{constructor(v,y,k,M){super(),this._terminal=v,this._coreBrowserService=k,this._renderService=M,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.TimeBasedDebouncer(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((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
75
+ `)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,_.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,w.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let y=0;y<v;y++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
76
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,y){this._liveRegionDebouncer.refresh(v,y,this._terminal.rows)}_renderRows(v,y){const k=this._terminal.buffer,M=k.lines.length.toString();for(let R=v;R<=y;R++){const N=k.lines.get(k.ydisp+R),A=[],I=N?.translateToString(!0,void 0,void 0,A)||"",$=(k.ydisp+R+1).toString(),H=this._rowElements[R];H&&(I.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=I,this._rowColumns.set(H,A)),H.setAttribute("aria-posinset",$),H.setAttribute("aria-setsize",M))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,y){const k=v.target,M=this._rowElements[y===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==M)return;let R,N;if(y===0?(R=k,N=this._rowElements.pop(),this._rowContainer.removeChild(N)):(R=this._rowElements.shift(),N=k,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),N.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:v.anchorNode,offset:v.anchorOffset},k={node:v.focusNode,offset:v.focusOffset};if((y.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===k.node&&y.offset>k.offset)&&([y,k]=[k,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const M=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(M)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:M,offset:M.textContent?.length??0}),!this._rowContainer.contains(k.node))return;const R=({node:I,offset:$})=>{const H=I instanceof Text?I.parentNode:I;let q=parseInt(H?.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const B=this._rowColumns.get(H);if(!B)return console.warn("columns is null. Race condition?"),null;let Y=$<B.length?B[$]:B.slice(-1)[0]+1;return Y>=this._terminal.cols&&(++q,Y=0),{row:q,column:Y}},N=R(y),A=R(k);if(N&&A){if(N.row>A.row||N.row===A.row&&N.column>=A.column)throw new Error("invalid range");this._terminal.select(N.column,N.row,(A.row-N.row)*this._terminal.cols-N.column+A.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=b=p([g(1,C.IInstantiationService),g(2,T.ICoreBrowserService),g(3,T.IRenderService)],b)},3614:(f,c)=>{function h(S){return S.replace(/\r?\n/g,"\r")}function p(S,w){return w?"\x1B[200~"+S+"\x1B[201~":S}function g(S,w,T,C){S=p(S=h(S),T.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(S,!0),w.value=""}function m(S,w,T){const C=T.getBoundingClientRect(),_=S.clientX-C.left-10,b=S.clientY-C.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${_}px`,w.style.top=`${b}px`,w.style.zIndex="1000",w.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=h,c.bracketTextForPaste=p,c.copyHandler=function(S,w){S.clipboardData&&S.clipboardData.setData("text/plain",w.selectionText),S.preventDefault()},c.handlePasteEvent=function(S,w,T,C){S.stopPropagation(),S.clipboardData&&g(S.clipboardData.getData("text/plain"),w,T,C)},c.paste=g,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(S,w,T,C,_){m(S,w,T),_&&C.rightClickSelect(S),w.value=C.selectionText,w.select()}},7239:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const p=h(1505);c.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(g,m,S){this._css.set(g,m,S)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,S){this._color.set(g,m,S)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(h,p,g,m){h.addEventListener(p,g,m);let S=!1;return{dispose:()=>{S||(S=!0,h.removeEventListener(p,g,m))}}}},3551:function(f,c,h){var p=this&&this.__decorate||function(b,v,y,k){var M,R=arguments.length,N=R<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,k);else for(var A=b.length-1;A>=0;A--)(M=b[A])&&(N=(R<3?M(N):R>3?M(v,y,N):M(v,y))||N);return R>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,k){v(y,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=h(3656),S=h(8460),w=h(844),T=h(2585),C=h(4725);let _=c.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(b,v,y,k,M){super(),this._element=b,this._mouseService=v,this._renderService=y,this._bufferService=k,this._linkProviderService=M,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const y=b.composedPath();for(let k=0;k<y.length;k++){const M=y[k];if(M.classList.contains("xterm"))break;if(M.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,v){this._activeProviderReplies&&v||(this._activeProviderReplies?.forEach((k=>{k?.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let y=!1;for(const[k,M]of this._linkProviderService.linkProviders.entries())v?this._activeProviderReplies?.get(k)&&(y=this._checkLinkProviderResult(k,b,y)):M.provideLinks(b.y,(R=>{if(this._isMouseOut)return;const N=R?.map((A=>({link:A})));this._activeProviderReplies?.set(k,N),y=this._checkLinkProviderResult(k,b,y),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,v){const y=new Set;for(let k=0;k<v.size;k++){const M=v.get(k);if(M)for(let R=0;R<M.length;R++){const N=M[R],A=N.link.range.start.y<b?0:N.link.range.start.x,I=N.link.range.end.y>b?this._bufferService.cols:N.link.range.end.x;for(let $=A;$<=I;$++){if(y.has($)){M.splice(R--,1);break}y.add($)}}}}_checkLinkProviderResult(b,v,y){if(!this._activeProviderReplies)return y;const k=this._activeProviderReplies.get(b);let M=!1;for(let R=0;R<b;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(M=!0);if(!M&&k){const R=k.find((N=>this._linkAtPosition(N.link,v)));R&&(y=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let R=0;R<this._activeProviderReplies.size;R++){const N=this._activeProviderReplies.get(R)?.find((A=>this._linkAtPosition(A.link,v)));if(N){y=!0,this._handleNewLink(N);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,v){this._currentLink&&this._lastMouseEvent&&(!b||!v||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(b.link,v)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:y=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:y=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const k=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,M=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=M&&(this._clearCurrentLink(k,M),this._lastMouseEvent)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(b,v,y){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(y,v.text)}_fireUnderlineEvent(b,v){const y=b.range,k=this._bufferService.buffer.ydisp,M=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-k-1,y.end.x,y.end.y-k-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(M)}_linkLeave(b,v,y){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(y,v.text)}_linkAtPosition(b,v){const y=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,M=v.y*this._bufferService.cols+v.x;return y<=M&&M<=k}_positionFromMouseEvent(b,v,y){const k=y.getCoords(b,v,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,v,y,k,M){return{x1:b,y1:v,x2:y,y2:k,cols:this._bufferService.cols,fg:M}}};c.Linkifier=_=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,T.IBufferService),g(4,C.ILinkProviderService)],_)},9042:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(f,c,h){var p=this&&this.__decorate||function(C,_,b,v){var y,k=arguments.length,M=k<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(C,_,b,v);else for(var R=C.length-1;R>=0;R--)(y=C[R])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},g=this&&this.__param||function(C,_){return function(b,v){_(b,v,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=h(511),S=h(2585);let w=c.OscLinkProvider=class{constructor(C,_,b){this._bufferService=C,this._optionsService=_,this._oscLinkService=b}provideLinks(C,_){const b=this._bufferService.buffer.lines.get(C-1);if(!b)return void _(void 0);const v=[],y=this._optionsService.rawOptions.linkHandler,k=new m.CellData,M=b.getTrimmedLength();let R=-1,N=-1,A=!1;for(let I=0;I<M;I++)if(N!==-1||b.hasContent(I)){if(b.loadCell(I,k),k.hasExtendedAttrs()&&k.extended.urlId){if(N===-1){N=I,R=k.extended.urlId;continue}A=k.extended.urlId!==R}else N!==-1&&(A=!0);if(A||N!==-1&&I===M-1){const $=this._oscLinkService.getLinkData(R)?.uri;if($){const H={start:{x:N+1,y:C},end:{x:I+(A||I!==M-1?0:1),y:C}};let q=!1;if(!y?.allowNonHttpProtocols)try{const B=new URL($);["http:","https:"].includes(B.protocol)||(q=!0)}catch{q=!0}q||v.push({text:$,range:H,activate:(B,Y)=>y?y.activate(B,Y,H):T(0,Y),hover:(B,Y)=>y?.hover?.(B,Y,H),leave:(B,Y)=>y?.leave?.(B,Y,H)})}A=!1,k.hasExtendedAttrs()&&k.extended.urlId?(N=I,R=k.extended.urlId):(N=-1,R=-1)}}_(v)}};function T(C,_){if(confirm(`Do you want to navigate to ${_}?
77
+
78
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=_}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=w=p([g(0,S.IBufferService),g(1,S.IOptionsService),g(2,S.IOscLinkService)],w)},6193:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(h,p){this._renderCallback=h,this._coreBrowserService=p,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,p,g){this._rowCount=g,h=h!==void 0?h:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p,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)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,p),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const p=h(3614),g=h(3656),m=h(3551),S=h(9042),w=h(3730),T=h(1680),C=h(3107),_=h(5744),b=h(2950),v=h(1296),y=h(428),k=h(4269),M=h(5114),R=h(8934),N=h(3230),A=h(9312),I=h(4725),$=h(6731),H=h(8055),q=h(8969),B=h(8460),Y=h(844),G=h(6114),P=h(8437),K=h(2584),V=h(7399),O=h(5941),z=h(9074),j=h(2585),W=h(5435),Z=h(4567),ne=h(779);class te extends q.CoreTerminal{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}constructor(J={}){super(J),this.browser=G,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(z.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,ae)=>this.refresh(F,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,Y.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(J){if(this._themeService)for(const F of J){let ae,fe="";switch(F.index){case 256:ae="foreground",fe="10";break;case 257:ae="background",fe="11";break;case 258:ae="cursor",fe="12";break;default:ae="ansi",fe="4;"+F.index}switch(F.type){case 0:const Ce=H.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${fe};${(0,O.toRgbString)(Ce)}${K.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((pe=>pe.ansi[F.index]=H.channels.toColor(...F.color)));else{const pe=ae;this._themeService.modifyColors((xe=>xe[pe]=H.channels.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(J){J?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(J){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.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(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const J=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(J);if(!F)return;const ae=Math.min(this.buffer.x,this.cols-1),fe=this._renderService.dimensions.css.cell.height,Ce=F.getWidth(ae),pe=this._renderService.dimensions.css.cell.width*Ce,xe=this.buffer.y*this._renderService.dimensions.css.cell.height,Le=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Le+"px",this.textarea.style.top=xe+"px",this.textarea.style.width=pe+"px",this.textarea.style.height=fe+"px",this.textarea.style.lineHeight=fe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,p.copyHandler)(F,this._selectionService)})));const J=F=>(0,p.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",J)),this.register((0,g.addDisposableDomListener)(this.element,"paste",J)),G.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,p.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,p.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),G.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,p.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(J=>this._keyUp(J)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(J=>this._keyDown(J)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(J=>this._keyPress(J)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(J=>this._compositionHelper.compositionupdate(J)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(J=>this._inputEvent(J)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(J){if(!J)throw new Error("Terminal requires a parent element.");if(J.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=J.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"),J.appendChild(this.element);const F=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),F.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),F.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),G.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(M.CoreBrowserService,this.textarea,J.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance($.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(F);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(T.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),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(Z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const J=this,F=this.element;function ae(pe){const xe=J._mouseService.getMouseReportCoords(pe,J.screenElement);if(!xe)return!1;let Le,Pe;switch(pe.overrideType||pe.type){case"mousemove":Pe=32,pe.buttons===void 0?(Le=3,pe.button!==void 0&&(Le=pe.button<3?pe.button:3)):Le=1&pe.buttons?0:4&pe.buttons?1:2&pe.buttons?2:3;break;case"mouseup":Pe=0,Le=pe.button<3?pe.button:3;break;case"mousedown":Pe=1,Le=pe.button<3?pe.button:3;break;case"wheel":if(J._customWheelEventHandler&&J._customWheelEventHandler(pe)===!1||J.viewport.getLinesScrolled(pe)===0)return!1;Pe=pe.deltaY<0?0:1,Le=4;break;default:return!1}return!(Pe===void 0||Le===void 0||Le>4)&&J.coreMouseService.triggerMouseEvent({col:xe.col,row:xe.row,x:xe.x,y:xe.y,button:Le,action:Pe,ctrl:pe.ctrlKey,alt:pe.altKey,shift:pe.shiftKey})}const fe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Ce={mouseup:pe=>(ae(pe),pe.buttons||(this._document.removeEventListener("mouseup",fe.mouseup),fe.mousedrag&&this._document.removeEventListener("mousemove",fe.mousedrag)),this.cancel(pe)),wheel:pe=>(ae(pe),this.cancel(pe,!0)),mousedrag:pe=>{pe.buttons&&ae(pe)},mousemove:pe=>{pe.buttons||ae(pe)}};this.register(this.coreMouseService.onProtocolChange((pe=>{pe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(pe)),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()),8&pe?fe.mousemove||(F.addEventListener("mousemove",Ce.mousemove),fe.mousemove=Ce.mousemove):(F.removeEventListener("mousemove",fe.mousemove),fe.mousemove=null),16&pe?fe.wheel||(F.addEventListener("wheel",Ce.wheel,{passive:!1}),fe.wheel=Ce.wheel):(F.removeEventListener("wheel",fe.wheel),fe.wheel=null),2&pe?fe.mouseup||(fe.mouseup=Ce.mouseup):(this._document.removeEventListener("mouseup",fe.mouseup),fe.mouseup=null),4&pe?fe.mousedrag||(fe.mousedrag=Ce.mousedrag):(this._document.removeEventListener("mousemove",fe.mousedrag),fe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(F,"mousedown",(pe=>{if(pe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(pe))return ae(pe),fe.mouseup&&this._document.addEventListener("mouseup",fe.mouseup),fe.mousedrag&&this._document.addEventListener("mousemove",fe.mousedrag),this.cancel(pe)}))),this.register((0,g.addDisposableDomListener)(F,"wheel",(pe=>{if(!fe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(pe)===!1)return!1;if(!this.buffer.hasScrollback){const xe=this.viewport.getLinesScrolled(pe);if(xe===0)return;const Le=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(pe.deltaY<0?"A":"B");let Pe="";for(let Ue=0;Ue<Math.abs(xe);Ue++)Pe+=Le;return this.coreService.triggerDataEvent(Pe,!0),this.cancel(pe,!0)}return this.viewport.handleWheel(pe)?this.cancel(pe):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(F,"touchstart",(pe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(pe),this.cancel(pe)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(F,"touchmove",(pe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(pe)?void 0:this.cancel(pe)}),{passive:!1}))}refresh(J,F){this._renderService?.refreshRows(J,F)}updateCursorStyle(J){this._selectionService?.shouldColumnSelect(J)?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(J,F,ae=0){ae===1?(super.scrollLines(J,F,ae),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(J)}paste(J){(0,p.paste)(J,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(J){this._customKeyEventHandler=J}attachCustomWheelEventHandler(J){this._customWheelEventHandler=J}registerLinkProvider(J){return this._linkProviderService.registerLinkProvider(J)}registerCharacterJoiner(J){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(J);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(J){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(J)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(J){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+J)}registerDecoration(J){return this._decorationService.registerDecoration(J)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(J,F,ae){this._selectionService.setSelection(J,F,ae)}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(J,F){this._selectionService?.selectLines(J,F)}_keyDown(J){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&J.altKey;if(!F&&!this._compositionHelper.keydown(J))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||J.key!=="Dead"&&J.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,V.evaluateKeyboardEvent)(J,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(J),ae.type===3||ae.type===2){const fe=this.rows-1;return this.scrollLines(ae.type===2?-fe:fe),this.cancel(J,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,J)||(ae.cancel&&this.cancel(J,!0),!ae.key||!!(J.key&&!J.ctrlKey&&!J.altKey&&!J.metaKey&&J.key.length===1&&J.key.charCodeAt(0)>=65&&J.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==K.C0.ETX&&ae.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:J}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||J.altKey||J.ctrlKey?this.cancel(J,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(J,F){const ae=J.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||J.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||J.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?ae:ae&&(!F.keyCode||F.keyCode>47)}_keyUp(J){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(J)||this.focus(),this.updateCursorStyle(J),this._keyPressHandled=!1)}_keyPress(J){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(J)===!1)return!1;if(this.cancel(J),J.charCode)F=J.charCode;else if(J.which===null||J.which===void 0)F=J.keyCode;else{if(J.which===0||J.charCode===0)return!1;F=J.which}return!(!F||(J.altKey||J.ctrlKey||J.metaKey)&&!this._isThirdLevelShift(this.browser,J)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:J}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(J){if(J.data&&J.inputType==="insertText"&&(!J.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=J.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(J),!0}return!1}resize(J,F){J!==this.cols||F!==this.rows?super.resize(J,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(J,F){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}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 J=1;J<this.rows;J++)this.buffer.lines.push(this.buffer.getBlankLine(P.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const J=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=J,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(J){if(this._renderService)switch(J){case W.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${ae};${F}t`);break;case W.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const fe=this._renderService.dimensions.css.cell.width.toFixed(0),Ce=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${Ce};${fe}t`)}}cancel(J,F){if(this.options.cancelEvents||F)return J.preventDefault(),J.stopPropagation(),!1}}c.Terminal=te},9924:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(h,p=1e3){this._renderCallback=h,this._debounceThresholdMS=p,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,p,g){this._rowCount=g,h=h!==void 0?h:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=m-this._lastRefreshMs,w=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,p)}}},1680:function(f,c,h){var p=this&&this.__decorate||function(b,v,y,k){var M,R=arguments.length,N=R<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,k);else for(var A=b.length-1;A>=0;A--)(M=b[A])&&(N=(R<3?M(N):R>3?M(v,y,N):M(v,y))||N);return R>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,k){v(y,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=h(3656),S=h(4725),w=h(8460),T=h(844),C=h(2585);let _=c.Viewport=class extends T.Disposable{constructor(b,v,y,k,M,R,N,A){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=y,this._optionsService=k,this._charSizeService=M,this._renderService=R,this._coreBrowserService=N,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,v){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&y<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){let y,k="";const M=[],R=v??this._bufferService.buffer.lines.length,N=this._bufferService.buffer.lines;for(let A=b;A<R;A++){const I=N.get(A);if(!I)continue;const $=N.get(A+1)?.isWrapped;if(k+=I.translateToString(!$),!$||A===N.length-1){const H=document.createElement("div");H.textContent=k,M.push(H),k.length>0&&(y=H),k=""}}return{bufferElements:M,cursorElement:y}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&v.altKey||y==="ctrl"&&v.ctrlKey||y==="shift"&&v.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};c.Viewport=_=p([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,S.ICharSizeService),g(5,S.IRenderService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],_)},3107:function(f,c,h){var p=this&&this.__decorate||function(C,_,b,v){var y,k=arguments.length,M=k<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(C,_,b,v);else for(var R=C.length-1;R>=0;R--)(y=C[R])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},g=this&&this.__param||function(C,_){return function(b,v){_(b,v,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=h(4725),S=h(844),w=h(2585);let T=c.BufferDecorationRenderer=class extends S.Disposable{constructor(C,_,b,v,y){super(),this._screenElement=C,this._bufferService=_,this._coreBrowserService=b,this._decorationService=v,this._renderService=y,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((k=>this._removeDecoration(k)))),this.register((0,S.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){const _=this._coreBrowserService.mainDocument.createElement("div");_.classList.add("xterm-decoration"),_.classList.toggle("xterm-decoration-top-layer",C?.options?.layer==="top"),_.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,_.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",_.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",_.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=C.options.x??0;return b&&b>this._bufferService.cols&&(_.style.display="none"),this._refreshXPosition(C,_),_}_refreshStyle(C){const _=C.marker.line-this._bufferService.buffers.active.ydisp;if(_<0||_>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let b=this._decorationElements.get(C);b||(b=this._createElement(C),C.element=b,this._decorationElements.set(C,b),this._container.appendChild(b),C.onDispose((()=>{this._decorationElements.delete(C),b.remove()}))),b.style.top=_*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(b)}}_refreshXPosition(C,_=C.element){if(!_)return;const b=C.options.x??0;(C.options.anchor||"left")==="right"?_.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":_.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){this._decorationElements.get(C)?.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=T=p([g(1,w.IBufferService),g(2,m.ICoreBrowserService),g(3,w.IDecorationService),g(4,m.IRenderService)],T)},5871:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.ColorZoneStore=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(h){if(h.options.overviewRulerOptions){for(const p of this._zones)if(p.color===h.options.overviewRulerOptions.color&&p.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(p,h.marker.line))return;if(this._lineAdjacentToZone(p,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(p,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,p){return p>=h.startBufferLine&&p<=h.endBufferLine}_lineAdjacentToZone(h,p,g){return p>=h.startBufferLine-this._linePadding[g||"full"]&&p<=h.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(h,p){h.startBufferLine=Math.min(h.startBufferLine,p),h.endBufferLine=Math.max(h.endBufferLine,p)}}},5744:function(f,c,h){var p=this&&this.__decorate||function(y,k,M,R){var N,A=arguments.length,I=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,M):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(y,k,M,R);else for(var $=y.length-1;$>=0;$--)(N=y[$])&&(I=(A<3?N(I):A>3?N(k,M,I):N(k,M))||I);return A>3&&I&&Object.defineProperty(k,M,I),I},g=this&&this.__param||function(y,k){return function(M,R){k(M,R,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const m=h(5871),S=h(4725),w=h(844),T=h(2585),C={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let v=c.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,k,M,R,N,A,I){super(),this._viewportElement=y,this._screenElement=k,this._bufferService=M,this._decorationService=R,this._renderService=N,this._optionsService=A,this._coreBrowserService=I,this._colorZoneStore=new m.ColorZoneStore,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);const $=this._canvas.getContext("2d");if(!$)throw new Error("Ctx cannot be null");this._ctx=$,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const y=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);_.full=this._canvas.width,_.left=y,_.center=k,_.right=y,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=_.left,b.right=_.left+_.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const k of y)k.position!=="full"&&this._renderColorZone(k);for(const k of y)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(b[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),_[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,k){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=v=p([g(2,T.IBufferService),g(3,T.IDecorationService),g(4,S.IRenderService),g(5,T.IOptionsService),g(6,S.ICoreBrowserService)],v)},2950:function(f,c,h){var p=this&&this.__decorate||function(C,_,b,v){var y,k=arguments.length,M=k<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(C,_,b,v);else for(var R=C.length-1;R>=0;R--)(y=C[R])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},g=this&&this.__param||function(C,_){return function(b,v){_(b,v,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=h(4725),S=h(2585),w=h(2584);let T=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,_,b,v,y,k){this._textarea=C,this._compositionView=_,this._bufferService=b,this._optionsService=v,this._coreService=y,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const _={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,_.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(_.start,_.end):this._textarea.value.substring(_.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const _=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(_,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const _=this._textarea.value,b=_.replace(C,"");this._dataAlreadySent=b,_.length>C.length?this._coreService.triggerDataEvent(b,!0):_.length<C.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):_.length===C.length&&_!==C&&this._coreService.triggerDataEvent(_,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const _=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,y=_*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=y+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=y+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=T=p([g(2,S.IBufferService),g(3,S.IOptionsService),g(4,S.ICoreService),g(5,m.IRenderService)],T)},9806:(f,c)=>{function h(p,g,m){const S=m.getBoundingClientRect(),w=p.getComputedStyle(m),T=parseInt(w.getPropertyValue("padding-left")),C=parseInt(w.getPropertyValue("padding-top"));return[g.clientX-S.left-T,g.clientY-S.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(p,g,m,S,w,T,C,_,b){if(!T)return;const v=h(p,g,m);return v?(v[0]=Math.ceil((v[0]+(b?C/2:0))/C),v[1]=Math.ceil(v[1]/_),v[0]=Math.min(Math.max(v[0],1),S+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),w),v):void 0}},9504:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const p=h(2584);function g(_,b,v,y){const k=_-m(_,v),M=b-m(b,v),R=Math.abs(k-M)-(function(N,A,I){let $=0;const H=N-m(N,I),q=A-m(A,I);for(let B=0;B<Math.abs(H-q);B++){const Y=S(N,A)==="A"?-1:1;I.buffer.lines.get(H+Y*B)?.isWrapped&&$++}return $})(_,b,v);return C(R,T(S(_,b),y))}function m(_,b){let v=0,y=b.buffer.lines.get(_),k=y?.isWrapped;for(;k&&_>=0&&_<b.rows;)v++,y=b.buffer.lines.get(--_),k=y?.isWrapped;return v}function S(_,b){return _>b?"A":"B"}function w(_,b,v,y,k,M){let R=_,N=b,A="";for(;R!==v||N!==y;)R+=k?1:-1,k&&R>M.cols-1?(A+=M.buffer.translateBufferLineToString(N,!1,_,R),R=0,_=0,N++):!k&&R<0&&(A+=M.buffer.translateBufferLineToString(N,!1,0,_+1),R=M.cols-1,_=R,N--);return A+M.buffer.translateBufferLineToString(N,!1,_,R)}function T(_,b){const v=b?"O":"[";return p.C0.ESC+v+_}function C(_,b){_=Math.floor(_);let v="";for(let y=0;y<_;y++)v+=b;return v}c.moveToCellSequence=function(_,b,v,y){const k=v.buffer.x,M=v.buffer.y;if(!v.buffer.hasScrollback)return(function(A,I,$,H,q,B){return g(I,H,q,B).length===0?"":C(w(A,I,A,I-m(I,q),!1,q).length,T("D",B))})(k,M,0,b,v,y)+g(M,b,v,y)+(function(A,I,$,H,q,B){let Y;Y=g(I,H,q,B).length>0?H-m(H,q):I;const G=H,P=(function(K,V,O,z,j,W){let Z;return Z=g(O,z,j,W).length>0?z-m(z,j):V,K<O&&Z<=z||K>=O&&Z<z?"C":"D"})(A,I,$,H,q,B);return C(w(A,Y,$,G,P==="C",q).length,T(P,B))})(k,M,_,b,v,y);let R;if(M===b)return R=k>_?"D":"C",C(Math.abs(k-_),T(R,y));R=M>b?"D":"C";const N=Math.abs(M-b);return C((function(A,I){return I.cols-A})(M>b?_:k,v)+(N-1)*v.cols+1+((M>b?k:_)-1),T(R,y))}},1296:function(f,c,h){var p=this&&this.__decorate||function(B,Y,G,P){var K,V=arguments.length,O=V<3?Y:P===null?P=Object.getOwnPropertyDescriptor(Y,G):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(B,Y,G,P);else for(var z=B.length-1;z>=0;z--)(K=B[z])&&(O=(V<3?K(O):V>3?K(Y,G,O):K(Y,G))||O);return V>3&&O&&Object.defineProperty(Y,G,O),O},g=this&&this.__param||function(B,Y){return function(G,P){Y(G,P,B)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const m=h(3787),S=h(2550),w=h(2223),T=h(6171),C=h(6052),_=h(4725),b=h(8055),v=h(8460),y=h(844),k=h(2585),M="xterm-dom-renderer-owner-",R="xterm-rows",N="xterm-fg-",A="xterm-bg-",I="xterm-focus",$="xterm-selection";let H=1,q=c.DomRenderer=class extends y.Disposable{constructor(B,Y,G,P,K,V,O,z,j,W,Z,ne,te){super(),this._terminal=B,this._document=Y,this._element=G,this._screenElement=P,this._viewportElement=K,this._helperContainer=V,this._linkifier2=O,this._charSizeService=j,this._optionsService=W,this._bufferService=Z,this._coreBrowserService=ne,this._themeService=te,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),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($),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,T.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((he=>this._injectCss(he)))),this._injectCss(this._themeService.colors),this._rowFactory=z.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(M+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((he=>this._handleLinkHover(he)))),this.register(this._linkifier2.onHideLinkUnderline((he=>this._handleLinkLeave(he)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(M+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(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(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),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/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),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(const G of this._rowElements)G.style.width=`${this.dimensions.css.canvas.width}px`,G.style.height=`${this.dimensions.css.cell.height}px`,G.style.lineHeight=`${this.dimensions.css.cell.height}px`,G.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${R} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${R} .xterm-dim { color: ${b.color.multiplyOpacity(B.foreground,.5).css};}`,Y+=`${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;}`;const G=`blink_underline_${this._terminalClass}`,P=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${G} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${P} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${K} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,Y+=`${this._terminalSelector} .${R}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${R}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${R}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${$} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${$} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${$} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[V,O]of B.ansi.entries())Y+=`${this._terminalSelector} .${N}${V} { color: ${O.css}; }${this._terminalSelector} .${N}${V}.xterm-dim { color: ${b.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${A}${V} { background-color: ${O.css}; }`;Y+=`${this._terminalSelector} .${N}${w.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(B.background).css}; }${this._terminalSelector} .${N}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${A}${w.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,Y){for(let G=this._rowElements.length;G<=Y;G++){const P=this._document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,Y){this._refreshRowElements(B,Y),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,Y,G){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,Y,G),this.renderRows(0,this._bufferService.rows-1),!B||!Y)return;this._selectionRenderModel.update(this._terminal,B,Y,G);const P=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||O<0)return;const z=this._document.createDocumentFragment();if(G){const j=B[0]>Y[0];z.appendChild(this._createSelectionElement(V,j?Y[0]:B[0],j?B[0]:Y[0],O-V+1))}else{const j=P===V?B[0]:0,W=V===K?Y[0]:this._bufferService.cols;z.appendChild(this._createSelectionElement(V,j,W));const Z=O-V-1;if(z.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,Z)),V!==O){const ne=K===O?Y[0]:this._bufferService.cols;z.appendChild(this._createSelectionElement(O,0,ne))}}this._selectionContainer.appendChild(z)}_createSelectionElement(B,Y,G,P=1){const K=this._document.createElement("div"),V=Y*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(G-Y);return V+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-V),K.style.height=P*this.dimensions.css.cell.height+"px",K.style.top=B*this.dimensions.css.cell.height+"px",K.style.left=`${V}px`,K.style.width=`${O}px`,K}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(const B of this._rowElements)B.replaceChildren()}renderRows(B,Y){const G=this._bufferService.buffer,P=G.ybase+G.y,K=Math.min(G.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,z=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=B;j<=Y;j++){const W=j+G.ydisp,Z=this._rowElements[j],ne=G.lines.get(W);if(!Z||!ne)break;Z.replaceChildren(...this._rowFactory.createRow(ne,W,W===P,O,z,K,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${M}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,Y,G,P,K,V){G<0&&(B=0),P<0&&(Y=0);const O=this._bufferService.rows-1;G=Math.max(Math.min(G,O),0),P=Math.max(Math.min(P,O),0),K=Math.min(K,this._bufferService.cols);const z=this._bufferService.buffer,j=z.ybase+z.y,W=Math.min(z.x,K-1),Z=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,te=this._optionsService.rawOptions.cursorInactiveStyle;for(let he=G;he<=P;++he){const J=he+z.ydisp,F=this._rowElements[he],ae=z.lines.get(J);if(!F||!ae)break;F.replaceChildren(...this._rowFactory.createRow(ae,J,J===j,ne,te,W,Z,this.dimensions.css.cell.width,this._widthCache,V?he===G?B:0:-1,V?(he===P?Y:K)-1:-1))}}};c.DomRenderer=q=p([g(7,k.IInstantiationService),g(8,_.ICharSizeService),g(9,k.IOptionsService),g(10,k.IBufferService),g(11,_.ICoreBrowserService),g(12,_.IThemeService)],q)},3787:function(f,c,h){var p=this&&this.__decorate||function(R,N,A,I){var $,H=arguments.length,q=H<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,A):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(R,N,A,I);else for(var B=R.length-1;B>=0;B--)($=R[B])&&(q=(H<3?$(q):H>3?$(N,A,q):$(N,A))||q);return H>3&&q&&Object.defineProperty(N,A,q),q},g=this&&this.__param||function(R,N){return function(A,I){N(A,I,R)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const m=h(2223),S=h(643),w=h(511),T=h(2585),C=h(8055),_=h(4725),b=h(4269),v=h(6171),y=h(3734);let k=c.DomRendererRowFactory=class{constructor(R,N,A,I,$,H,q){this._document=R,this._characterJoinerService=N,this._optionsService=A,this._coreBrowserService=I,this._coreService=$,this._decorationService=H,this._themeService=q,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,N,A){this._selectionStart=R,this._selectionEnd=N,this._columnSelectMode=A}createRow(R,N,A,I,$,H,q,B,Y,G,P){const K=[],V=this._characterJoinerService.getJoinedCharacters(N),O=this._themeService.colors;let z,j=R.getNoBgTrimmedLength();A&&j<H+1&&(j=H+1);let W=0,Z="",ne=0,te=0,he=0,J=!1,F=0,ae=!1,fe=0;const Ce=[],pe=G!==-1&&P!==-1;for(let xe=0;xe<j;xe++){R.loadCell(xe,this._workCell);let Le=this._workCell.getWidth();if(Le===0)continue;let Pe=!1,Ue=xe,Ae=this._workCell;if(V.length>0&&xe===V[0][0]){Pe=!0;const ft=V.shift();Ae=new b.JoinedCellData(this._workCell,R.translateToString(!0,ft[0],ft[1]),ft[1]-ft[0]),Ue=ft[1]-1,Le=Ae.getWidth()}const ye=this._isCellInSelection(xe,N),Oe=A&&xe===H,xt=pe&&xe>=G&&xe<=P;let Wn=!1;this._decorationService.forEachDecorationAtCell(xe,N,void 0,(ft=>{Wn=!0}));let Gn=Ae.getChars()||S.WHITESPACE_CELL_CHAR;if(Gn===" "&&(Ae.isUnderline()||Ae.isOverline())&&(Gn=" "),fe=Le*B-Y.get(Gn,Ae.isBold(),Ae.isItalic()),z){if(W&&(ye&&ae||!ye&&!ae&&Ae.bg===ne)&&(ye&&ae&&O.selectionForeground||Ae.fg===te)&&Ae.extended.ext===he&&xt===J&&fe===F&&!Oe&&!Pe&&!Wn){Ae.isInvisible()?Z+=S.WHITESPACE_CELL_CHAR:Z+=Gn,W++;continue}W&&(z.textContent=Z),z=this._document.createElement("span"),W=0,Z=""}else z=this._document.createElement("span");if(ne=Ae.bg,te=Ae.fg,he=Ae.extended.ext,J=xt,F=fe,ae=ye,Pe&&H>=xe&&H<=Ue&&(H=xe),!this._coreService.isCursorHidden&&Oe&&this._coreService.isCursorInitialized){if(Ce.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&Ce.push("xterm-cursor-blink"),Ce.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if($)switch($){case"outline":Ce.push("xterm-cursor-outline");break;case"block":Ce.push("xterm-cursor-block");break;case"bar":Ce.push("xterm-cursor-bar");break;case"underline":Ce.push("xterm-cursor-underline")}}if(Ae.isBold()&&Ce.push("xterm-bold"),Ae.isItalic()&&Ce.push("xterm-italic"),Ae.isDim()&&Ce.push("xterm-dim"),Z=Ae.isInvisible()?S.WHITESPACE_CELL_CHAR:Ae.getChars()||S.WHITESPACE_CELL_CHAR,Ae.isUnderline()&&(Ce.push(`xterm-underline-${Ae.extended.underlineStyle}`),Z===" "&&(Z=" "),!Ae.isUnderlineColorDefault()))if(Ae.isUnderlineColorRGB())z.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(Ae.getUnderlineColor()).join(",")})`;else{let ft=Ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ae.isBold()&&ft<8&&(ft+=8),z.style.textDecorationColor=O.ansi[ft].css}Ae.isOverline()&&(Ce.push("xterm-overline"),Z===" "&&(Z=" ")),Ae.isStrikethrough()&&Ce.push("xterm-strikethrough"),xt&&(z.style.textDecoration="underline");let en=Ae.getFgColor(),pt=Ae.getFgColorMode(),tn=Ae.getBgColor(),zt=Ae.getBgColorMode();const Ut=!!Ae.isInverse();if(Ut){const ft=en;en=tn,tn=ft;const wn=pt;pt=zt,zt=wn}let wt,Ln,xn,fn=!1;switch(this._decorationService.forEachDecorationAtCell(xe,N,void 0,(ft=>{ft.options.layer!=="top"&&fn||(ft.backgroundColorRGB&&(zt=50331648,tn=ft.backgroundColorRGB.rgba>>8&16777215,wt=ft.backgroundColorRGB),ft.foregroundColorRGB&&(pt=50331648,en=ft.foregroundColorRGB.rgba>>8&16777215,Ln=ft.foregroundColorRGB),fn=ft.options.layer==="top")})),!fn&&ye&&(wt=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,tn=wt.rgba>>8&16777215,zt=50331648,fn=!0,O.selectionForeground&&(pt=50331648,en=O.selectionForeground.rgba>>8&16777215,Ln=O.selectionForeground)),fn&&Ce.push("xterm-decoration-top"),zt){case 16777216:case 33554432:xn=O.ansi[tn],Ce.push(`xterm-bg-${tn}`);break;case 50331648:xn=C.channels.toColor(tn>>16,tn>>8&255,255&tn),this._addStyle(z,`background-color:#${M((tn>>>0).toString(16),"0",6)}`);break;default:Ut?(xn=O.foreground,Ce.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):xn=O.background}switch(wt||Ae.isDim()&&(wt=C.color.multiplyOpacity(xn,.5)),pt){case 16777216:case 33554432:Ae.isBold()&&en<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(en+=8),this._applyMinimumContrast(z,xn,O.ansi[en],Ae,wt,void 0)||Ce.push(`xterm-fg-${en}`);break;case 50331648:const ft=C.channels.toColor(en>>16&255,en>>8&255,255&en);this._applyMinimumContrast(z,xn,ft,Ae,wt,Ln)||this._addStyle(z,`color:#${M(en.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(z,xn,O.foreground,Ae,wt,Ln)||Ut&&Ce.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}Ce.length&&(z.className=Ce.join(" "),Ce.length=0),Oe||Pe||Wn?z.textContent=Z:W++,fe!==this.defaultSpacing&&(z.style.letterSpacing=`${fe}px`),K.push(z),xe=Ue}return z&&W&&(z.textContent=Z),K}_applyMinimumContrast(R,N,A,I,$,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const q=this._getContrastCache(I);let B;if($||H||(B=q.getColor(N.rgba,A.rgba)),B===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);B=C.color.ensureContrastRatio($||N,H||A,Y),q.setColor(($||N).rgba,(H||A).rgba,B??null)}return!!B&&(this._addStyle(R,`color:${B.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,N){R.setAttribute("style",`${R.getAttribute("style")||""}${N};`)}_isCellInSelection(R,N){const A=this._selectionStart,I=this._selectionEnd;return!(!A||!I)&&(this._columnSelectMode?A[0]<=I[0]?R>=A[0]&&N>=A[1]&&R<I[0]&&N<=I[1]:R<A[0]&&N>=A[1]&&R>=I[0]&&N<=I[1]:N>A[1]&&N<I[1]||A[1]===I[1]&&N===A[1]&&R>=A[0]&&R<I[0]||A[1]<I[1]&&N===I[1]&&R<I[0]||A[1]<I[1]&&N===A[1]&&R>=A[0])}};function M(R,N,A){for(;R.length<A;)R=N+R;return R}c.DomRendererRowFactory=k=p([g(1,_.ICharacterJoinerService),g(2,T.IOptionsService),g(3,_.ICoreBrowserService),g(4,T.ICoreService),g(5,T.IDecorationService),g(6,_.IThemeService)],k)},2550:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(h,p){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.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";const g=h.createElement("span");g.classList.add("xterm-char-measure-element");const m=h.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const S=h.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const w=h.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[g,m,S,w],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(S),this._container.appendChild(w),p.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(h,p,g,m){h===this._font&&p===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=h,this._fontSize=p,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(h,p,g){let m=0;if(!p&&!g&&h.length===1&&(m=h.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const T=this._measure(h,0);return T>0&&(this._flat[m]=T),T}let S=h;p&&(S+="B"),g&&(S+="I");let w=this._holey.get(S);if(w===void 0){let T=0;p&&(T|=1),g&&(T|=2),w=this._measure(h,T),w>0&&this._holey.set(S,w)}return w}_measure(h,p){const g=this._measureElements[p];return g.textContent=h.repeat(32),g.offsetWidth/32}}},2223:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const p=h(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=p.isFirefox||p.isLegacyEdge?"bottom":"ideographic"},6171:(f,c)=>{function h(g){return 57508<=g&&g<=57558}function p(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},c.isEmoji=p,c.allowRescaling=function(g,m,S,w){return m===1&&S>Math.ceil(1.5*w)&&g!==void 0&&g>255&&!p(g)&&!h(g)&&!(function(T){return 57344<=T&&T<=63743})(g)},c.treatGlyphAsBackgroundColor=function(g){return h(g)||(function(m){return 9472<=m&&m<=9631})(g)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(g,m,S=0){return(g-(2*Math.round(m)-S))%(2*Math.round(m))}},6052:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class h{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(g,m,S,w=!1){if(this.selectionStart=m,this.selectionEnd=S,!m||!S||m[0]===S[0]&&m[1]===S[1])return void this.clear();const T=g.buffers.active.ydisp,C=m[1]-T,_=S[1]-T,b=Math.max(C,0),v=Math.min(_,g.rows-1);b>=g.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=C,this.viewportEndRow=_,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=m[0],this.endCol=S[0])}isCellSelected(g,m,S){return!!this.hasSelection&&(S-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&S>=this.viewportCappedStartRow&&m<this.endCol&&S<=this.viewportCappedEndRow:m<this.startCol&&S>=this.viewportCappedStartRow&&m>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&m>=this.startCol)}}c.createSelectionRenderModel=function(){return new h}},456:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.SelectionModel=class{constructor(h){this._bufferService=h,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.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()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,p=this.selectionEnd;return!(!h||!p)&&(h[1]>p[1]||h[1]===p[1]&&h[0]>p[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(f,c,h){var p=this&&this.__decorate||function(v,y,k,M){var R,N=arguments.length,A=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(y,k,A):R(y,k))||A);return N>3&&A&&Object.defineProperty(y,k,A),A},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=h(2585),S=h(8460),w=h(844);let T=c.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,y,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new _(v,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};c.CharSizeService=T=p([g(2,m.IOptionsService)],T);class C extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,k){y!==void 0&&y>0&&k!==void 0&&k>0&&(this._result.width=y,this._result.height=k)}}class _ extends C{constructor(y,k,M){super(),this._document=y,this._parentElement=k,this._optionsService=M,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}}class b extends C{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(f,c,h){var p=this&&this.__decorate||function(b,v,y,k){var M,R=arguments.length,N=R<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,k);else for(var A=b.length-1;A>=0;A--)(M=b[A])&&(N=(R<3?M(N):R>3?M(v,y,N):M(v,y))||N);return R>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,k){v(y,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=h(3734),S=h(643),w=h(511),T=h(2585);class C extends m.AttributeData{constructor(v,y,k){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=y,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=C;let _=c.CharacterJoinerService=class wC{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(v){const y={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(y),y.id}deregister(v){for(let y=0;y<this._characterJoiners.length;y++)if(this._characterJoiners[y].id===v)return this._characterJoiners.splice(y,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const y=this._bufferService.buffer.lines.get(v);if(!y||y.length===0)return[];const k=[],M=y.translateToString(!0);let R=0,N=0,A=0,I=y.getFg(0),$=y.getBg(0);for(let H=0;H<y.getTrimmedLength();H++)if(y.loadCell(H,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==$){if(H-R>1){const q=this._getJoinedRanges(M,A,N,y,R);for(let B=0;B<q.length;B++)k.push(q[B])}R=H,A=N,I=this._workCell.fg,$=this._workCell.bg}N+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const H=this._getJoinedRanges(M,A,N,y,R);for(let q=0;q<H.length;q++)k.push(H[q])}return k}_getJoinedRanges(v,y,k,M,R){const N=v.substring(y,k);let A=[];try{A=this._characterJoiners[0].handler(N)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const $=this._characterJoiners[I].handler(N);for(let H=0;H<$.length;H++)wC._mergeRanges(A,$[H])}catch($){console.error($)}return this._stringRangesToCellRanges(A,M,R),A}_stringRangesToCellRanges(v,y,k){let M=0,R=!1,N=0,A=v[M];if(A){for(let I=k;I<this._bufferService.cols;I++){const $=y.getWidth(I),H=y.getString(I).length||S.WHITESPACE_CELL_CHAR.length;if($!==0){if(!R&&A[0]<=N&&(A[0]=I,R=!0),A[1]<=N){if(A[1]=I,A=v[++M],!A)break;A[0]<=N?(A[0]=I,R=!0):R=!1}N+=H}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(v,y){let k=!1;for(let M=0;M<v.length;M++){const R=v[M];if(k){if(y[1]<=R[0])return v[M-1][1]=y[1],v;if(y[1]<=R[1])return v[M-1][1]=Math.max(y[1],R[1]),v.splice(M,1),v;v.splice(M,1),M--}else{if(y[1]<=R[0])return v.splice(M,0,y),v;if(y[1]<=R[1])return R[0]=Math.min(y[0],R[0]),v;y[0]<R[1]&&(R[0]=Math.min(y[0],R[0]),k=!0)}}return k?v[v.length-1][1]=y[1]:v.push(y),v}};c.CharacterJoinerService=_=p([g(0,T.IBufferService)],_)},5114:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const p=h(844),g=h(8460),m=h(3656);class S extends p.Disposable{constructor(C,_,b){super(),this._textarea=C,this._window=_,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,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}}c.CoreBrowserService=S;class w extends p.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new p.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,p.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(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)}}},779:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const p=h(844);class g extends p.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,p.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const w=this.linkProviders.indexOf(S);w!==-1&&this.linkProviders.splice(w,1)}}}}c.LinkProviderService=g},8934:function(f,c,h){var p=this&&this.__decorate||function(T,C,_,b){var v,y=arguments.length,k=y<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(T,C,_,b);else for(var M=T.length-1;M>=0;M--)(v=T[M])&&(k=(y<3?v(k):y>3?v(C,_,k):v(C,_))||k);return y>3&&k&&Object.defineProperty(C,_,k),k},g=this&&this.__param||function(T,C){return function(_,b){C(_,b,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=h(4725),S=h(9806);let w=c.MouseService=class{constructor(T,C){this._renderService=T,this._charSizeService=C}getCoords(T,C,_,b,v){return(0,S.getCoords)(window,T,C,_,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(T,C){const _=(0,S.getCoordsRelativeToElement)(window,T,C);if(this._charSizeService.hasValidSize)return _[0]=Math.min(Math.max(_[0],0),this._renderService.dimensions.css.canvas.width-1),_[1]=Math.min(Math.max(_[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(_[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(_[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(_[0]),y:Math.floor(_[1])}}};c.MouseService=w=p([g(0,m.IRenderService),g(1,m.ICharSizeService)],w)},3230:function(f,c,h){var p=this&&this.__decorate||function(v,y,k,M){var R,N=arguments.length,A=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(y,k,A):R(y,k))||A);return N>3&&A&&Object.defineProperty(y,k,A),A},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=h(6193),S=h(4725),w=h(8460),T=h(844),C=h(7226),_=h(2585);let b=c.RenderService=class extends T.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,y,k,M,R,N,A,I){super(),this._rowCount=v,this._charSizeService=M,this._renderer=this.register(new T.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new T.MutableDisposable),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 w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer((($,H)=>this._renderRows($,H)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(N.onResize((()=>this._fullRefresh()))),this.register(N.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(N.cols,N.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(N.buffer.y,N.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,y),this.register(A.onWindowChange(($=>this._registerIntersectionObserver($,y))))}_registerIntersectionObserver(v,y){if("IntersectionObserver"in v){const k=new v.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});k.observe(y),this._observerDisposable.value=(0,T.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,y,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,y,this._rowCount))}_renderRows(v,y){this._renderer.value&&(v=Math.min(v,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(v,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:y}),this._onRender.fire({start:v,end:y}),this._isNextRenderRedrawOnly=!0)}resize(v,y){this._rowCount=y,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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_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(v,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(v,y))):this._renderer.value.handleResize(v,y),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(v,y,k){this._selectionState.start=v,this._selectionState.end=y,this._selectionState.columnSelectMode=k,this._renderer.value?.handleSelectionChanged(v,y,k)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};c.RenderService=b=p([g(2,_.IOptionsService),g(3,S.ICharSizeService),g(4,_.IDecorationService),g(5,_.IBufferService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],b)},9312:function(f,c,h){var p=this&&this.__decorate||function(A,I,$,H){var q,B=arguments.length,Y=B<3?I:H===null?H=Object.getOwnPropertyDescriptor(I,$):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(A,I,$,H);else for(var G=A.length-1;G>=0;G--)(q=A[G])&&(Y=(B<3?q(Y):B>3?q(I,$,Y):q(I,$))||Y);return B>3&&Y&&Object.defineProperty(I,$,Y),Y},g=this&&this.__param||function(A,I){return function($,H){I($,H,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const m=h(9806),S=h(9504),w=h(456),T=h(4725),C=h(8460),_=h(844),b=h(6114),v=h(4841),y=h(511),k=h(2585),M=" ",R=new RegExp(M,"g");let N=c.SelectionService=class extends _.Disposable{constructor(A,I,$,H,q,B,Y,G,P){super(),this._element=A,this._screenElement=I,this._linkifier=$,this._bufferService=H,this._coreService=q,this._mouseService=B,this._optionsService=Y,this._renderService=G,this._coreBrowserService=P,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,_.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!A||!I||A[0]===I[0]&&A[1]===I[1])}get selectionText(){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!A||!I)return"";const $=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(A[0]===I[0])return"";const q=A[0]<I[0]?A[0]:I[0],B=A[0]<I[0]?I[0]:A[0];for(let Y=A[1];Y<=I[1];Y++){const G=$.translateBufferLineToString(Y,!0,q,B);H.push(G)}}else{const q=A[1]===I[1]?I[0]:void 0;H.push($.translateBufferLineToString(A[1],!0,A[0],q));for(let B=A[1]+1;B<=I[1]-1;B++){const Y=$.lines.get(B),G=$.translateBufferLineToString(B,!0);Y?.isWrapped?H[H.length-1]+=G:H.push(G)}if(A[1]!==I[1]){const B=$.lines.get(I[1]),Y=$.translateBufferLineToString(I[1],!0,0,I[0]);B&&B.isWrapped?H[H.length-1]+=Y:H.push(Y)}}return H.map((q=>q.replace(R," "))).join(b.isWindows?`\r
79
+ `:`
80
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&A&&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(A){const I=this._getMouseBufferCoords(A),$=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!($&&H&&I)&&this._areCoordsInSelection(I,$,H)}isCellInSelection(A,I){const $=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!$||!H)&&this._areCoordsInSelection([A,I],$,H)}_areCoordsInSelection(A,I,$){return A[1]>I[1]&&A[1]<$[1]||I[1]===$[1]&&A[1]===I[1]&&A[0]>=I[0]&&A[0]<$[0]||I[1]<$[1]&&A[1]===$[1]&&A[0]<$[0]||I[1]<$[1]&&A[1]===I[1]&&A[0]>=I[0]}_selectWordAtCursor(A,I){const $=this._linkifier.currentLink?.link?.range;if($)return this._model.selectionStart=[$.start.x-1,$.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)($,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(A);return!!H&&(this._selectWordAt(H,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,I){this._model.clearSelection(),A=Math.max(A,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const I=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(A){let I=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const $=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=$?0:(I>$&&(I-=$),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(A){return b.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),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()),50)}_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(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const I=this._getMouseBufferCoords(A);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);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(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const $=this._bufferService.buffer;if(this._model.selectionEnd[1]<$.lines.length){const H=$.lines.get(this._model.selectionEnd[1]);H&&H.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const I=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const $=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if($&&$[0]!==void 0&&$[1]!==void 0){const H=(0,S.moveToCellSequence)($[0]-1,$[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,$=!(!A||!I||A[0]===I[0]&&A[1]===I[1]);$?A&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,I,$)):this._oldHasSelection&&this._fireOnSelectionChange(A,I,$)}_fireOnSelectionChange(A,I,$){this._oldSelectionStart=A,this._oldSelectionEnd=I,this._oldHasSelection=$,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(A,I){let $=I;for(let H=0;I>=H;H++){const q=A.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?$--:q>1&&I!==H&&($+=q-1)}return $}setSelection(A,I,$){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,I],this._model.selectionStartLength=$,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,I,$=!0,H=!0){if(A[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,B=q.lines.get(A[1]);if(!B)return;const Y=q.translateBufferLineToString(A[1],!1);let G=this._convertViewportColToCharacterIndex(B,A[0]),P=G;const K=A[0]-G;let V=0,O=0,z=0,j=0;if(Y.charAt(G)===" "){for(;G>0&&Y.charAt(G-1)===" ";)G--;for(;P<Y.length&&Y.charAt(P+1)===" ";)P++}else{let ne=A[0],te=A[0];B.getWidth(ne)===0&&(V++,ne--),B.getWidth(te)===2&&(O++,te++);const he=B.getString(te).length;for(he>1&&(j+=he-1,P+=he-1);ne>0&&G>0&&!this._isCharWordSeparator(B.loadCell(ne-1,this._workCell));){B.loadCell(ne-1,this._workCell);const J=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,ne--):J>1&&(z+=J-1,G-=J-1),G--,ne--}for(;te<B.length&&P+1<Y.length&&!this._isCharWordSeparator(B.loadCell(te+1,this._workCell));){B.loadCell(te+1,this._workCell);const J=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,te++):J>1&&(j+=J-1,P+=J-1),P++,te++}}P++;let W=G+K-V+z,Z=Math.min(this._bufferService.cols,P-G+V+O-z-j);if(I||Y.slice(G,P).trim()!==""){if($&&W===0&&B.getCodePoint(0)!==32){const ne=q.lines.get(A[1]-1);if(ne&&B.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const te=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(te){const he=this._bufferService.cols-te.start;W-=he,Z+=he}}}if(H&&W+Z===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const ne=q.lines.get(A[1]+1);if(ne?.isWrapped&&ne.getCodePoint(0)!==32){const te=this._getWordAt([0,A[1]+1],!1,!1,!0);te&&(Z+=te.length)}}return{start:W,length:Z}}}_selectWordAt(A,I){const $=this._getWordAt(A,I);if($){for(;$.start<0;)$.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[$.start,A[1]],this._model.selectionStartLength=$.length}}_selectToWordAt(A){const I=this._getWordAt(A,!0);if(I){let $=A[1];for(;I.start<0;)I.start+=this._bufferService.cols,$--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,$++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,$]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const I=this._bufferService.buffer.getWrappedRangeForLine(A),$={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)($,this._bufferService.cols)}};c.SelectionService=N=p([g(3,k.IBufferService),g(4,k.ICoreService),g(5,T.IMouseService),g(6,k.IOptionsService),g(7,T.IRenderService),g(8,T.ICoreBrowserService)],N)},4725:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const p=h(8343);c.ICharSizeService=(0,p.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,p.createDecorator)("CoreBrowserService"),c.IMouseService=(0,p.createDecorator)("MouseService"),c.IRenderService=(0,p.createDecorator)("RenderService"),c.ISelectionService=(0,p.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,p.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,p.createDecorator)("ThemeService"),c.ILinkProviderService=(0,p.createDecorator)("LinkProviderService")},6731:function(f,c,h){var p=this&&this.__decorate||function(N,A,I,$){var H,q=arguments.length,B=q<3?A:$===null?$=Object.getOwnPropertyDescriptor(A,I):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(N,A,I,$);else for(var Y=N.length-1;Y>=0;Y--)(H=N[Y])&&(B=(q<3?H(B):q>3?H(A,I,B):H(A,I))||B);return q>3&&B&&Object.defineProperty(A,I,B),B},g=this&&this.__param||function(N,A){return function(I,$){A(I,$,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),S=h(8055),w=h(8460),T=h(844),C=h(2585),_=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),v=S.css.toColor("#ffffff"),y=S.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const N=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let I=0;I<216;I++){const $=A[I/36%6|0],H=A[I/6%6|0],q=A[I%6];N.push({css:S.channels.toCss($,H,q),rgba:S.channels.toRgba($,H,q)})}for(let I=0;I<24;I++){const $=8+10*I;N.push({css:S.channels.toCss($,$,$),rgba:S.channels.toRgba($,$,$)})}return N})());let M=c.ThemeService=class extends T.Disposable{get colors(){return this._colors}constructor(N){super(),this._optionsService=N,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:_,background:b,cursor:v,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:S.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:S.color.blend(b,k),ansi:c.DEFAULT_ANSI_COLORS.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))))}_setTheme(N={}){const A=this._colors;if(A.foreground=R(N.foreground,_),A.background=R(N.background,b),A.cursor=R(N.cursor,v),A.cursorAccent=R(N.cursorAccent,y),A.selectionBackgroundTransparent=R(N.selectionBackground,k),A.selectionBackgroundOpaque=S.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=R(N.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=S.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=N.selectionForeground?R(N.selectionForeground,S.NULL_COLOR):void 0,A.selectionForeground===S.NULL_COLOR&&(A.selectionForeground=void 0),S.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=S.color.opacity(A.selectionBackgroundTransparent,.3)),S.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=S.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=c.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=R(N.black,c.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=R(N.red,c.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=R(N.green,c.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=R(N.yellow,c.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=R(N.blue,c.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=R(N.magenta,c.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=R(N.cyan,c.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=R(N.white,c.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=R(N.brightBlack,c.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=R(N.brightRed,c.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=R(N.brightGreen,c.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=R(N.brightYellow,c.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=R(N.brightBlue,c.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=R(N.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=R(N.brightCyan,c.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=R(N.brightWhite,c.DEFAULT_ANSI_COLORS[15]),N.extendedAnsi){const I=Math.min(A.ansi.length-16,N.extendedAnsi.length);for(let $=0;$<I;$++)A.ansi[$+16]=R(N.extendedAnsi[$],c.DEFAULT_ANSI_COLORS[$+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(N){this._restoreColor(N),this._onChangeColors.fire(this.colors)}_restoreColor(N){if(N!==void 0)switch(N){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[N]=this._restoreColors.ansi[N]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(N){N(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()}}};function R(N,A){if(N!==void 0)try{return S.css.toColor(N)}catch{}return A}c.ThemeService=M=p([g(0,C.IOptionsService)],M)},6349:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const p=h(8460),g=h(844);class m extends g.Disposable{constructor(w){super(),this._maxLength=w,this.onDeleteEmitter=this.register(new p.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new p.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new p.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(w){if(this._maxLength===w)return;const T=new Array(w);for(let C=0;C<Math.min(w,this.length);C++)T[C]=this._array[this._getCyclicIndex(C)];this._array=T,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let T=this._length;T<w;T++)this._array[T]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,T){this._array[this._getCyclicIndex(w)]=T}push(w){this._array[this._getCyclicIndex(this._length)]=w,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(w,T,...C){if(T){for(let _=w;_<this._length-T;_++)this._array[this._getCyclicIndex(_)]=this._array[this._getCyclicIndex(_+T)];this._length-=T,this.onDeleteEmitter.fire({index:w,amount:T})}for(let _=this._length-1;_>=w;_--)this._array[this._getCyclicIndex(_+C.length)]=this._array[this._getCyclicIndex(_)];for(let _=0;_<C.length;_++)this._array[this._getCyclicIndex(w+_)]=C[_];if(C.length&&this.onInsertEmitter.fire({index:w,amount:C.length}),this._length+C.length>this._maxLength){const _=this._length+C.length-this._maxLength;this._startIndex+=_,this._length=this._maxLength,this.onTrimEmitter.fire(_)}else this._length+=C.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,T,C){if(!(T<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let b=T-1;b>=0;b--)this.set(w+b+C,this.get(w+b));const _=w+T+C-this._length;if(_>0)for(this._length+=_;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let _=0;_<T;_++)this.set(w+_+C,this.get(w+_))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}c.CircularList=m},1439:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function h(p,g=5){if(typeof p!="object")return p;const m=Array.isArray(p)?[]:{};for(const S in p)m[S]=g<=1?p[S]:p[S]&&h(p[S],g-1);return m}},8055:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let h=0,p=0,g=0,m=0;var S,w,T,C,_;function b(y){const k=y.toString(16);return k.length<2?"0"+k:k}function v(y,k){return y<k?(k+.05)/(y+.05):(y+.05)/(k+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(k,M,R,N){return N!==void 0?`#${b(k)}${b(M)}${b(R)}${b(N)}`:`#${b(k)}${b(M)}${b(R)}`},y.toRgba=function(k,M,R,N=255){return(k<<24|M<<16|R<<8|N)>>>0},y.toColor=function(k,M,R,N){return{css:y.toCss(k,M,R,N),rgba:y.toRgba(k,M,R,N)}}})(S||(c.channels=S={})),(function(y){function k(M,R){return m=Math.round(255*R),[h,p,g]=_.toChannels(M.rgba),{css:S.toCss(h,p,g,m),rgba:S.toRgba(h,p,g,m)}}y.blend=function(M,R){if(m=(255&R.rgba)/255,m===1)return{css:R.css,rgba:R.rgba};const N=R.rgba>>24&255,A=R.rgba>>16&255,I=R.rgba>>8&255,$=M.rgba>>24&255,H=M.rgba>>16&255,q=M.rgba>>8&255;return h=$+Math.round((N-$)*m),p=H+Math.round((A-H)*m),g=q+Math.round((I-q)*m),{css:S.toCss(h,p,g),rgba:S.toRgba(h,p,g)}},y.isOpaque=function(M){return(255&M.rgba)==255},y.ensureContrastRatio=function(M,R,N){const A=_.ensureContrastRatio(M.rgba,R.rgba,N);if(A)return S.toColor(A>>24&255,A>>16&255,A>>8&255)},y.opaque=function(M){const R=(255|M.rgba)>>>0;return[h,p,g]=_.toChannels(R),{css:S.toCss(h,p,g),rgba:R}},y.opacity=k,y.multiplyOpacity=function(M,R){return m=255&M.rgba,k(M,m*R/255)},y.toColorRGB=function(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}})(w||(c.color=w={})),(function(y){let k,M;try{const R=document.createElement("canvas");R.width=1,R.height=1;const N=R.getContext("2d",{willReadFrequently:!0});N&&(k=N,k.globalCompositeOperation="copy",M=k.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return h=parseInt(R.slice(1,2).repeat(2),16),p=parseInt(R.slice(2,3).repeat(2),16),g=parseInt(R.slice(3,4).repeat(2),16),S.toColor(h,p,g);case 5:return h=parseInt(R.slice(1,2).repeat(2),16),p=parseInt(R.slice(2,3).repeat(2),16),g=parseInt(R.slice(3,4).repeat(2),16),m=parseInt(R.slice(4,5).repeat(2),16),S.toColor(h,p,g,m);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}}const N=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(N)return h=parseInt(N[1]),p=parseInt(N[2]),g=parseInt(N[3]),m=Math.round(255*(N[5]===void 0?1:parseFloat(N[5]))),S.toColor(h,p,g,m);if(!k||!M)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=M,k.fillStyle=R,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[h,p,g,m]=k.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(h,p,g,m),css:R}}})(T||(c.css=T={})),(function(y){function k(M,R,N){const A=M/255,I=R/255,$=N/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*($<=.03928?$/12.92:Math.pow(($+.055)/1.055,2.4))}y.relativeLuminance=function(M){return k(M>>16&255,M>>8&255,255&M)},y.relativeLuminance2=k})(C||(c.rgb=C={})),(function(y){function k(R,N,A){const I=R>>24&255,$=R>>16&255,H=R>>8&255;let q=N>>24&255,B=N>>16&255,Y=N>>8&255,G=v(C.relativeLuminance2(q,B,Y),C.relativeLuminance2(I,$,H));for(;G<A&&(q>0||B>0||Y>0);)q-=Math.max(0,Math.ceil(.1*q)),B-=Math.max(0,Math.ceil(.1*B)),Y-=Math.max(0,Math.ceil(.1*Y)),G=v(C.relativeLuminance2(q,B,Y),C.relativeLuminance2(I,$,H));return(q<<24|B<<16|Y<<8|255)>>>0}function M(R,N,A){const I=R>>24&255,$=R>>16&255,H=R>>8&255;let q=N>>24&255,B=N>>16&255,Y=N>>8&255,G=v(C.relativeLuminance2(q,B,Y),C.relativeLuminance2(I,$,H));for(;G<A&&(q<255||B<255||Y<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),B=Math.min(255,B+Math.ceil(.1*(255-B))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),G=v(C.relativeLuminance2(q,B,Y),C.relativeLuminance2(I,$,H));return(q<<24|B<<16|Y<<8|255)>>>0}y.blend=function(R,N){if(m=(255&N)/255,m===1)return N;const A=N>>24&255,I=N>>16&255,$=N>>8&255,H=R>>24&255,q=R>>16&255,B=R>>8&255;return h=H+Math.round((A-H)*m),p=q+Math.round((I-q)*m),g=B+Math.round(($-B)*m),S.toRgba(h,p,g)},y.ensureContrastRatio=function(R,N,A){const I=C.relativeLuminance(R>>8),$=C.relativeLuminance(N>>8);if(v(I,$)<A){if($<I){const B=k(R,N,A),Y=v(I,C.relativeLuminance(B>>8));if(Y<A){const G=M(R,N,A);return Y>v(I,C.relativeLuminance(G>>8))?B:G}return B}const H=M(R,N,A),q=v(I,C.relativeLuminance(H>>8));if(q<A){const B=k(R,N,A);return q>v(I,C.relativeLuminance(B>>8))?H:B}return H}},y.reduceLuminance=k,y.increaseLuminance=M,y.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(_||(c.rgba=_={})),c.toPaddedHex=b,c.contrastRatio=v},8969:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const p=h(844),g=h(2585),m=h(4348),S=h(7866),w=h(744),T=h(7302),C=h(6975),_=h(8460),b=h(1753),v=h(1480),y=h(7994),k=h(9282),M=h(5435),R=h(5981),N=h(2660);let A=!1;class I extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new _.EventEmitter),this._onScroll.event((H=>{this._onScrollApi?.fire(H.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(H){for(const q in H)this.optionsService.options[q]=H[q]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new p.MutableDisposable),this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new _.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new _.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new _.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new T.OptionsService(H)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(N.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new M.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,_.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,_.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,_.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,_.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((q=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((q=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new R.WriteBuffer(((q,B)=>this._inputHandler.parse(q,B)))),this.register((0,_.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,q){this._writeBuffer.write(H,q)}writeSync(H,q){this._logService.logLevel<=g.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(H,q)}input(H,q=!0){this.coreService.triggerDataEvent(H,q)}resize(H,q){isNaN(H)||isNaN(q)||(H=Math.max(H,w.MINIMUM_COLS),q=Math.max(q,w.MINIMUM_ROWS),this._bufferService.resize(H,q))}scroll(H,q=!1){this._bufferService.scroll(H,q)}scrollLines(H,q,B){this._bufferService.scrollLines(H,q,B)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const q=H-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(H,q){return this._inputHandler.registerEscHandler(H,q)}registerDcsHandler(H,q){return this._inputHandler.registerDcsHandler(H,q)}registerCsiHandler(H,q){return this._inputHandler.registerCsiHandler(H,q)}registerOscHandler(H,q){return this._inputHandler.registerOscHandler(H,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?H=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,p.toDisposable)((()=>{for(const q of H)q.dispose()}))}}}c.CoreTerminal=I},8460:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let p=0;p<this._listeners.length;p++)if(this._listeners[p]===h)return void this._listeners.splice(p,1)}}})),this._event}fire(h,p){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,h,p)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,p){return h((g=>p.fire(g)))},c.runAndSubscribe=function(h,p){return p(void 0),h((g=>p(g)))}},5435:function(f,c,h){var p=this&&this.__decorate||function(V,O,z,j){var W,Z=arguments.length,ne=Z<3?O:j===null?j=Object.getOwnPropertyDescriptor(O,z):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(V,O,z,j);else for(var te=V.length-1;te>=0;te--)(W=V[te])&&(ne=(Z<3?W(ne):Z>3?W(O,z,ne):W(O,z))||ne);return Z>3&&ne&&Object.defineProperty(O,z,ne),ne},g=this&&this.__param||function(V,O){return function(z,j){O(z,j,V)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=h(2584),S=h(7116),w=h(2015),T=h(844),C=h(482),_=h(8437),b=h(8460),v=h(643),y=h(511),k=h(3734),M=h(2585),R=h(1480),N=h(6242),A=h(6351),I=h(5941),$={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function q(V,O){if(V>24)return O.setWinLines||!1;switch(V){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var B;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(c.WindowsOptionsReportType=B={}));let Y=0;class G extends T.Disposable{getAttrData(){return this._curAttrData}constructor(O,z,j,W,Z,ne,te,he,J=new w.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=z,this._coreService=j,this._logService=W,this._optionsService=Z,this._oscLinkService=ne,this._coreMouseService=te,this._unicodeService=he,this._parser=J,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),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 P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((F=>this._activeBuffer=F.activeBuffer))),this._parser.setCsiHandlerFallback(((F,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(F),params:ae.toArray()})})),this._parser.setEscHandlerFallback((F=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(F)})})),this._parser.setExecuteHandlerFallback((F=>{this._logService.debug("Unknown EXECUTE code: ",{code:F})})),this._parser.setOscHandlerFallback(((F,ae,fe)=>{this._logService.debug("Unknown OSC code: ",{identifier:F,action:ae,data:fe})})),this._parser.setDcsHandlerFallback(((F,ae,fe)=>{ae==="HOOK"&&(fe=fe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(F),action:ae,payload:fe})})),this._parser.setPrintHandler(((F,ae,fe)=>this.print(F,ae,fe))),this._parser.registerCsiHandler({final:"@"},(F=>this.insertChars(F))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(F=>this.scrollLeft(F))),this._parser.registerCsiHandler({final:"A"},(F=>this.cursorUp(F))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(F=>this.scrollRight(F))),this._parser.registerCsiHandler({final:"B"},(F=>this.cursorDown(F))),this._parser.registerCsiHandler({final:"C"},(F=>this.cursorForward(F))),this._parser.registerCsiHandler({final:"D"},(F=>this.cursorBackward(F))),this._parser.registerCsiHandler({final:"E"},(F=>this.cursorNextLine(F))),this._parser.registerCsiHandler({final:"F"},(F=>this.cursorPrecedingLine(F))),this._parser.registerCsiHandler({final:"G"},(F=>this.cursorCharAbsolute(F))),this._parser.registerCsiHandler({final:"H"},(F=>this.cursorPosition(F))),this._parser.registerCsiHandler({final:"I"},(F=>this.cursorForwardTab(F))),this._parser.registerCsiHandler({final:"J"},(F=>this.eraseInDisplay(F,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(F=>this.eraseInDisplay(F,!0))),this._parser.registerCsiHandler({final:"K"},(F=>this.eraseInLine(F,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(F=>this.eraseInLine(F,!0))),this._parser.registerCsiHandler({final:"L"},(F=>this.insertLines(F))),this._parser.registerCsiHandler({final:"M"},(F=>this.deleteLines(F))),this._parser.registerCsiHandler({final:"P"},(F=>this.deleteChars(F))),this._parser.registerCsiHandler({final:"S"},(F=>this.scrollUp(F))),this._parser.registerCsiHandler({final:"T"},(F=>this.scrollDown(F))),this._parser.registerCsiHandler({final:"X"},(F=>this.eraseChars(F))),this._parser.registerCsiHandler({final:"Z"},(F=>this.cursorBackwardTab(F))),this._parser.registerCsiHandler({final:"`"},(F=>this.charPosAbsolute(F))),this._parser.registerCsiHandler({final:"a"},(F=>this.hPositionRelative(F))),this._parser.registerCsiHandler({final:"b"},(F=>this.repeatPrecedingCharacter(F))),this._parser.registerCsiHandler({final:"c"},(F=>this.sendDeviceAttributesPrimary(F))),this._parser.registerCsiHandler({prefix:">",final:"c"},(F=>this.sendDeviceAttributesSecondary(F))),this._parser.registerCsiHandler({final:"d"},(F=>this.linePosAbsolute(F))),this._parser.registerCsiHandler({final:"e"},(F=>this.vPositionRelative(F))),this._parser.registerCsiHandler({final:"f"},(F=>this.hVPosition(F))),this._parser.registerCsiHandler({final:"g"},(F=>this.tabClear(F))),this._parser.registerCsiHandler({final:"h"},(F=>this.setMode(F))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(F=>this.setModePrivate(F))),this._parser.registerCsiHandler({final:"l"},(F=>this.resetMode(F))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(F=>this.resetModePrivate(F))),this._parser.registerCsiHandler({final:"m"},(F=>this.charAttributes(F))),this._parser.registerCsiHandler({final:"n"},(F=>this.deviceStatus(F))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(F=>this.deviceStatusPrivate(F))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(F=>this.softReset(F))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(F=>this.setCursorStyle(F))),this._parser.registerCsiHandler({final:"r"},(F=>this.setScrollRegion(F))),this._parser.registerCsiHandler({final:"s"},(F=>this.saveCursor(F))),this._parser.registerCsiHandler({final:"t"},(F=>this.windowOptions(F))),this._parser.registerCsiHandler({final:"u"},(F=>this.restoreCursor(F))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(F=>this.insertColumns(F))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(F=>this.deleteColumns(F))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(F=>this.selectProtected(F))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(F=>this.requestMode(F,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(F=>this.requestMode(F,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new N.OscHandler((F=>(this.setTitle(F),this.setIconName(F),!0)))),this._parser.registerOscHandler(1,new N.OscHandler((F=>this.setIconName(F)))),this._parser.registerOscHandler(2,new N.OscHandler((F=>this.setTitle(F)))),this._parser.registerOscHandler(4,new N.OscHandler((F=>this.setOrReportIndexedColor(F)))),this._parser.registerOscHandler(8,new N.OscHandler((F=>this.setHyperlink(F)))),this._parser.registerOscHandler(10,new N.OscHandler((F=>this.setOrReportFgColor(F)))),this._parser.registerOscHandler(11,new N.OscHandler((F=>this.setOrReportBgColor(F)))),this._parser.registerOscHandler(12,new N.OscHandler((F=>this.setOrReportCursorColor(F)))),this._parser.registerOscHandler(104,new N.OscHandler((F=>this.restoreIndexedColor(F)))),this._parser.registerOscHandler(110,new N.OscHandler((F=>this.restoreFgColor(F)))),this._parser.registerOscHandler(111,new N.OscHandler((F=>this.restoreBgColor(F)))),this._parser.registerOscHandler(112,new N.OscHandler((F=>this.restoreCursorColor(F)))),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(const F in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:F},(()=>this.selectCharset("("+F))),this._parser.registerEscHandler({intermediates:")",final:F},(()=>this.selectCharset(")"+F))),this._parser.registerEscHandler({intermediates:"*",final:F},(()=>this.selectCharset("*"+F))),this._parser.registerEscHandler({intermediates:"+",final:F},(()=>this.selectCharset("+"+F))),this._parser.registerEscHandler({intermediates:"-",final:F},(()=>this.selectCharset("-"+F))),this._parser.registerEscHandler({intermediates:".",final:F},(()=>this.selectCharset("."+F))),this._parser.registerEscHandler({intermediates:"/",final:F},(()=>this.selectCharset("/"+F)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((F=>(this._logService.error("Parsing error: ",F),F))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((F,ae)=>this.requestStatusString(F,ae))))}_preserveStack(O,z,j,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=z,this._parseStack.decodedLength=j,this._parseStack.position=W}_logSlowResolvingAsync(O){this._logService.logLevel<=M.LogLevelEnum.WARN&&Promise.race([O,new Promise(((z,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((z=>{if(z!=="#SLOW_TIMEOUT")throw z;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,z){let j,W=this._activeBuffer.x,Z=this._activeBuffer.y,ne=0;const te=this._parseStack.paused;if(te){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,z))return this._logSlowResolvingAsync(j),j;W=this._parseStack.cursorStartX,Z=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>H&&(ne=this._parseStack.position+H)}if(this._logService.logLevel<=M.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(F=>String.fromCharCode(F))).join("")}"`),typeof O=="string"?O.split("").map((F=>F.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<H&&(this._parseBuffer=new Uint32Array(Math.min(O.length,H))),te||this._dirtyRowTracker.clearRange(),O.length>H)for(let F=ne;F<O.length;F+=H){const ae=F+H<O.length?F+H:O.length,fe=typeof O=="string"?this._stringDecoder.decode(O.substring(F,ae),this._parseBuffer):this._utf8Decoder.decode(O.subarray(F,ae),this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,fe))return this._preserveStack(W,Z,fe,F),this._logSlowResolvingAsync(j),j}else if(!te){const F=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,F))return this._preserveStack(W,Z,F,0),this._logSlowResolvingAsync(j),j}this._activeBuffer.x===W&&this._activeBuffer.y===Z||this._onCursorMove.fire();const he=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),J=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);J<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(J,this._bufferService.rows-1),Math.min(he,this._bufferService.rows-1))}print(O,z,j){let W,Z;const ne=this._charsetService.charset,te=this._optionsService.rawOptions.screenReaderMode,he=this._bufferService.cols,J=this._coreService.decPrivateModes.wraparound,F=this._coreService.modes.insertMode,ae=this._curAttrData;let fe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&j-z>0&&fe.getWidth(this._activeBuffer.x-1)===2&&fe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let Ce=this._parser.precedingJoinState;for(let pe=z;pe<j;++pe){if(W=O[pe],W<127&&ne){const Ue=ne[String.fromCharCode(W)];Ue&&(W=Ue.charCodeAt(0))}const xe=this._unicodeService.charProperties(W,Ce);Z=R.UnicodeService.extractWidth(xe);const Le=R.UnicodeService.extractShouldJoin(xe),Pe=Le?R.UnicodeService.extractWidth(Ce):0;if(Ce=xe,te&&this._onA11yChar.fire((0,C.stringFromCodePoint)(W)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Z-Pe>he){if(J){const Ue=fe;let Ae=this._activeBuffer.x-Pe;for(this._activeBuffer.x=Pe,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),fe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Pe>0&&fe instanceof _.BufferLine&&fe.copyCellsFrom(Ue,Ae,0,Pe,!1);Ae<he;)Ue.setCellFromCodepoint(Ae++,0,1,ae)}else if(this._activeBuffer.x=he-1,Z===2)continue}if(Le&&this._activeBuffer.x){const Ue=fe.getWidth(this._activeBuffer.x-1)?1:2;fe.addCodepointToCell(this._activeBuffer.x-Ue,W,Z);for(let Ae=Z-Pe;--Ae>=0;)fe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(F&&(fe.insertCells(this._activeBuffer.x,Z-Pe,this._activeBuffer.getNullCell(ae)),fe.getWidth(he-1)===2&&fe.setCellFromCodepoint(he-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ae)),fe.setCellFromCodepoint(this._activeBuffer.x++,W,Z,ae),Z>0)for(;--Z;)fe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=Ce,this._activeBuffer.x<he&&j-z>0&&fe.getWidth(this._activeBuffer.x)===0&&!fe.hasContent(this._activeBuffer.x)&&fe.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,z){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,z):this._parser.registerCsiHandler(O,(j=>!q(j.params[0],this._optionsService.rawOptions.windowOptions)||z(j)))}registerDcsHandler(O,z){return this._parser.registerDcsHandler(O,new A.DcsHandler(z))}registerEscHandler(O,z){return this._parser.registerEscHandler(O,z)}registerOscHandler(O,z){return this._parser.registerOscHandler(O,new N.OscHandler(z))}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;const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);O.hasWidth(this._activeBuffer.x)&&!O.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,z){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+z):(this._activeBuffer.x=O,this._activeBuffer.y=z),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,z){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+z)}cursorUp(O){const z=this._activeBuffer.y-this._activeBuffer.scrollTop;return z>=0?this._moveCursor(0,-Math.min(z,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const z=this._activeBuffer.scrollBottom-this._activeBuffer.y;return z>=0?this._moveCursor(0,Math.min(z,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const z=O.params[0];return z===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:z===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let z=O.params[0]||1;for(;z--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let z=O.params[0]||1;for(;z--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const z=O.params[0];return z===1&&(this._curAttrData.bg|=536870912),z!==2&&z!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,z,j,W=!1,Z=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);ne.replaceCells(z,j,this._activeBuffer.getNullCell(this._eraseAttrData()),Z),W&&(ne.isWrapped=!1)}_resetBufferLine(O,z=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),z),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),j.isWrapped=!1)}eraseInDisplay(O,z=!1){let j;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,z);j<this._bufferService.rows;j++)this._resetBufferLine(j,z);this._dirtyRowTracker.markDirty(j);break;case 1:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j,0,this._activeBuffer.x+1,!0,z),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,z);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,z);this._dirtyRowTracker.markDirty(0);break;case 3:const W=this._activeBuffer.lines.length-this._bufferService.rows;W>0&&(this._activeBuffer.lines.trimStart(W),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-W,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-W,0),this._onScroll.fire(0))}return!0}eraseInLine(O,z=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,z);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,z);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,z)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let z=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y,W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Z=this._bufferService.rows-1+this._activeBuffer.ybase-W+1;for(;z--;)this._activeBuffer.lines.splice(Z-1,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let z=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y;let W;for(W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-W;z--;)this._activeBuffer.lines.splice(j,1),this._activeBuffer.lines.splice(W,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(O){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let z=O.params[0]||1;for(;z--;)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(O){let z=O.params[0]||1;for(;z--;)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(_.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);W.deleteCells(0,z,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);W.insertCells(0,z,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);W.insertCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);W.deleteCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const z=this._parser.precedingJoinState;if(!z)return!0;const j=O.params[0]||1,W=R.UnicodeService.extractWidth(z),Z=this._activeBuffer.x-W,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Z),te=new Uint32Array(ne.length*j);let he=0;for(let F=0;F<ne.length;){const ae=ne.codePointAt(F)||0;te[he++]=ae,F+=ae>65535?2:1}let J=he;for(let F=1;F<j;++F)te.copyWithin(J,0,he),J+=he;return this.print(te,0,J),!0}sendDeviceAttributesPrimary(O){return O.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let z=0;z<O.length;z++)switch(O.params[z]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let z=0;z<O.length;z++)switch(O.params[z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(O){for(let z=0;z<O.length;z++)switch(O.params[z]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let z=0;z<O.length;z++)switch(O.params[z]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),O.params[z]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(O,z){const j=this._coreService.decPrivateModes,{activeProtocol:W,activeEncoding:Z}=this._coreMouseService,ne=this._coreService,{buffers:te,cols:he}=this._bufferService,{active:J,alt:F}=te,ae=this._optionsService.rawOptions,fe=Le=>Le?1:2,Ce=O.params[0];return pe=Ce,xe=z?Ce===2?4:Ce===4?fe(ne.modes.insertMode):Ce===12?3:Ce===20?fe(ae.convertEol):0:Ce===1?fe(j.applicationCursorKeys):Ce===3?ae.windowOptions.setWinLines?he===80?2:he===132?1:0:0:Ce===6?fe(j.origin):Ce===7?fe(j.wraparound):Ce===8?3:Ce===9?fe(W==="X10"):Ce===12?fe(ae.cursorBlink):Ce===25?fe(!ne.isCursorHidden):Ce===45?fe(j.reverseWraparound):Ce===66?fe(j.applicationKeypad):Ce===67?4:Ce===1e3?fe(W==="VT200"):Ce===1002?fe(W==="DRAG"):Ce===1003?fe(W==="ANY"):Ce===1004?fe(j.sendFocus):Ce===1005?4:Ce===1006?fe(Z==="SGR"):Ce===1015?4:Ce===1016?fe(Z==="SGR_PIXELS"):Ce===1048?1:Ce===47||Ce===1047||Ce===1049?fe(J===F):Ce===2004?fe(j.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${z?"":"?"}${pe};${xe}$y`),!0;var pe,xe}_updateAttrColor(O,z,j,W,Z){return z===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([j,W,Z])):z===5&&(O&=-50331904,O|=33554432|255&j),O}_extractColor(O,z,j){const W=[0,0,-1,0,0,0];let Z=0,ne=0;do{if(W[ne+Z]=O.params[z+ne],O.hasSubParams(z+ne)){const te=O.getSubParams(z+ne);let he=0;do W[1]===5&&(Z=1),W[ne+he+1+Z]=te[he];while(++he<te.length&&he+ne+1+Z<W.length);break}if(W[1]===5&&ne+Z>=2||W[1]===2&&ne+Z>=5)break;W[1]&&(Z=1)}while(++ne+z<O.length&&ne+Z<W.length);for(let te=2;te<W.length;++te)W[te]===-1&&(W[te]=0);switch(W[0]){case 38:j.fg=this._updateAttrColor(j.fg,W[1],W[3],W[4],W[5]);break;case 48:j.bg=this._updateAttrColor(j.bg,W[1],W[3],W[4],W[5]);break;case 58:j.extended=j.extended.clone(),j.extended.underlineColor=this._updateAttrColor(j.extended.underlineColor,W[1],W[3],W[4],W[5])}return ne}_processUnderline(O,z){z.extended=z.extended.clone(),(!~O||O>5)&&(O=1),z.extended.underlineStyle=O,z.fg|=268435456,O===0&&(z.fg&=-268435457),z.updateExtended()}_processSGR0(O){O.fg=_.DEFAULT_ATTR_DATA.fg,O.bg=_.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const z=O.length;let j;const W=this._curAttrData;for(let Z=0;Z<z;Z++)j=O.params[Z],j>=30&&j<=37?(W.fg&=-50331904,W.fg|=16777216|j-30):j>=40&&j<=47?(W.bg&=-50331904,W.bg|=16777216|j-40):j>=90&&j<=97?(W.fg&=-50331904,W.fg|=16777224|j-90):j>=100&&j<=107?(W.bg&=-50331904,W.bg|=16777224|j-100):j===0?this._processSGR0(W):j===1?W.fg|=134217728:j===3?W.bg|=67108864:j===4?(W.fg|=268435456,this._processUnderline(O.hasSubParams(Z)?O.getSubParams(Z)[0]:1,W)):j===5?W.fg|=536870912:j===7?W.fg|=67108864:j===8?W.fg|=1073741824:j===9?W.fg|=2147483648:j===2?W.bg|=134217728:j===21?this._processUnderline(2,W):j===22?(W.fg&=-134217729,W.bg&=-134217729):j===23?W.bg&=-67108865:j===24?(W.fg&=-268435457,this._processUnderline(0,W)):j===25?W.fg&=-536870913:j===27?W.fg&=-67108865:j===28?W.fg&=-1073741825:j===29?W.fg&=2147483647:j===39?(W.fg&=-67108864,W.fg|=16777215&_.DEFAULT_ATTR_DATA.fg):j===49?(W.bg&=-67108864,W.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?Z+=this._extractColor(O,Z,W):j===53?W.bg|=1073741824:j===55?W.bg&=-1073741825:j===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):j===100?(W.fg&=-67108864,W.fg|=16777215&_.DEFAULT_ATTR_DATA.fg,W.bg&=-67108864,W.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const z=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${z};${j}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const z=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${z};${j}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=_.DEFAULT_ATTR_DATA.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(O){const z=O.params[0]||1;switch(z){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const j=z%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(O){const z=O.params[0]||1;let j;return(O.length<2||(j=O.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>z&&(this._activeBuffer.scrollTop=z-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(O){if(!q(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const z=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:z!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:z!==0&&z!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),z!==0&&z!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:z!==0&&z!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),z!==0&&z!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const z=[],j=O.split(";");for(;j.length>1;){const W=j.shift(),Z=j.shift();if(/^\d+$/.exec(W)){const ne=parseInt(W);if(K(ne))if(Z==="?")z.push({type:0,index:ne});else{const te=(0,I.parseColor)(Z);te&&z.push({type:1,index:ne,color:te})}}}return z.length&&this._onColor.fire(z),!0}setHyperlink(O){const z=O.split(";");return!(z.length<2)&&(z[1]?this._createHyperlink(z[0],z[1]):!z[0]&&this._finishHyperlink())}_createHyperlink(O,z){this._getCurrentLinkId()&&this._finishHyperlink();const j=O.split(":");let W;const Z=j.findIndex((ne=>ne.startsWith("id=")));return Z!==-1&&(W=j[Z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:W,uri:z}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,z){const j=O.split(";");for(let W=0;W<j.length&&!(z>=this._specialColors.length);++W,++z)if(j[W]==="?")this._onColor.fire([{type:0,index:this._specialColors[z]}]);else{const Z=(0,I.parseColor)(j[W]);Z&&this._onColor.fire([{type:1,index:this._specialColors[z],color:Z}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const z=[],j=O.split(";");for(let W=0;W<j.length;++W)if(/^\d+$/.exec(j[W])){const Z=parseInt(j[W]);K(Z)&&z.push({type:2,index:Z})}return z.length&&this._onColor.fire(z),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){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,S.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset($[O[0]],S.CHARSETS[O[1]]||S.DEFAULT_CHARSET),!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){const O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new y.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let z=0;z<this._bufferService.rows;++z){const j=this._activeBuffer.ybase+this._activeBuffer.y+z,W=this._activeBuffer.lines.get(j);W&&(W.fill(O),W.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,z){const j=this._bufferService.buffer,W=this._optionsService.rawOptions;return(Z=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${Z}${m.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[W.cursorStyle]-(W.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,z){this._dirtyRowTracker.markRangeDirty(O,z)}}c.InputHandler=G;let P=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,O){V>O&&(Y=V,V=O,O=Y),V<this.start&&(this.start=V),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(V){return 0<=V&&V<256}P=p([g(0,M.IBufferService)],P)},844:(f,c)=>{function h(p){for(const g of p)g.dispose();p.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const p of this._disposables)p.dispose();this._disposables.length=0}register(p){return this._disposables.push(p),p}unregister(p){const g=this._disposables.indexOf(p);g!==-1&&this._disposables.splice(g,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(p){this._isDisposed||p===this._value||(this._value?.dispose(),this._value=p)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},c.toDisposable=function(p){return{dispose:p}},c.disposeArray=h,c.getDisposeArrayDisposable=function(p){return{dispose:()=>h(p)}}},1505:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(g,m,S){this._data[g]||(this._data[g]={}),this._data[g][m]=S}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(p,g,m,S,w){this._data.get(p,g)||this._data.set(p,g,new h),this._data.get(p,g).set(m,S,w)}get(p,g,m,S){return this._data.get(p,g)?.get(m,S)}clear(){this._data.clear()}}},6114:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const h=c.isNode?"node":navigator.userAgent,p=c.isNode?"node":navigator.platform;c.isFirefox=h.includes("Firefox"),c.isLegacyEdge=h.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(h),c.getSafariVersion=function(){if(!c.isSafari)return 0;const g=h.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(p),c.isIpad=p==="iPad",c.isIphone=p==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(p),c.isLinux=p.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(h)},6106:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let h=0;c.SortedList=class{constructor(p){this._getKey=p,this._array=[]}clear(){this._array.length=0}insert(p){this._array.length!==0?(h=this._search(this._getKey(p)),this._array.splice(h,0,p)):this._array.push(p)}delete(p){if(this._array.length===0)return!1;const g=this._getKey(p);if(g===void 0||(h=this._search(g),h===-1)||this._getKey(this._array[h])!==g)return!1;do if(this._array[h]===p)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===g);return!1}*getKeyIterator(p){if(this._array.length!==0&&(h=this._search(p),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===p))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===p)}forEachByKey(p,g){if(this._array.length!==0&&(h=this._search(p),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===p))do g(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===p)}values(){return[...this._array].values()}_search(p){let g=0,m=this._array.length-1;for(;m>=g;){let S=g+m>>1;const w=this._getKey(this._array[S]);if(w>p)m=S-1;else{if(!(w<p)){for(;S>0&&this._getKey(this._array[S-1])===p;)S--;return S}g=S+1}}return g}}},7226:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const p=h(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let T=0,C=0,_=w.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(T=Date.now(),this._tasks[this._i]()||this._i++,T=Math.max(1,Date.now()-T),C=Math.max(T,C),b=w.timeRemaining(),1.5*C>b)return _-T<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(_-T))}ms`),void this._start();_=b}this.clear()}}class m extends g{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const T=Date.now()+w;return{timeRemaining:()=>Math.max(0,T-Date.now())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const p=h(643);c.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),S=m?.get(g.cols-1),w=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);w&&S&&(w.isWrapped=S[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&S[p.CHAR_DATA_CODE_INDEX]!==p.WHITESPACE_CELL_CODE)}},3734:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new p}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new h;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}c.AttributeData=h;class p{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,S=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=S}clone(){return new p(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=p},9092:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const p=h(6349),g=h(7226),m=h(3734),S=h(8437),w=h(4634),T=h(511),C=h(643),_=h(4863),b=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(v,y,k){this._hasScrollback=v,this._optionsService=y,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,y){return new S.BufferLine(this._bufferService.cols,this.getNullCell(v),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const y=v+this._optionsService.rawOptions.scrollback;return y>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:y}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=S.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,y){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let M=0;const R=this._getCorrectBufferLength(y);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<v)for(let A=0;A<this.lines.length;A++)M+=+this.lines.get(A).resize(v,k);let N=0;if(this._rows<y)for(let A=this._rows;A<y;A++)this.lines.length<y+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new S.BufferLine(v,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+N+1?(this.ybase--,N++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(v,k)));else for(let A=this._rows;A>y;A--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const A=this.lines.length-R;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=R}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,y-1),N&&(this.y+=N),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(v,y),this._cols>v))for(let N=0;N<this.lines.length;N++)M+=+this.lines.get(N).resize(v,k);this._cols=v,this._rows=y,this._memoryCleanupQueue.clear(),M>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let y=0;for(;this._memoryCleanupPosition<this.lines.length;)if(y+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),y>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,y){this._cols!==v&&(v>this._cols?this._reflowLarger(v,y):this._reflowSmaller(v,y))}_reflowLarger(v,y){const k=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const M=(0,w.reflowLargerCreateNewLayout)(this.lines,k);(0,w.reflowLargerApplyNewLayout)(this.lines,M.layout),this._reflowLargerAdjustViewport(v,y,M.countRemoved)}}_reflowLargerAdjustViewport(v,y,k){const M=this.getNullCell(S.DEFAULT_ATTR_DATA);let R=k;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<y&&this.lines.push(new S.BufferLine(v,M))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(v,y){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),M=[];let R=0;for(let N=this.lines.length-1;N>=0;N--){let A=this.lines.get(N);if(!A||!A.isWrapped&&A.getTrimmedLength()<=v)continue;const I=[A];for(;A.isWrapped&&N>0;)A=this.lines.get(--N),I.unshift(A);const $=this.ybase+this.y;if($>=N&&$<N+I.length)continue;const H=I[I.length-1].getTrimmedLength(),q=(0,w.reflowSmallerGetNewLineLengths)(I,this._cols,v),B=q.length-I.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const G=[];for(let j=0;j<B;j++){const W=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);G.push(W)}G.length>0&&(M.push({start:N+I.length+R,newLines:G}),R+=G.length),I.push(...G);let P=q.length-1,K=q[P];K===0&&(P--,K=q[P]);let V=I.length-B-1,O=H;for(;V>=0;){const j=Math.min(O,K);if(I[P]===void 0)break;if(I[P].copyCellsFrom(I[V],O-j,K-j,j,!0),K-=j,K===0&&(P--,K=q[P]),O-=j,O===0){V--;const W=Math.max(V,0);O=(0,w.getWrappedLineTrimmedLength)(I,W,this._cols)}}for(let j=0;j<I.length;j++)q[j]<v&&I[j].setCell(q[j],k);let z=B-Y;for(;z-- >0;)this.ybase===0?this.y<y-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+R)-y&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+y-1)}if(M.length>0){const N=[],A=[];for(let P=0;P<this.lines.length;P++)A.push(this.lines.get(P));const I=this.lines.length;let $=I-1,H=0,q=M[H];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let B=0;for(let P=Math.min(this.lines.maxLength-1,I+R-1);P>=0;P--)if(q&&q.start>$+B){for(let K=q.newLines.length-1;K>=0;K--)this.lines.set(P--,q.newLines[K]);P++,N.push({index:$+1,amount:q.newLines.length}),B+=q.newLines.length,q=M[++H]}else this.lines.set(P,A[$--]);let Y=0;for(let P=N.length-1;P>=0;P--)N[P].index+=Y,this.lines.onInsertEmitter.fire(N[P]),Y+=N[P].amount;const G=Math.max(0,I+R-this.lines.maxLength);G>0&&this.lines.onTrimEmitter.fire(G)}}translateBufferLineToString(v,y,k=0,M){const R=this.lines.get(v);return R?R.translateToString(y,k,M):""}getWrappedRangeForLine(v){let y=v,k=v;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:y,last:k}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].line===v&&(this.markers[y].dispose(),this.markers.splice(y--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const y=new _.Marker(v);return this.markers.push(y),y.register(this.lines.onTrim((k=>{y.line-=k,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((k=>{y.line>=k.index&&(y.line+=k.amount)}))),y.register(this.lines.onDelete((k=>{y.line>=k.index&&y.line<k.index+k.amount&&y.dispose(),y.line>k.index&&(y.line-=k.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const p=h(3734),g=h(511),m=h(643),S=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let w=0;class T{constructor(_,b,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*_);const y=b||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let k=0;k<_;++k)this.setCell(k,y);this.length=_}get(_){const b=this._data[3*_+0],v=2097151&b;return[this._data[3*_+1],2097152&b?this._combined[_]:v?(0,S.stringFromCodePoint)(v):"",b>>22,2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):v]}set(_,b){this._data[3*_+1]=b[m.CHAR_DATA_ATTR_INDEX],b[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[_]=b[1],this._data[3*_+0]=2097152|_|b[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*_+0]=b[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(_){return this._data[3*_+0]>>22}hasWidth(_){return 12582912&this._data[3*_+0]}getFg(_){return this._data[3*_+1]}getBg(_){return this._data[3*_+2]}hasContent(_){return 4194303&this._data[3*_+0]}getCodePoint(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):2097151&b}isCombined(_){return 2097152&this._data[3*_+0]}getString(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_]:2097151&b?(0,S.stringFromCodePoint)(2097151&b):""}isProtected(_){return 536870912&this._data[3*_+2]}loadCell(_,b){return w=3*_,b.content=this._data[w+0],b.fg=this._data[w+1],b.bg=this._data[w+2],2097152&b.content&&(b.combinedData=this._combined[_]),268435456&b.bg&&(b.extended=this._extendedAttrs[_]),b}setCell(_,b){2097152&b.content&&(this._combined[_]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[_]=b.extended),this._data[3*_+0]=b.content,this._data[3*_+1]=b.fg,this._data[3*_+2]=b.bg}setCellFromCodepoint(_,b,v,y){268435456&y.bg&&(this._extendedAttrs[_]=y.extended),this._data[3*_+0]=b|v<<22,this._data[3*_+1]=y.fg,this._data[3*_+2]=y.bg}addCodepointToCell(_,b,v){let y=this._data[3*_+0];2097152&y?this._combined[_]+=(0,S.stringFromCodePoint)(b):2097151&y?(this._combined[_]=(0,S.stringFromCodePoint)(2097151&y)+(0,S.stringFromCodePoint)(b),y&=-2097152,y|=2097152):y=b|4194304,v&&(y&=-12582913,y|=v<<22),this._data[3*_+0]=y}insertCells(_,b,v){if((_%=this.length)&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,v),b<this.length-_){const y=new g.CellData;for(let k=this.length-_-b-1;k>=0;--k)this.setCell(_+b+k,this.loadCell(_+k,y));for(let k=0;k<b;++k)this.setCell(_+k,v)}else for(let y=_;y<this.length;++y)this.setCell(y,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(_,b,v){if(_%=this.length,b<this.length-_){const y=new g.CellData;for(let k=0;k<this.length-_-b;++k)this.setCell(_+k,this.loadCell(_+b+k,y));for(let k=this.length-b;k<this.length;++k)this.setCell(k,v)}else for(let y=_;y<this.length;++y)this.setCell(y,v);_&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,v),this.getWidth(_)!==0||this.hasContent(_)||this.setCellFromCodepoint(_,0,1,v)}replaceCells(_,b,v,y=!1){if(y)for(_&&this.getWidth(_-1)===2&&!this.isProtected(_-1)&&this.setCellFromCodepoint(_-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,v);_<b&&_<this.length;)this.isProtected(_)||this.setCell(_,v),_++;else for(_&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,v);_<b&&_<this.length;)this.setCell(_++,v)}resize(_,b){if(_===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*_;if(_>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const y=new Uint32Array(v);y.set(this._data),this._data=y}for(let y=this.length;y<_;++y)this.setCell(y,b)}else{this._data=this._data.subarray(0,v);const y=Object.keys(this._combined);for(let M=0;M<y.length;M++){const R=parseInt(y[M],10);R>=_&&delete this._combined[R]}const k=Object.keys(this._extendedAttrs);for(let M=0;M<k.length;M++){const R=parseInt(k[M],10);R>=_&&delete this._extendedAttrs[R]}}return this.length=_,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const _=new Uint32Array(this._data.length);return _.set(this._data),this._data=_,1}return 0}fill(_,b=!1){if(b)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,_);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,_)}}copyFrom(_){this.length!==_.length?this._data=new Uint32Array(_._data):this._data.set(_._data),this.length=_.length,this._combined={};for(const b in _._combined)this._combined[b]=_._combined[b];this._extendedAttrs={};for(const b in _._extendedAttrs)this._extendedAttrs[b]=_._extendedAttrs[b];this.isWrapped=_.isWrapped}clone(){const _=new T(0);_._data=new Uint32Array(this._data),_.length=this.length;for(const b in this._combined)_._combined[b]=this._combined[b];for(const b in this._extendedAttrs)_._extendedAttrs[b]=this._extendedAttrs[b];return _.isWrapped=this.isWrapped,_}getTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0])return _+(this._data[3*_+0]>>22);return 0}getNoBgTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0]||50331648&this._data[3*_+2])return _+(this._data[3*_+0]>>22);return 0}copyCellsFrom(_,b,v,y,k){const M=_._data;if(k)for(let N=y-1;N>=0;N--){for(let A=0;A<3;A++)this._data[3*(v+N)+A]=M[3*(b+N)+A];268435456&M[3*(b+N)+2]&&(this._extendedAttrs[v+N]=_._extendedAttrs[b+N])}else for(let N=0;N<y;N++){for(let A=0;A<3;A++)this._data[3*(v+N)+A]=M[3*(b+N)+A];268435456&M[3*(b+N)+2]&&(this._extendedAttrs[v+N]=_._extendedAttrs[b+N])}const R=Object.keys(_._combined);for(let N=0;N<R.length;N++){const A=parseInt(R[N],10);A>=b&&(this._combined[A-b+v]=_._combined[A])}}translateToString(_,b,v,y){b=b??0,v=v??this.length,_&&(v=Math.min(v,this.getTrimmedLength())),y&&(y.length=0);let k="";for(;b<v;){const M=this._data[3*b+0],R=2097151&M,N=2097152&M?this._combined[b]:R?(0,S.stringFromCodePoint)(R):m.WHITESPACE_CELL_CHAR;if(k+=N,y)for(let A=0;A<N.length;++A)y.push(b);b+=M>>22||1}return y&&y.push(b),k}}c.BufferLine=T},4841:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(h,p){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return p*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(f,c)=>{function h(p,g,m){if(g===p.length-1)return p[g].getTrimmedLength();const S=!p[g].hasContent(m-1)&&p[g].getWidth(m-1)===1,w=p[g+1].getWidth(0)===2;return S&&w?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(p,g,m,S,w){const T=[];for(let C=0;C<p.length-1;C++){let _=C,b=p.get(++_);if(!b.isWrapped)continue;const v=[p.get(C)];for(;_<p.length&&b.isWrapped;)v.push(b),b=p.get(++_);if(S>=C&&S<_){C+=v.length-1;continue}let y=0,k=h(v,y,g),M=1,R=0;for(;M<v.length;){const A=h(v,M,g),I=A-R,$=m-k,H=Math.min(I,$);v[y].copyCellsFrom(v[M],R,k,H,!1),k+=H,k===m&&(y++,k=0),R+=H,R===A&&(M++,R=0),k===0&&y!==0&&v[y-1].getWidth(m-1)===2&&(v[y].copyCellsFrom(v[y-1],m-1,k++,1,!1),v[y-1].setCell(m-1,w))}v[y].replaceCells(k,m,w);let N=0;for(let A=v.length-1;A>0&&(A>y||v[A].getTrimmedLength()===0);A--)N++;N>0&&(T.push(C+v.length-N),T.push(N)),C+=v.length-1}return T},c.reflowLargerCreateNewLayout=function(p,g){const m=[];let S=0,w=g[S],T=0;for(let C=0;C<p.length;C++)if(w===C){const _=g[++S];p.onDeleteEmitter.fire({index:C-T,amount:_}),C+=_-1,T+=_,w=g[++S]}else m.push(C);return{layout:m,countRemoved:T}},c.reflowLargerApplyNewLayout=function(p,g){const m=[];for(let S=0;S<g.length;S++)m.push(p.get(g[S]));for(let S=0;S<m.length;S++)p.set(S,m[S]);p.length=g.length},c.reflowSmallerGetNewLineLengths=function(p,g,m){const S=[],w=p.map(((b,v)=>h(p,v,g))).reduce(((b,v)=>b+v));let T=0,C=0,_=0;for(;_<w;){if(w-_<m){S.push(w-_);break}T+=m;const b=h(p,C,g);T>b&&(T-=b,C++);const v=p[C].getWidth(T-1)===2;v&&T--;const y=v?m-1:m;S.push(y),_+=y}return S},c.getWrappedLineTrimmedLength=h},5295:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const p=h(8460),g=h(844),m=h(9092);class S extends g.Disposable{constructor(T,C){super(),this._optionsService=T,this._bufferService=C,this._onBufferActivate=this.register(new p.EventEmitter),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 m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!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(T){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(T),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(T,C){this._normal.resize(T,C),this._alt.resize(T,C),this.setupTabStops(T)}setupTabStops(T){this._normal.setupTabStops(T),this._alt.setupTabStops(T)}}c.BufferSet=S},511:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const p=h(482),g=h(643),m=h(3734);class S extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(T){const C=new S;return C.setFromCharData(T),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,p.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(T){this.fg=T[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(T[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(T[g.CHAR_DATA_CHAR_INDEX].length===2){const _=T[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=_&&_<=56319){const b=T[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(_-55296)+b-56320+65536|T[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=T[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=T[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=S},643:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const p=h(8460),g=h(844);class m{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}c.Marker=m,m._nextId=1},7116:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(f,c)=>{var h,p,g;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
81
+ `,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(h||(c.C0=h={})),(function(m){m.PAD="€",m.HOP="",m.BPH="‚",m.NBH="ƒ",m.IND="„",m.NEL="…",m.SSA="†",m.ESA="‡",m.HTS="ˆ",m.HTJ="‰",m.VTS="Š",m.PLD="‹",m.PLU="Œ",m.RI="",m.SS2="Ž",m.SS3="",m.DCS="",m.PU1="‘",m.PU2="’",m.STS="“",m.CCH="”",m.MW="•",m.SPA="–",m.EPA="—",m.SOS="˜",m.SGCI="™",m.SCI="š",m.CSI="›",m.ST="œ",m.OSC="",m.PM="ž",m.APC="Ÿ"})(p||(c.C1=p={})),(function(m){m.ST=`${h.ESC}\\`})(g||(c.C1_ESCAPED=g={}))},7399:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const p=h(2584),g={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:["'",'"']};c.evaluateKeyboardEvent=function(m,S,w,T){const C={type:0,cancel:!1,key:void 0},_=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?C.key=S?p.C0.ESC+"OA":p.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=S?p.C0.ESC+"OD":p.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=S?p.C0.ESC+"OC":p.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=S?p.C0.ESC+"OB":p.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":p.C0.DEL,m.altKey&&(C.key=p.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=p.C0.ESC+"[Z";break}C.key=p.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?p.C0.ESC+p.C0.CR:p.C0.CR,C.cancel=!0;break;case 27:C.key=p.C0.ESC,m.altKey&&(C.key=p.C0.ESC+p.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;_?(C.key=p.C0.ESC+"[1;"+(_+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(w?"b":"[1;5D"))):C.key=S?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(m.metaKey)break;_?(C.key=p.C0.ESC+"[1;"+(_+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(w?"f":"[1;5C"))):C.key=S?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(m.metaKey)break;_?(C.key=p.C0.ESC+"[1;"+(_+1)+"A",w||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=S?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(m.metaKey)break;_?(C.key=p.C0.ESC+"[1;"+(_+1)+"B",w||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=S?p.C0.ESC+"OB":p.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=p.C0.ESC+"[2~");break;case 46:C.key=_?p.C0.ESC+"[3;"+(_+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=_?p.C0.ESC+"[1;"+(_+1)+"H":S?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=_?p.C0.ESC+"[1;"+(_+1)+"F":S?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=p.C0.ESC+"[5;"+(_+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=p.C0.ESC+"[6;"+(_+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=_?p.C0.ESC+"[1;"+(_+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=_?p.C0.ESC+"[1;"+(_+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=_?p.C0.ESC+"[1;"+(_+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=_?p.C0.ESC+"[1;"+(_+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=_?p.C0.ESC+"[15;"+(_+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=_?p.C0.ESC+"[17;"+(_+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=_?p.C0.ESC+"[18;"+(_+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=_?p.C0.ESC+"[19;"+(_+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=_?p.C0.ESC+"[20;"+(_+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=_?p.C0.ESC+"[21;"+(_+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=_?p.C0.ESC+"[23;"+(_+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=_?p.C0.ESC+"[24;"+(_+1)+"~":p.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(w&&!T||!m.altKey||m.metaKey)!w||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?C.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(C.key=p.C0.US),m.key==="@"&&(C.key=p.C0.NUL)):m.keyCode===65&&(C.type=1);else{const b=g[m.keyCode],v=b?.[m.shiftKey?1:0];if(v)C.key=p.C0.ESC+v;else if(m.keyCode>=65&&m.keyCode<=90){const y=m.ctrlKey?m.keyCode-64:m.keyCode+32;let k=String.fromCharCode(y);m.shiftKey&&(k=k.toUpperCase()),C.key=p.C0.ESC+k}else if(m.keyCode===32)C.key=p.C0.ESC+(m.ctrlKey?p.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let y=m.code.slice(3,4);m.shiftKey||(y=y.toLowerCase()),C.key=p.C0.ESC+y,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=p.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=p.C0.DEL:m.keyCode===219?C.key=p.C0.ESC:m.keyCode===220?C.key=p.C0.FS:m.keyCode===221&&(C.key=p.C0.GS)}return C}},482:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},c.utf32ToString=function(h,p=0,g=h.length){let m="";for(let S=p;S<g;++S){let w=h[S];w>65535?(w-=65536,m+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):m+=String.fromCharCode(w)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,p){const g=h.length;if(!g)return 0;let m=0,S=0;if(this._interim){const w=h.charCodeAt(S++);56320<=w&&w<=57343?p[m++]=1024*(this._interim-55296)+w-56320+65536:(p[m++]=this._interim,p[m++]=w),this._interim=0}for(let w=S;w<g;++w){const T=h.charCodeAt(w);if(55296<=T&&T<=56319){if(++w>=g)return this._interim=T,m;const C=h.charCodeAt(w);56320<=C&&C<=57343?p[m++]=1024*(T-55296)+C-56320+65536:(p[m++]=T,p[m++]=C)}else T!==65279&&(p[m++]=T)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,p){const g=h.length;if(!g)return 0;let m,S,w,T,C=0,_=0,b=0;if(this.interim[0]){let k=!1,M=this.interim[0];M&=(224&M)==192?31:(240&M)==224?15:7;let R,N=0;for(;(R=63&this.interim[++N])&&N<4;)M<<=6,M|=R;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=A-N;for(;b<I;){if(b>=g)return 0;if(R=h[b++],(192&R)!=128){b--,k=!0;break}this.interim[N++]=R,M<<=6,M|=63&R}k||(A===2?M<128?b--:p[C++]=M:A===3?M<2048||M>=55296&&M<=57343||M===65279||(p[C++]=M):M<65536||M>1114111||(p[C++]=M)),this.interim.fill(0)}const v=g-4;let y=b;for(;y<g;){for(;!(!(y<v)||128&(m=h[y])||128&(S=h[y+1])||128&(w=h[y+2])||128&(T=h[y+3]));)p[C++]=m,p[C++]=S,p[C++]=w,p[C++]=T,y+=4;if(m=h[y++],m<128)p[C++]=m;else if((224&m)==192){if(y>=g)return this.interim[0]=m,C;if(S=h[y++],(192&S)!=128){y--;continue}if(_=(31&m)<<6|63&S,_<128){y--;continue}p[C++]=_}else if((240&m)==224){if(y>=g)return this.interim[0]=m,C;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=S,C;if(w=h[y++],(192&w)!=128){y--;continue}if(_=(15&m)<<12|(63&S)<<6|63&w,_<2048||_>=55296&&_<=57343||_===65279)continue;p[C++]=_}else if((248&m)==240){if(y>=g)return this.interim[0]=m,C;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=S,C;if(w=h[y++],(192&w)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=S,this.interim[2]=w,C;if(T=h[y++],(192&T)!=128){y--;continue}if(_=(7&m)<<18|(63&S)<<12|(63&w)<<6|63&T,_<65536||_>1114111)continue;p[C++]=_}}return C}}},225:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const p=h(1480),g=[[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]],m=[[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]];let S;c.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let w=0;w<g.length;++w)S.fill(0,g[w][0],g[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?S[w]:(function(T,C){let _,b=0,v=C.length-1;if(T<C[0][0]||T>C[v][1])return!1;for(;v>=b;)if(_=b+v>>1,T>C[_][1])b=_+1;else{if(!(T<C[_][0]))return!0;v=_-1}return!1})(w,m)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,T){let C=this.wcwidth(w),_=C===0&&T!==0;if(_){const b=p.UnicodeService.extractWidth(T);b===0?_=!1:b>C&&(C=b)}return p.UnicodeService.createPropertyValue(0,C,_)}}},5981:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const p=h(8460),g=h(844);class m extends g.Disposable{constructor(w){super(),this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new p.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(w,T){if(T!==void 0&&this._syncCalls>T)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const _=this._callbacks.shift();_&&_()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,T){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(T),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(T)}_innerWrite(w=0,T=!0){const C=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const _=this._writeBuffer[this._bufferOffset],b=this._action(_,T);if(b){const y=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(y)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=_.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}c.WriteBuffer=m},5941:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const h=/^([\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})$/,p=/^[\da-f]+$/;function g(m,S){const w=m.toString(16),T=w.length<2?"0"+w:w;switch(S){case 4:return w[0];case 8:return T;case 12:return(T+T).slice(0,3);default:return T+T}}c.parseColor=function(m){if(!m)return;let S=m.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const w=h.exec(S);if(w){const T=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/T*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/T*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/T*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),p.exec(S)&&[3,6,9,12].includes(S.length))){const w=S.length/3,T=[0,0,0];for(let C=0;C<3;++C){const _=parseInt(S.slice(w*C,w*C+w),16);T[C]=w===1?_<<4:w===2?_:w===3?_>>4:_>>8}return T}},c.toRgbString=function(m,S=16){const[w,T,C]=m;return`rgb:${g(w,S)}/${g(T,S)}/${g(C,S)}`}},5770:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const p=h(482),g=h(8742),m=h(5770),S=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(T,C){this._handlers[T]===void 0&&(this._handlers[T]=[]);const _=this._handlers[T];return _.push(C),{dispose:()=>{const b=_.indexOf(C);b!==-1&&_.splice(b,1)}}}clearHandler(T){this._handlers[T]&&delete this._handlers[T]}setHandlerFallback(T){this._handlerFb=T}reset(){if(this._active.length)for(let T=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;T>=0;--T)this._active[T].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(T,C){if(this.reset(),this._ident=T,this._active=this._handlers[T]||S,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(T,C,_){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(T,C,_);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(T,C,_))}unhook(T,C=!0){if(this._active.length){let _=!1,b=this._active.length-1,v=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,_=C,v=this._stack.fallThrough,this._stack.paused=!1),!v&&_===!1){for(;b>=0&&(_=this._active[b].unhook(T),_!==!0);b--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,_;b--}for(;b>=0;b--)if(_=this._active[b].unhook(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,_}else this._handlerFb(this._ident,"UNHOOK",T);this._active=S,this._ident=0}};const w=new g.Params;w.addParam(0),c.DcsHandler=class{constructor(T){this._handler=T,this._data="",this._params=w,this._hitLimit=!1}hook(T){this._params=T.length>1||T.params[0]?T.clone():w,this._data="",this._hitLimit=!1}put(T,C,_){this._hitLimit||(this._data+=(0,p.utf32ToString)(T,C,_),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(T){let C=!1;if(this._hitLimit)C=!1;else if(T&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((_=>(this._params=w,this._data="",this._hitLimit=!1,_)));return this._params=w,this._data="",this._hitLimit=!1,C}}},2015:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const p=h(844),g=h(8742),m=h(6242),S=h(6351);class w{constructor(b){this.table=new Uint8Array(b)}setDefault(b,v){this.table.fill(b<<4|v)}add(b,v,y,k){this.table[v<<8|b]=y<<4|k}addMany(b,v,y,k){for(let M=0;M<b.length;M++)this.table[v<<8|b[M]]=y<<4|k}}c.TransitionTable=w;const T=160;c.VT500_TRANSITION_TABLE=(function(){const _=new w(4095),b=Array.apply(null,Array(256)).map(((N,A)=>A)),v=(N,A)=>b.slice(N,A),y=v(32,127),k=v(0,24);k.push(25),k.push.apply(k,v(28,32));const M=v(0,14);let R;for(R in _.setDefault(1,0),_.addMany(y,0,2,0),M)_.addMany([24,26,153,154],R,3,0),_.addMany(v(128,144),R,3,0),_.addMany(v(144,152),R,3,0),_.add(156,R,0,0),_.add(27,R,11,1),_.add(157,R,4,8),_.addMany([152,158,159],R,0,7),_.add(155,R,11,3),_.add(144,R,11,9);return _.addMany(k,0,3,0),_.addMany(k,1,3,1),_.add(127,1,0,1),_.addMany(k,8,0,8),_.addMany(k,3,3,3),_.add(127,3,0,3),_.addMany(k,4,3,4),_.add(127,4,0,4),_.addMany(k,6,3,6),_.addMany(k,5,3,5),_.add(127,5,0,5),_.addMany(k,2,3,2),_.add(127,2,0,2),_.add(93,1,4,8),_.addMany(y,8,5,8),_.add(127,8,5,8),_.addMany([156,27,24,26,7],8,6,0),_.addMany(v(28,32),8,0,8),_.addMany([88,94,95],1,0,7),_.addMany(y,7,0,7),_.addMany(k,7,0,7),_.add(156,7,0,0),_.add(127,7,0,7),_.add(91,1,11,3),_.addMany(v(64,127),3,7,0),_.addMany(v(48,60),3,8,4),_.addMany([60,61,62,63],3,9,4),_.addMany(v(48,60),4,8,4),_.addMany(v(64,127),4,7,0),_.addMany([60,61,62,63],4,0,6),_.addMany(v(32,64),6,0,6),_.add(127,6,0,6),_.addMany(v(64,127),6,0,0),_.addMany(v(32,48),3,9,5),_.addMany(v(32,48),5,9,5),_.addMany(v(48,64),5,0,6),_.addMany(v(64,127),5,7,0),_.addMany(v(32,48),4,9,5),_.addMany(v(32,48),1,9,2),_.addMany(v(32,48),2,9,2),_.addMany(v(48,127),2,10,0),_.addMany(v(48,80),1,10,0),_.addMany(v(81,88),1,10,0),_.addMany([89,90,92],1,10,0),_.addMany(v(96,127),1,10,0),_.add(80,1,11,9),_.addMany(k,9,0,9),_.add(127,9,0,9),_.addMany(v(28,32),9,0,9),_.addMany(v(32,48),9,9,12),_.addMany(v(48,60),9,8,10),_.addMany([60,61,62,63],9,9,10),_.addMany(k,11,0,11),_.addMany(v(32,128),11,0,11),_.addMany(v(28,32),11,0,11),_.addMany(k,10,0,10),_.add(127,10,0,10),_.addMany(v(28,32),10,0,10),_.addMany(v(48,60),10,8,10),_.addMany([60,61,62,63],10,0,11),_.addMany(v(32,48),10,9,12),_.addMany(k,12,0,12),_.add(127,12,0,12),_.addMany(v(28,32),12,0,12),_.addMany(v(32,48),12,9,12),_.addMany(v(48,64),12,0,11),_.addMany(v(64,127),12,12,13),_.addMany(v(64,127),10,12,13),_.addMany(v(64,127),9,12,13),_.addMany(k,13,13,13),_.addMany(y,13,13,13),_.add(127,13,0,13),_.addMany([27,156,24,26],13,14,0),_.add(T,0,2,0),_.add(T,8,5,8),_.add(T,6,0,6),_.add(T,11,0,11),_.add(T,13,13,13),_})();class C extends p.Disposable{constructor(b=c.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,y,k)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,y)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,p.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,v=[64,126]){let y=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=b.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let M=0;M<b.intermediates.length;++M){const R=b.intermediates.charCodeAt(M);if(32>R||R>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=R}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(v[0]>k||k>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return y<<=8,y|=k,y}identToString(b){const v=[];for(;b;)v.push(String.fromCharCode(255&b)),b>>=8;return v.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,v){const y=this._identifier(b,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const k=this._escHandlers[y];return k.push(v),{dispose:()=>{const M=k.indexOf(v);M!==-1&&k.splice(M,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,v){this._executeHandlers[b.charCodeAt(0)]=v}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,v){const y=this._identifier(b);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const k=this._csiHandlers[y];return k.push(v),{dispose:()=>{const M=k.indexOf(v);M!==-1&&k.splice(M,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,v){return this._dcsParser.registerHandler(this._identifier(b),v)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,v){return this._oscParser.registerHandler(b,v)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}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(b,v,y,k,M){this._parseStack.state=b,this._parseStack.handlers=v,this._parseStack.handlerPos=y,this._parseStack.transition=k,this._parseStack.chunkPos=M}parse(b,v,y){let k,M=0,R=0,N=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,N=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&I>-1){for(;I>=0&&(k=A[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._parseStack.handlerPos=I,k}this._parseStack.handlers=[];break;case 4:if(y===!1&&I>-1){for(;I>=0&&(k=A[I](),k!==!0);I--)if(k instanceof Promise)return this._parseStack.handlerPos=I,k}this._parseStack.handlers=[];break;case 6:if(M=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(M!==24&&M!==26,y),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(M=b[this._parseStack.chunkPos],k=this._oscParser.end(M!==24&&M!==26,y),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,N=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=N;A<v;++A){switch(M=b[A],R=this._transitions.table[this.currentState<<8|(M<160?M:T)],R>>4){case 2:for(let B=A+1;;++B){if(B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,A,B),A=B-1;break}if(++B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,A,B),A=B-1;break}if(++B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,A,B),A=B-1;break}if(++B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,A,B),A=B-1;break}}break;case 3:this._executeHandlers[M]?this._executeHandlers[M]():this._executeHandlerFb(M),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:M,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|M];let $=I?I.length-1:-1;for(;$>=0&&(k=I[$](this._params),k!==!0);$--)if(k instanceof Promise)return this._preserveStack(3,I,$,R,A),k;$<0&&this._csiHandlerFb(this._collect<<8|M,this._params),this.precedingJoinState=0;break;case 8:do switch(M){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(M-48)}while(++A<v&&(M=b[A])>47&&M<60);A--;break;case 9:this._collect<<=8,this._collect|=M;break;case 10:const H=this._escHandlers[this._collect<<8|M];let q=H?H.length-1:-1;for(;q>=0&&(k=H[q](),k!==!0);q--)if(k instanceof Promise)return this._preserveStack(4,H,q,R,A),k;q<0&&this._escHandlerFb(this._collect<<8|M),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|M,this._params);break;case 13:for(let B=A+1;;++B)if(B>=v||(M=b[B])===24||M===26||M===27||M>127&&M<T){this._dcsParser.put(b,A,B),A=B-1;break}break;case 14:if(k=this._dcsParser.unhook(M!==24&&M!==26),k)return this._preserveStack(6,[],0,R,A),k;M===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=A+1;;B++)if(B>=v||(M=b[B])<32||M>127&&M<T){this._oscParser.put(b,A,B),A=B-1;break}break;case 6:if(k=this._oscParser.end(M!==24&&M!==26),k)return this._preserveStack(5,[],0,R,A),k;M===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&R}}}c.EscapeSequenceParser=C},6242:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const p=h(5770),g=h(482),m=[];c.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,w){this._handlers[S]===void 0&&(this._handlers[S]=[]);const T=this._handlers[S];return T.push(w),{dispose:()=>{const C=T.indexOf(w);C!==-1&&T.splice(C,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,w,T){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(S,w,T);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(S,w,T))}start(){this.reset(),this._state=1}put(S,w,T){if(this._state!==3){if(this._state===1)for(;w<T;){const C=S[w++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&T-w>0&&this._put(S,w,T)}}end(S,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let T=!1,C=this._active.length-1,_=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,T=w,_=this._stack.fallThrough,this._stack.paused=!1),!_&&T===!1){for(;C>=0&&(T=this._active[C].end(S),T!==!0);C--)if(T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,T;C--}for(;C>=0;C--)if(T=this._active[C].end(!1),T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,T}else this._handlerFb(this._id,"END",S);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,w,T){this._hitLimit||(this._data+=(0,g.utf32ToString)(S,w,T),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let w=!1;if(this._hitLimit)w=!1;else if(S&&(w=this._handler(this._data),w instanceof Promise))return w.then((T=>(this._data="",this._hitLimit=!1,T)));return this._data="",this._hitLimit=!1,w}}},8742:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const h=2147483647;class p{static fromArray(m){const S=new p;if(!m.length)return S;for(let w=Array.isArray(m[0])?1:0;w<m.length;++w){const T=m[w];if(Array.isArray(T))for(let C=0;C<T.length;++C)S.addSubParam(T[C]);else S.addParam(T)}return S}constructor(m=32,S=32){if(this.maxLength=m,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new p(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let S=0;S<this.length;++S){m.push(this.params[S]);const w=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-w>0&&m.push(Array.prototype.slice.call(this._subParams,w,T))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>h?h:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>h?h:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const S=this._subParamsIdx[m]>>8,w=255&this._subParamsIdx[m];return w-S>0?this._subParams.subarray(S,w):null}getSubParamsAll(){const m={};for(let S=0;S<this.length;++S){const w=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-w>0&&(m[S]=this._subParams.slice(w,T))}return m}addDigit(m){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,T=w[S-1];w[S-1]=~T?Math.min(10*T+m,h):m}}c.Params=p},5741:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,p){const g={instance:p,dispose:p.dispose,isDisposed:!1};this._addons.push(g),p.dispose=()=>this._wrappedAddonDispose(g),p.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let p=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===h){p=g;break}if(p===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(p,1)}}},8771:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const p=h(3785),g=h(511);c.BufferApiView=class{constructor(m,S){this._buffer=m,this.type=S}init(m){return this._buffer=m,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(m){const S=this._buffer.lines.get(m);if(S)return new p.BufferLineApiView(S)}getNullCell(){return new g.CellData}}},3785:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const p=h(511);c.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new p.CellData)}translateToString(g,m,S){return this._line.translateToString(g,m,S)}}},8285:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const p=h(8771),g=h(8460),m=h(844);class S extends m.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new p.BufferApiView(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)}}c.BufferNamespaceApi=S},7975:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,p){return this._core.registerCsiHandler(h,(g=>p(g.toArray())))}addCsiHandler(h,p){return this.registerCsiHandler(h,p)}registerDcsHandler(h,p){return this._core.registerDcsHandler(h,((g,m)=>p(g,m.toArray())))}addDcsHandler(h,p){return this.registerDcsHandler(h,p)}registerEscHandler(h,p){return this._core.registerEscHandler(h,p)}addEscHandler(h,p){return this.registerEscHandler(h,p)}registerOscHandler(h,p){return this._core.registerOscHandler(h,p)}addOscHandler(h,p){return this.registerOscHandler(h,p)}}},7090:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(f,c,h){var p=this&&this.__decorate||function(_,b,v,y){var k,M=arguments.length,R=M<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,b,v,y);else for(var N=_.length-1;N>=0;N--)(k=_[N])&&(R=(M<3?k(R):M>3?k(b,v,R):k(b,v))||R);return M>3&&R&&Object.defineProperty(b,v,R),R},g=this&&this.__param||function(_,b){return function(v,y){b(v,y,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=h(8460),S=h(844),w=h(5295),T=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(_){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(_.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(_.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(_,this))}resize(_,b){this.cols=_,this.rows=b,this.buffers.resize(_,b),this._onResize.fire({cols:_,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(_,b=!1){const v=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===_.fg&&y.getBg(0)===_.bg||(y=v.getBlankLine(_,b),this._cachedBlankLine=y),y.isWrapped=b;const k=v.ybase+v.scrollTop,M=v.ybase+v.scrollBottom;if(v.scrollTop===0){const R=v.lines.isFull;M===v.lines.length-1?R?v.lines.recycle().copyFrom(y):v.lines.push(y.clone()):v.lines.splice(M+1,0,y.clone()),R?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const R=M-k+1;v.lines.shiftElements(k+1,R-1,-1),v.lines.set(M,y.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(_,b,v){const y=this.buffer;if(_<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else _+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const k=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+_,y.ybase),0),k!==y.ydisp&&(b||this._onScroll.fire(y.ydisp))}};c.BufferService=C=p([g(0,T.IOptionsService)],C)},7994:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,p){this._charsets[h]=p,this.glevel===h&&(this.charset=p)}}},1753:function(f,c,h){var p=this&&this.__decorate||function(y,k,M,R){var N,A=arguments.length,I=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,M):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(y,k,M,R);else for(var $=y.length-1;$>=0;$--)(N=y[$])&&(I=(A<3?N(I):A>3?N(k,M,I):N(k,M))||I);return A>3&&I&&Object.defineProperty(k,M,I),I},g=this&&this.__param||function(y,k){return function(M,R){k(M,R,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=h(2585),S=h(8460),w=h(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,k){let M=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(M|=64,M|=y.action):(M|=3&y.button,4&y.button&&(M|=64),8&y.button&&(M|=128),y.action===32?M|=32:y.action!==0||k||(M|=3)),M}const _=String.fromCharCode,b={DEFAULT:y=>{const k=[C(y,!1)+32,y.col+32,y.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${_(k[0])}${_(k[1])}${_(k[2])}`},SGR:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${k}`},SGR_PIXELS:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${k}`}};let v=c.CoreMouseService=class extends w.Disposable{constructor(y,k){super(),this._bufferService=y,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const M of Object.keys(T))this.addProtocol(M,T[M]);for(const M of Object.keys(b))this.addEncoding(M,b[M]);this.reset()}addProtocol(y,k){this._protocols[y]=k}addEncoding(y,k){this._encodings[y]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const k=this._encodings[this._activeEncoding](y);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,k,M){if(M){if(y.x!==k.x||y.y!==k.y)return!1}else if(y.col!==k.col||y.row!==k.row)return!1;return y.button===k.button&&y.action===k.action&&y.ctrl===k.ctrl&&y.alt===k.alt&&y.shift===k.shift}};c.CoreMouseService=v=p([g(0,m.IBufferService),g(1,m.ICoreService)],v)},6975:function(f,c,h){var p=this&&this.__decorate||function(v,y,k,M){var R,N=arguments.length,A=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(y,k,A):R(y,k))||A);return N>3&&A&&Object.defineProperty(y,k,A),A},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=h(1439),S=h(8460),w=h(844),T=h(2585),C=Object.freeze({insertMode:!1}),_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=c.CoreService=class extends w.Disposable{constructor(v,y,k){super(),this._bufferService=v,this._logService=y,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(_)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(_)}triggerDataEvent(v,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((M=>M.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(v))}};c.CoreService=b=p([g(0,T.IBufferService),g(1,T.ILogService),g(2,T.IOptionsService)],b)},9074:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const p=h(8055),g=h(8460),m=h(844),S=h(6106);let w=0,T=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((v=>v?.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const y=new _(v);if(y){const k=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),k.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,y,k){let M=0,R=0;for(const N of this._decorations.getKeyIterator(y))M=N.options.x??0,R=M+(N.options.width??1),v>=M&&v<R&&(!k||(N.options.layer??"bottom")===k)&&(yield N)}forEachDecorationAtCell(v,y,k,M){this._decorations.forEachByKey(y,(R=>{w=R.options.x??0,T=w+(R.options.width??1),v>=w&&v<T&&(!k||(R.options.layer??"bottom")===k)&&M(R)}))}}c.DecorationService=C;class _ extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=p.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=p.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const p=h(2585),g=h(8343);class m{constructor(...w){this._entries=new Map;for(const[T,C]of w)this.set(T,C)}set(w,T){const C=this._entries.get(w);return this._entries.set(w,T),C}forEach(w){for(const[T,C]of this._entries.entries())w(T,C)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(p.IInstantiationService,this)}setService(S,w){this._services.set(S,w)}getService(S){return this._services.get(S)}createInstance(S,...w){const T=(0,g.getServiceDependencies)(S).sort(((b,v)=>b.index-v.index)),C=[];for(const b of T){const v=this._services.get(b.id);if(!v)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);C.push(v)}const _=T.length>0?T[0].index:w.length;if(w.length!==_)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${_+1} conflicts with ${w.length} static arguments`);return new S(...w,...C)}}},7866:function(f,c,h){var p=this&&this.__decorate||function(_,b,v,y){var k,M=arguments.length,R=M<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,b,v,y);else for(var N=_.length-1;N>=0;N--)(k=_[N])&&(R=(M<3?k(R):M>3?k(b,v,R):k(b,v))||R);return M>3&&R&&Object.defineProperty(b,v,R),R},g=this&&this.__param||function(_,b){return function(v,y){b(v,y,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=h(844),S=h(2585),w={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let T,C=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(_){super(),this._optionsService=_,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),T=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(_){for(let b=0;b<_.length;b++)typeof _[b]=="function"&&(_[b]=_[b]())}_log(_,b,v){this._evalLazyOptionalParams(v),_.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...v)}trace(_,...b){this._logLevel<=S.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,_,b)}debug(_,...b){this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,_,b)}info(_,...b){this._logLevel<=S.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,_,b)}warn(_,...b){this._logLevel<=S.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,_,b)}error(_,...b){this._logLevel<=S.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,_,b)}};c.LogService=C=p([g(0,S.IOptionsService)],C),c.setTraceLogger=function(_){T=_},c.traceCall=function(_,b,v){if(typeof v.value!="function")throw new Error("not supported");const y=v.value;v.value=function(...k){if(T.logLevel!==S.LogLevelEnum.TRACE)return y.apply(this,k);T.trace(`GlyphRenderer#${y.name}(${k.map((R=>JSON.stringify(R))).join(", ")})`);const M=y.apply(this,k);return T.trace(`GlyphRenderer#${y.name} return`,M),M}}},7302:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const p=h(8460),g=h(844),m=h(6114);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class w extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;const _={...c.DEFAULT_OPTIONS};for(const b in C)if(b in _)try{const v=C[b];_[b]=this._sanitizeAndValidateOption(b,v)}catch(v){console.error(v)}this.rawOptions=_,this.options={..._},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,_){return this.onOptionChange((b=>{b===C&&_(this.rawOptions[C])}))}onMultipleOptionChange(C,_){return this.onOptionChange((b=>{C.indexOf(b)!==-1&&_()}))}_setupOptions(){const C=b=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},_=(b,v)=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);v=this._sanitizeAndValidateOption(b,v),this.rawOptions[b]!==v&&(this.rawOptions[b]=v,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const v={get:C.bind(this,b),set:_.bind(this,b)};Object.defineProperty(this.options,b,v)}}_sanitizeAndValidateOption(C,_){switch(C){case"cursorStyle":if(_||(_=c.DEFAULT_OPTIONS[C]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(_))throw new Error(`"${_}" is not a valid value for ${C}`);break;case"wordSeparator":_||(_=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof _=="number"&&1<=_&&_<=1e3)break;_=S.includes(_)?_:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":_=Math.floor(_);case"lineHeight":case"tabStopWidth":if(_<1)throw new Error(`${C} cannot be less than 1, value: ${_}`);break;case"minimumContrastRatio":_=Math.max(1,Math.min(21,Math.round(10*_)/10));break;case"scrollback":if((_=Math.min(_,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${_}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(_<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${_}`);break;case"rows":case"cols":if(!_&&_!==0)throw new Error(`${C} must be numeric, value: ${_}`);break;case"windowsPty":_=_??{}}return _}}c.OptionsService=w},2660:function(f,c,h){var p=this&&this.__decorate||function(w,T,C,_){var b,v=arguments.length,y=v<3?T:_===null?_=Object.getOwnPropertyDescriptor(T,C):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(w,T,C,_);else for(var k=w.length-1;k>=0;k--)(b=w[k])&&(y=(v<3?b(y):v>3?b(T,C,y):b(T,C))||y);return v>3&&y&&Object.defineProperty(T,C,y),y},g=this&&this.__param||function(w,T){return function(C,_){T(C,_,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=h(2585);let S=c.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const T=this._bufferService.buffer;if(w.id===void 0){const k=T.addMarker(T.ybase+T.y),M={data:w,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(M,k))),this._dataByLinkId.set(M.id,M),M.id}const C=w,_=this._getEntryIdKey(C),b=this._entriesWithId.get(_);if(b)return this.addLineToLink(b.id,T.ybase+T.y),b.id;const v=T.addMarker(T.ybase+T.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(y,v))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(w,T){const C=this._dataByLinkId.get(w);if(C&&C.lines.every((_=>_.line!==T))){const _=this._bufferService.buffer.addMarker(T);C.lines.push(_),_.onDispose((()=>this._removeMarkerFromLink(C,_)))}}getLinkData(w){return this._dataByLinkId.get(w)?.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,T){const C=w.lines.indexOf(T);C!==-1&&(w.lines.splice(C,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};c.OscLinkService=S=p([g(0,m.IBufferService)],S)},8343:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const h="di$target",p="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(g){return g[p]||[]},c.createDecorator=function(g){if(c.serviceRegistry.has(g))return c.serviceRegistry.get(g);const m=function(S,w,T){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,_,b){_[h]===_?_[p].push({id:C,index:b}):(_[p]=[{id:C,index:b}],_[h]=_)})(m,S,T)};return m.toString=()=>g,c.serviceRegistry.set(g,m),m}},2585:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const p=h(8343);var g;c.IBufferService=(0,p.createDecorator)("BufferService"),c.ICoreMouseService=(0,p.createDecorator)("CoreMouseService"),c.ICoreService=(0,p.createDecorator)("CoreService"),c.ICharsetService=(0,p.createDecorator)("CharsetService"),c.IInstantiationService=(0,p.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(g||(c.LogLevelEnum=g={})),c.ILogService=(0,p.createDecorator)("LogService"),c.IOptionsService=(0,p.createDecorator)("OptionsService"),c.IOscLinkService=(0,p.createDecorator)("OscLinkService"),c.IUnicodeService=(0,p.createDecorator)("UnicodeService"),c.IDecorationService=(0,p.createDecorator)("DecorationService")},1480:(f,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const p=h(8460),g=h(225);class m{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,T,C=!1){return(16777215&w)<<3|(3&T)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const w=new g.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let T=0,C=0;const _=w.length;for(let b=0;b<_;++b){let v=w.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=_)return T+this.wcwidth(v);const M=w.charCodeAt(b);56320<=M&&M<=57343?v=1024*(v-55296)+M-56320+65536:T+=this.wcwidth(M)}const y=this.charProperties(v,C);let k=m.extractWidth(y);m.extractShouldJoin(y)&&(k-=m.extractWidth(C)),T+=k,C=y}return T}charProperties(w,T){return this._activeProvider.charProperties(w,T)}}c.UnicodeService=m}},s={};function a(f){var c=s[f];if(c!==void 0)return c.exports;var h=s[f]={exports:{}};return i[f].call(h.exports,h,h.exports,a),h.exports}var d={};return(()=>{var f=d;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;const c=a(9042),h=a(3236),p=a(844),g=a(5741),m=a(8285),S=a(7975),w=a(7090),T=["cols","rows"];class C extends p.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const v=k=>this._core.options[k],y=(k,M)=>{this._checkReadonlyOptions(k),this._core.options[k]=M};for(const k in this._core.options){const M={get:v.bind(this,k),set:y.bind(this,k)};Object.defineProperty(this._publicOptions,k,M)}}_checkReadonlyOptions(b){if(T.includes(b))throw new Error(`Option "${b}" 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 S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w.UnicodeApi(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 m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const v in b)this._publicOptions[v]=b[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,v=!0){this._core.input(b,v)}resize(b,v){this._verifyIntegers(b,v),this._core.resize(b,v)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,v,y){this._verifyIntegers(b,v,y),this._core.select(b,v,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,v){this._verifyIntegers(b,v),this._core.selectLines(b,v)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,v){this._core.write(b,v)}writeln(b,v){this._core.write(b),this._core.write(`\r
82
+ `,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),d})()))})(em)),em.exports}var Q4=J4();function e6(e){let t=!1,i=!1,s=!1,a=!1,d=null,f=null;const c=()=>{d!==null&&(clearTimeout(d),d=null),s=!1},h=()=>{f!==null&&(clearTimeout(f),f=null),i=!1},p=()=>{h(),i=!0,f=setTimeout(()=>{f=null,i=!1},0)},g=()=>{s=!1,d!==null&&clearTimeout(d),f!==null&&(clearTimeout(f),f=null),d=setTimeout(()=>{d=null,i=!1,e()},0)},m=()=>{t=!1,d===null&&(h(),s=!1)},S=()=>{t=!1,a=!1,h(),c()},w=T=>{if(d===null){if(t||i||n6(T)){s=!0,i&&!t?g():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,p(),s&&g()},onCompositionCancel:m,handleKeyEvent(T){return t6(T)&&T.shiftKey?(T.preventDefault?.(),T.type==="keydown"?(a=!0,w(T)):T.type==="keypress"?(a||w(T),a=!1):T.type==="keyup"&&(a=!1),!1):!0},dispose:S}}function t6(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function n6(e){return e.isComposing===!0||e.keyCode===229||e.which===229}const i6={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",lineHeight:1},r6="Symbols Nerd Font Mono",Ju=`ui-monospace, "SF Mono", Menlo, "${r6}", monospace`,m_=14,CC=10,EC=22,s6={min:CC,max:EC},a6="cascadia",vc=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Ju}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Ju}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Ju}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Ju}`,meta:"Variable · Adobe mono"}],yo=vc[0];function o6(e){return vc.find(t=>t.id===e)??yo}function bc(){return{source:"curated",id:a6,customName:"",family:yo.family,size:m_}}function g_(e,t){const i=o6(e);return{source:"curated",id:i.id,customName:"",family:i.family,size:b_(t)}}function __(e,t){const i=u6(e);return{source:"custom",id:null,customName:i,family:jh(i,yo.family),size:b_(t)}}function kC(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,i=b_(typeof t.size=="number"?t.size:m_);return t.source==="custom"&&typeof t.customName=="string"?__(t.customName,i):typeof t.id=="string"&&c6(t.id)?g_(t.id,i):null}function v_(e){if(!e)return bc();try{const t=kC(JSON.parse(e));if(t!==null)return t}catch{}return bc()}function l6(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function b_(e){return Number.isFinite(e)?Math.min(EC,Math.max(CC,Math.round(e))):m_}function c6(e){return vc.some(t=>t.id===e)}function u6(e){return cd(e)}const $h="fleet-plugin.terminal.renderer",So="fleet-plugin.terminal.font",P1="fleet-console.terminalRenderer",z1="fleet-console.terminalFont",ig=new Set;let Ms=w6(),yc=null,ha=0;function h6(){if(!(typeof window>"u"))try{if(window.localStorage.getItem($h)!==null||window.localStorage.getItem(So)!==null)return;const e=window.localStorage.getItem(P1),t=window.localStorage.getItem(z1),i=e==="webgl"||e==="dom"?e:"webgl",s=v_(t);window.localStorage.setItem($h,i),window.localStorage.setItem(So,l6(s)),window.localStorage.removeItem(P1),window.localStorage.removeItem(z1)}catch{}}function d6(e){ha+=1,yc=e,_6()}function TC(){return L.useSyncExternalStore(x6,H1,H1)}function f6(e){y6(e),Eo({renderer:e})}function p6(e){const t=g_(e,Ms.font.size);ha+=1,Eo({font:t}),gd(t)}function m6(e){const t=__(e,Ms.font.size);ha+=1,Eo({font:t}),gd(t)}function g6(e){const t=Ms.font.source==="custom"?__(Ms.font.customName,e):g_(Ms.font.id,e);ha+=1,Eo({font:t}),gd(t)}async function _6(){if(!yc)return;const e=ha;try{const t=await yc.read("terminal");if(t!==null){const i=kC(t.font);if(i!==null){if(e!==ha)return;Eo({font:i});try{window.localStorage.removeItem(So)}catch{}return}}if(typeof window<"u"){let i=null;try{i=window.localStorage.getItem(So)}catch{}if(i!==null){const s=v_(i);if(e!==ha)return;Eo({font:s}),gd(s);try{window.localStorage.removeItem(So)}catch{}}}}catch{}}async function gd(e){if(yc)try{await yc.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function v6(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem($h);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function b6(){if(typeof window>"u")return bc();try{return v_(window.localStorage.getItem(So))}catch{return bc()}}function y6(e){if(!(typeof window>"u"))try{window.localStorage.setItem($h,e)}catch{}}function S6(){for(const e of ig)e()}function Eo(e){Ms={...Ms,...e},S6()}function x6(e){return ig.add(e),()=>{ig.delete(e)}}function H1(){return Ms}function w6(){return typeof window>"u"?{renderer:"webgl",font:bc()}:(h6(),{renderer:v6(),font:b6()})}function $1({baseY:e,viewportY:t}){return t>=e}function C6(e){let t=!0,i=null,s=null;const a=()=>{const{baseY:p,viewportY:g}=e.getViewport();i=Math.max(0,p-g)},d=()=>{if(i===null)return;const{baseY:p}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(p,p-i)))},f=()=>{if(t){e.scrollToBottom();return}d()},c=()=>{s===null&&(s=e.requestFrame(()=>{s=null,f()}))},h=()=>{t&&(f(),c())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=$1(e.getViewport()),t){i=null;return}a()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,i=null,h()},preserveAfterGeometryChange:p=>{p(),f(),c()},restoreAfterOutputParsing:()=>{if(t){h();return}$1(e.getViewport())||a()},dispose:()=>{s!==null&&e.cancelFrame(s),s=null}}}const E6="Symbols Nerd Font Mono",k6=`1em "${E6}"`,T6=650;let Qu=null;function AC(){return Qu||(Qu=R6(),Qu)}async function A6(){await L6(AC(),T6)}async function R6(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(k6)}catch{}}async function L6(e,t){await new Promise(i=>{let s=!1;const a=setTimeout(d,t);e.then(d,d);function d(){s||(s=!0,clearTimeout(a),i())}})}const M6=80,N6=16,O6=250,D6=1024*1024,j6=120,I6={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)"},B6={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)"},P6={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 y_({operationId:e,ticketPath:t,wsPath:i,theme:s="instrument",onExit:a,active:d,zoom:f=1}){const c=s,{renderer:h,font:p}=TC(),g=L.useRef(null),m=L.useRef(null),S=L.useRef(null),w=L.useRef(null),T=L.useRef(null),C=L.useRef(null),_=L.useRef(null),[b,v]=L.useState(f),y=L.useRef(a);y.current=a;const k=L.useRef(d);k.current=d;const[M,R]=L.useState("connecting"),[N,A]=L.useState(0);L.useEffect(()=>{const H=g.current;if(!H)return;let q=!1,B=null,Y=null,G=null;return(async()=>{if(await A6(),q)return;const K=new Q4.Terminal({...i6,fontFamily:p.family,fontSize:p.size*b,theme:F1(c)});m.current=K;const V=new fM.FitAddon;_.current=V,K.loadAddon(V),K.open(H),K.loadAddon(new gM.Unicode11Addon),K.unicode.activeVersion="11";const O=e6(()=>K.input(`
83
+ `)),z=H.querySelector("textarea.xterm-helper-textarea, textarea")??H;z.addEventListener("compositionstart",O.onCompositionStart),z.addEventListener("compositionend",O.onCompositionEnd),z.addEventListener("focusout",O.onCompositionCancel),K.attachCustomKeyEventHandler(O.handleKeyEvent);const j=C6({getViewport:()=>K.buffer.active,scrollToBottom:()=>z6(K),scrollToLine:F=>H6(K,F),requestFrame:F=>window.requestAnimationFrame(F),cancelFrame:F=>window.cancelAnimationFrame(F)});C.current=j;const W=$6(H,z,j.recordUserViewportChange),Z=U6(K,k.current!==!1,j.restoreAfterOutputParsing);T.current=Z;const ne=oM({operationId:e,ticketPath:t,wsPath:i,terminal:{onData:F=>K.onData(ae=>{j.resumeFollowing(),F(ae)}),write:Z.write},onExit:()=>y.current?.(),onStatus:(F,ae)=>{R(ae?`${F}: ${ae}`:F)}});S.current=ne;const te=()=>{j.preserveAfterGeometryChange(()=>{V.fit(),ne.resize(K.cols,K.rows),K.refresh(0,K.rows-1)})},he=()=>{Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,q||te()},M6)},J=async()=>{await document.fonts?.ready,!q&&(te(),ne.start(),k.current!==!1&&K.focus())};B=new ResizeObserver(he),B.observe(H),J(),G=()=>{Y&&clearTimeout(Y),z.removeEventListener("compositionstart",O.onCompositionStart),z.removeEventListener("compositionend",O.onCompositionEnd),z.removeEventListener("focusout",O.onCompositionCancel),O.dispose(),ne.dispose(),W.dispose(),Z.dispose(),j.dispose(),m.current=null,S.current=null,T.current=null,C.current=null,_.current=null;try{K.dispose()}catch{}},A(F=>F+1)})(),()=>{q=!0,B?.disconnect(),G?.()}},[e,t,i]),L.useEffect(()=>{T.current?.setActive(d!==!1),d&&(m.current?.focus(),C.current?.resumeFollowing())},[d]),L.useEffect(()=>{const H=m.current;if(!H)return;let q=!1;if(h==="webgl")try{const B=new Z4;w.current=B,B.onContextLoss(()=>{if(!q){try{B.dispose()}catch{}w.current===B&&(w.current=null)}}),H.loadAddon(B)}catch{try{w.current?.dispose()}catch{}w.current=null}return()=>{q=!0;const B=w.current;if(B){w.current=null;try{B.dispose()}catch{}}}},[h,e,N]),L.useEffect(()=>{const H=m.current;H&&(H.options.theme=F1(c))},[c,N]),L.useEffect(()=>{const H=m.current;H&&(H.options.fontFamily=p.family,U1(H,_.current,S.current,C.current))},[p.family,N]),L.useEffect(()=>{if(f===b)return;const H=setTimeout(()=>v(f),j6);return()=>clearTimeout(H)},[f,b]),L.useEffect(()=>{const H=m.current;H&&(H.options.fontSize=p.size*b,U1(H,_.current,S.current,C.current))},[b,p.size,N]);const I=M.startsWith("live"),$=b===1?void 0:{width:`${b*100}%`,height:`${b*100}%`,transform:`scale(${1/b})`,transformOrigin:"0 0"};return l.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:l.jsxs("div",{className:"terminal-shell",children:[I?null:l.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[l.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),M]}),l.jsx("div",{className:"terminal-viewport",children:l.jsx("div",{className:"terminal-canvas",ref:g,style:$})})]})})}function F1(e){return e==="carbon"?P6:e==="maritime"?B6:I6}function z6(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function H6(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function $6(e,t,i){const s=e.querySelector(".xterm-viewport");if(!s)return{dispose:()=>{}};let a=!1,d=null;const f=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{d=window.requestAnimationFrame(()=>{d=null,i()})})},c=()=>f(),h=()=>{a=!0},p=w=>{a=w.pointerType==="touch"||w.target===s},g=()=>{a&&f()},m=()=>{const w=a;a=!1,w&&f()},S=w=>{F6(w)&&f()};return s.addEventListener("wheel",c,{capture:!0,passive:!0}),s.addEventListener("touchstart",h,{capture:!0,passive:!0}),s.addEventListener("touchend",m),s.addEventListener("touchcancel",m),s.addEventListener("pointerdown",p,!0),s.addEventListener("scroll",g),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),t.addEventListener("keydown",S,!0),{dispose:()=>{s.removeEventListener("wheel",c,!0),s.removeEventListener("touchstart",h,!0),s.removeEventListener("touchend",m),s.removeEventListener("touchcancel",m),s.removeEventListener("pointerdown",p,!0),s.removeEventListener("scroll",g),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),t.removeEventListener("keydown",S,!0),d!==null&&window.cancelAnimationFrame(d)}}}function F6(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function U6(e,t,i){let s=t,a=!1,d=null,f=0,c=[];const h=()=>{d&&(clearTimeout(d),d=null)},p=()=>{if(h(),a||f===0)return;const m=W6(c,f);c=[],f=0,e.write(m,()=>{a||i()})},g=()=>{a||d||f===0||(d=setTimeout(p,s?N6:O6))};return{write:m=>{if(!(a||m.byteLength===0)){if(c.push(m),f+=m.byteLength,f>=D6){p();return}g()}},setActive:m=>{if(s!==m){if(s=m,h(),s){p();return}g()}},dispose:()=>{p(),a=!0,c=[],f=0,h()}}}function W6(e,t){if(e.length===1)return e[0]??new Uint8Array;const i=new Uint8Array(t);let s=0;for(const a of e)i.set(a,s),s+=a.byteLength;return i}function U1(e,t,i,s){const a=()=>{t?.fit(),i?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(s){s.preserveAfterGeometryChange(a);return}a()}const G6=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class dr extends Error{status;constructor(t,i){super(i),this.name="AgentApiError",this.status=t}}async function q6(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Yr(t);const i=await t.json();if(!Array.isArray(i.agentClis))throw new dr(t.status,"Invalid agent state response");return i.agentClis.map(s=>tN(s,t.status))}async function K6(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Yr(t);const i=await t.json();if(!Array.isArray(i.clis))throw new dr(t.status,"Invalid Agent CLI state response");return i}async function V6(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Yr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new dr(t.status,"Invalid tenants response");return i.tenants.map(s=>nN(s,t.status))}async function Y6(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Yr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new dr(t.status,"Invalid jobs response");return i.tenants}async function X6(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Yr(t);const i=await t.json();if(!Array.isArray(i.sessions))throw new dr(t.status,"Invalid agent sessions response");return i.sessions.map(s=>_d(s,t.status))}async function Z6(e){const t=await fetch("/api/v1/operations",{signal:e});await Yr(t);const i=await t.json();if(!Array.isArray(i.operations))throw new dr(t.status,"Invalid operations response");return{operations:i.operations.map(s=>iN(s,t.status))}}async function J6(e,t,i){const s=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:i});return await Yr(s),_d(await s.json(),s.status)}async function Q6(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Yr(i),_d(await i.json(),i.status)}async function eN(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Yr(i)}function _d(e,t){const i=e;if(!i||typeof i.sessionId!="string"||typeof i.cwdLabel!="string"||typeof i.status!="string"||typeof i.createdAt!="number"||rg(i))throw new dr(t,"Invalid agent session response");return{sessionId:i.sessionId,terminalSessionId:typeof i.terminalSessionId=="string"?i.terminalSessionId:i.sessionId,cwdLabel:i.cwdLabel,label:typeof i.label=="string"?i.label:void 0,cliId:typeof i.cliId=="string"?i.cliId:void 0,cliLabel:typeof i.cliLabel=="string"?i.cliLabel:void 0,status:i.status,turnState:i.turnState==="running"||i.turnState==="ended"?i.turnState:"none",createdAt:i.createdAt,theaterId:typeof i.theaterId=="string"?i.theaterId:void 0,tenantId:typeof i.tenantId=="string"?i.tenantId:void 0,registrationId:typeof i.registrationId=="string"?i.registrationId:void 0,resumeAvailable:i.resumeAvailable===!0}}async function Yr(e){if(!e.ok)throw new dr(e.status,`Agent plugin request failed: ${e.status}`)}function tN(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string")throw new dr(t,"Invalid Agent CLI metadata response");return{id:i.id,label:i.label,available:i.available===!0,signedIn:i.signedIn!==!1}}function nN(e,t){const i=e;if(!i||typeof i.tenantId!="string"||typeof i.tenantLabel!="string"||typeof i.createdAt!="number"||typeof i.sessions!="number")throw new dr(t,"Invalid tenant response");return i}function iN(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||rg(i)||rg(i.payload))throw new dr(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,ts:i.ts}}function rg(e){return sg(e,new Set(G6))}function sg(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>sg(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||sg(s,t))}const rN="active",ag=new Set(["done","error","aborted"]);function sN(e,t){let i=og(e,t.jobId,t.updatedAt);for(const s of t.events)i=RC(i,s);return ag.has(t.status)&&!ag.has(i.status)&&(i={...i,status:t.status}),i}function RC(e,t){if(t.id<=e.lastEventId)return e;const i=t.event,s={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:lN(e.recentEvents,t)};switch(t.type){case"job:registered":return aN(s,i);case"job:finalized":return{...s,status:cn(i.status)??"done",finishedAt:ks(i.finishedAt)??t.at,summary:cn(i.summary),error:cn(i.error)};case"track:begin":return to(s,i,t.id,a=>({...a,startedAt:ks(i.startedAt)??t.at,requestPreview:cn(i.requestPreview)}));case"track:status":return to(s,i,t.id,a=>({...a,status:cn(i.status)??a.status}));case"track:text":return to(s,i,t.id,a=>{const d=a.text+(cn(i.text)??"");return{...a,status:"stream",text:d,sentTextLength:a.sentTextLength+(ks(i.textLength)??cn(i.text)?.length??0),latestLine:cN(d)||a.latestLine}});case"track:thought":return to(s,i,t.id,a=>{const d=a.thought+(cn(i.text)??"");return{...a,thought:d,sentThoughtLength:a.sentThoughtLength+(ks(i.textLength)??cn(i.text)?.length??0)}});case"track:tool":return to(s,i,t.id,a=>({...a,status:"stream",tools:oN(a.tools,i)}));case"track:finalized":return to(s,i,t.id,a=>{const d=W1(a.text,a.sentTextLength,cn(i.fallbackText),ks(i.fallbackTextLength)),f=W1(a.thought,a.sentThoughtLength,cn(i.fallbackThought),ks(i.fallbackThoughtLength));return{...a,status:cn(i.status)??"done",finishedAt:ks(i.finishedAt)??t.at,error:cn(i.error),text:d.text,sentTextLength:d.sentLength,thought:f.text,sentThoughtLength:f.sentLength}});default:return s}}function og(e,t,i){return{jobId:t,tenantId:e,status:rN,updatedAt:i,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function ko(e){return ag.has(e)}function aN(e,t){const i=Array.isArray(t.tracks)?t.tracks:[];let s=e.trackOrder,a=e.tracks;for(const d of i){if(!d.trackId)continue;const f=a[d.trackId],c={...f??LC(d.trackId),displayName:d.displayName??f?.displayName??d.trackId,displayCli:d.displayCli??f?.displayCli,model:d.model??f?.model,effort:d.effort??f?.effort,subtitle:d.subtitle??f?.subtitle,kind:d.kind??f?.kind,startedAt:d.startedAt??f?.startedAt};f||(s=[...s,d.trackId]),a={...a,[d.trackId]:c}}return{...e,label:cn(t.label)??e.label,ownerCarrierId:cn(t.ownerCarrierId)??e.ownerCarrierId,kind:cn(t.kind)??e.kind,signatureCli:cn(t.signatureCli)??e.signatureCli,startedAt:ks(t.startedAt)??e.startedAt,trackOrder:s,tracks:a}}function to(e,t,i,s){const a=cn(t.trackId);if(!a)return e;const d=e.tracks[a],f={...s(d??LC(a)),lastEventId:i};return{...e,trackOrder:d?e.trackOrder:[...e.trackOrder,a],tracks:{...e.tracks,[a]:f}}}function LC(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function oN(e,t){const i=cn(t.toolId)??cn(t.id);if(!i)return e;const s={id:i,name:cn(t.name),input:t.input,output:t.output,status:cn(t.status)},a=e.findIndex(d=>d.id===i);return a>=0?[...e.slice(0,a),{...e[a],...s},...e.slice(a+1)]:[...e,s]}function W1(e,t,i,s){return i?t>=(s??i.length)?{text:e,sentLength:t}:{text:i,sentLength:s??i.length}:{text:e,sentLength:t}}function lN(e,t){return[...e,t].slice(-120)}function cN(e){const t=e.trim();if(!t)return"";const i=t.split(`
84
+ `);return i[i.length-1]?.trim()??""}function cn(e){return typeof e=="string"?e:void 0}function ks(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const uN=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function hN(){let e="";return t=>{e+=t;const i=[];let s=e.indexOf(`
85
+
86
+ `);for(;s>=0;){const a=e.slice(0,s);e=e.slice(s+2);const d=fN(a);d&&i.push(d),s=e.indexOf(`
87
+
88
+ `)}return i}}function dN(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const s=t.tenant?.tenantId;return!s||!t.truncation?null:{kind:"truncation",tenantId:s,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const s=q1(t.session);return s?{kind:"session",tenantId:s.tenantId??s.sessionId,session:s}:null}if(e.event==="session:attention"){const s=q1(t.session);return s?{kind:"attention",tenantId:s.tenantId??s.sessionId,session:s,reason:pN(t.reason)}:null}const i=G1(t.event)??G1(t);return i?{kind:"event",tenantId:i.tenantId,tenantLabel:t.tenant?.tenantLabel,event:i}:null}function fN(e){const t=e.split(`
89
+ `),i=t.find(a=>a.startsWith("event:"))?.slice(6).trim()??"message",s=t.filter(a=>a.startsWith("data:")).map(a=>a.slice(5).trim()).join(`
90
+ `);return!s&&i==="message"?null:{event:i,data:s}}function G1(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 q1(e){try{return _d(e,200)}catch{return null}}function pN(e){return typeof e=="string"&&uN.has(e)?e:void 0}const S_={droppedCount:0},lg=new Set;let Vt={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function mN(){return $x(gN,MC)}function MC(){return Vt}function gN(e){return lg.add(e),()=>{lg.delete(e)}}function Oi(e){Vt={...Vt,...e},wN()}function _N(e){Oi({agentClis:e})}function vN(e){const t={};for(const i of e)t[i.sessionId]=i;Oi({sessions:t,sessionOrder:[...e].sort((i,s)=>s.createdAt-i.createdAt).map(i=>i.sessionId)})}function Fh(e){const t=!!Vt.sessions[e.sessionId];Oi({sessions:{...Vt.sessions,[e.sessionId]:e},sessionOrder:t?Vt.sessionOrder:[e.sessionId,...Vt.sessionOrder],turnState:{...Vt.turnState,[e.sessionId]:e.turnState}})}function NC(e){const{[e]:t,...i}=Vt.sessions,{[e]:s,...a}=Vt.turnState;Oi({sessions:i,sessionOrder:Vt.sessionOrder.filter(d=>d!==e),activeTerminalSessionId:Vt.activeTerminalSessionId===e?null:Vt.activeTerminalSessionId,turnState:a})}function OC(e){Oi({activeTerminalSessionId:e})}function bN(e){Oi({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...Vt.tenantOrder.filter(t=>!e.some(i=>i.tenantId===t)&&Vt.tenantJobs[t])]})}function yN(e){const t={};for(const i of e){const s={};for(const a of i.jobs)s[a.jobId]=sN(i.tenantId,a);t[i.tenantId]={tenantId:i.tenantId,tenantLabel:i.tenantLabel,jobOrder:i.jobs.map(a=>a.jobId),jobs:s,truncation:i.truncation??S_}}Oi({tenantJobs:t,tenantOrder:[...e.map(i=>i.tenantId),...Vt.tenantOrder.filter(i=>t[i])]})}function SN(e,t){const i=e.tenantId,s=e.jobId??CN(e),a=Vt.tenantJobs[i]??{tenantId:i,tenantLabel:t,jobOrder:[],jobs:{},truncation:S_},d=s?a.jobs[s]??og(i,s,e.at):og(i,"__unknown__",e.at),f=RC(d,e),c=s&&a.jobOrder.includes(s)?a.jobOrder:s?[s,...a.jobOrder]:a.jobOrder,h={...a,tenantLabel:t??a.tenantLabel,jobOrder:c,jobs:s?{...a.jobs,[s]:f}:a.jobs};return Oi({tenantJobs:{...Vt.tenantJobs,[i]:h},tenantOrder:Vt.tenantOrder.includes(i)?Vt.tenantOrder:[i,...Vt.tenantOrder]}),{job:f,unknownTenant:!Vt.tenantJobs[i]}}function xN(e,t,i){const s=Vt.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:S_};Oi({tenantJobs:{...Vt.tenantJobs,[e]:{...s,tenantLabel:t??s.tenantLabel,truncation:i}}})}function DC(e){const t=e.tenantId;if(!t)return[];const i=Vt.tenantJobs[t];return i?i.jobOrder.map(s=>i.jobs[s]).filter(s=>!!s):[]}function wN(){for(const e of lg)e()}function CN(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const K1=250,EN=5e3,cg=new Map;function kN(e){const t=new AbortController;return TN(t.signal,e),()=>t.abort()}async function TN(e,t){let i=K1;for(;!e.aborted;){Oi({connection:"connecting"});try{await MN(e,t);const s=await fetch("/plugins/terminal/agent/events",{signal:e});if(!s.ok||!s.body)throw new Error(`Agent stream failed: ${s.status}`);Oi({connection:"live",connectionError:null}),i=K1,await AN(s.body.getReader(),e,t),e.aborted||Oi({connection:"connecting",connectionError:null})}catch(s){if(e.aborted)return;Oi({connection:"connecting",connectionError:s instanceof Error?s.message:String(s)})}if(e.aborted)return;await ON(i,e),i=Math.min(i*2,EN)}}async function AN(e,t,i){const s=new TextDecoder,a=hN();for(;!t.aborted;){const d=await e.read();if(d.done)return;for(const f of a(s.decode(d.value,{stream:!0}))){const c=dN(f);if(c){if(c.kind==="truncation"&&c.truncation){xN(c.tenantId,c.tenantLabel,c.truncation);continue}if(c.kind==="session"&&c.session){Fh(c.session),Uh(i,c.session.sessionId,x_(c.session));continue}if(c.kind==="attention"&&c.session){Fh(c.session),c.reason!=="idle_prompt"&&Uh(i,c.session.sessionId,"awaiting");continue}c.event&&(SN(c.event,c.tenantLabel),LN(i,c.event.tenantId))}}}}function x_(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&RN(e)?"running":"idle"}function RN(e){return DC(e).some(t=>!ko(t.status))}function Uh(e,t,i){const s=cg.get(t);e.status.set(t,i),cg.set(t,i),s!==i&&(i==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):i==="idle"&&(s==="running"||s==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function LN(e,t){const{sessions:i}=MC();for(const s of Object.values(i))s.tenantId===t&&cg.get(s.sessionId)!=="awaiting"&&Uh(e,s.sessionId,x_(s))}async function MN(e,t){const[i,s,a,d,f]=await Promise.all([q6(e),X6(e),V6(e),Y6(e),Z6(e)]);_N(i),vN(s),bN(a),yN(d);for(const c of s)Uh(t,c.sessionId,x_(c));NN(f.operations,t)}function NN(e,t){for(const i of e)i.pluginId==="terminal"&&i.type==="agent.streaming"&&t.operations.remove(i.id).catch(()=>{})}async function ON(e,t){await new Promise(i=>{const s=()=>{clearTimeout(a),t.removeEventListener("abort",s),i()},a=setTimeout(s,e);t.addEventListener("abort",s)})}const DN=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function jN(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const i=Math.floor(t/60),s=t%60;return`${i}m ${s}s`}function IN(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function BN(e){return e.trackOrder.reduce((t,i)=>{const s=e.tracks[i];return s?t+Math.round((s.sentTextLength+s.sentThoughtLength)/4):t},0)}function jC(e){if(e)return DN.has(e)?e:void 0}function PN(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function vd(e){return e==="err"||e==="error"}function Sc(e,t){return!ko(e)&&PN(t)}function w_(e,t){return vd(e)?"error":e==="done"||e==="aborted"?e:ko(t)?t:e}function zN(e,t){const i=new Set(e),s=t.filter(a=>i.has(a)?!1:(i.add(a),!0));return s.length===0?e:[...e,...s]}function HN(e,t,i){const s=new Map(e.map(d=>[d.jobId,d]));let a=!1;for(const d of t)s.get(d)?.expiresAt!==i&&(s.set(d,{jobId:d,expiresAt:i}),a=!0);return a?[...s.values()]:e}function $N(e,t,i){const s=new Set(t.map(d=>d.jobId)),a=e.filter(d=>d.expiresAt>i&&s.has(d.jobId));return a.length===e.length?e:a}function IC(e,t){const i=new Map(e.map(s=>[s.jobId,s]));return t.flatMap(s=>{const a=i.get(s);return a?[a]:[]})}function FN(e){const t=e.flatMap(a=>a.trackOrder.map(d=>({job:a,track:a.tracks[d]}))).filter(a=>!!a.track).sort((a,d)=>d.track.lastEventId-a.track.lastEventId),i=t.filter(({job:a,track:d})=>Sc(a.status,d.status)),s=i.length>0?i:t;for(const{job:a,track:d}of s){if(d.latestLine)return{text:d.latestLine,thinking:!1};if(Sc(a.status,d.status)&&d.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function UN(e,t,i){const s=new Set(e.map(d=>d.jobId)),a=IC(t,i.map(d=>d.jobId)).filter(d=>!s.has(d.jobId));return a.length===0?e:[...e,...a]}class BC extends Error{status;constructor(t,i){super(i),this.name="TerminalSettingsApiError",this.status=t}}async function WN(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await PC(t),zC(await t.json(),t.status)}async function GN(e,t){const i=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await PC(i),zC(await i.json(),i.status)}async function PC(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new BC(e.status,t)}function zC(e,t){const i=e;if(!i||typeof i.enableMetaphor!="boolean"||i.codexLaunchMode!=="acp"&&i.codexLaunchMode!=="app-server")throw new BC(t,"Invalid Terminal settings response");return{enableMetaphor:i.enableMetaphor,codexLaunchMode:i.codexLaunchMode}}const ug=new Set;let Wh={loading:!1,state:null,savingField:null,error:null},Ch=0;function HC(){return L.useSyncExternalStore(qN,V1,V1)}function V1(){return Wh}function qN(e){return ug.add(e),()=>{ug.delete(e)}}async function KN(e){const t=++Ch;xo({loading:!0,error:null});try{const i=await WN(e);if(t!==Ch)return;xo({loading:!1,state:i,error:null})}catch(i){if(e?.aborted||t!==Ch)return;xo({loading:!1,error:FC(i)})}}async function $C(e,t){const i=Wh.state;if(!i)return!1;Ch+=1;const s={...i,[e]:t},a=e==="enableMetaphor"?{enableMetaphor:s.enableMetaphor}:{codexLaunchMode:s.codexLaunchMode};xo({state:s,savingField:e,error:null});try{const d=await GN(a);return xo({state:d,savingField:null,error:null}),!0}catch(d){return xo({state:i,savingField:null,error:FC(d)}),!1}}function xo(e){Wh={...Wh,...e};for(const t of ug)t()}function FC(e){return e instanceof Error?e.message:String(e)}const VN=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],YN="/plugins/terminal/agent/ticket",XN="/plugins/terminal/ws",tm="fleet-plugin.terminal.stream-dock-expanded",ZN="fleet-plugin.terminal.stream-dock-collapsed",JN=56,QN=4e3,eO={...s6,step:1,defaultValue:14},tO="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",UC={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Zl(e.payload,"cliLabel")??void 0,render:e=>l.jsx(aO,{context:e})},WC={id:"agent-cli",title:"Agent CLI",render:()=>l.jsx(cO,{})},GC={id:"agent.attention",title:"Agent input waiting"},nO={id:"agent.ended",title:"Agent turn ended"},eh={id:"terminal",operationKinds:[UC],settingsSections:[WC],notificationKinds:[GC,nO],install:e=>iO(e),closeOperation:async e=>{try{await eN(e)}finally{NC(e)}},launch:async({theaterId:e,kind:t})=>{const i=await J6(e,t.id);return Fh(i),OC(i.sessionId),{id:i.sessionId}},renderLaunchIcon:e=>e.id==="claude"?l.jsx(CO,{}):e.id==="codex"?l.jsx(kO,{}):e.id==="cursor"?l.jsx(EO,{}):l.jsx(wO,{})};function iO(e){return kN({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function qC(e,t){const i=L.useRef(null),s=L.useRef(!0),[a,d]=L.useState(!0),f=L.useCallback(h=>{s.current!==h&&(s.current=h,d(h))},[]);L.useEffect(()=>{const h=i.current;if(!h)return;const p=()=>{const g=h.scrollHeight-h.scrollTop-h.clientHeight;f(g<=JN)};return h.addEventListener("scroll",p,{passive:!0}),()=>h.removeEventListener("scroll",p)},[e,f]),L.useLayoutEffect(()=>{f(!0);const h=i.current;h&&(h.scrollTop=h.scrollHeight)},[e,f]),L.useLayoutEffect(()=>{const h=i.current;!h||!s.current||(h.scrollTop=h.scrollHeight)},[t]);const c=L.useCallback(()=>{const h=i.current;h&&(h.scrollTop=h.scrollHeight,h.focus({preventScroll:!0}),f(!0))},[f]);return{containerRef:i,pinned:a,jumpToLatest:c}}function rO(){const[e,t]=L.useState(()=>{try{return localStorage.removeItem(ZN),localStorage.getItem(tm)==="true"}catch{return!1}}),i=L.useCallback(s=>{try{s?localStorage.setItem(tm,"true"):localStorage.removeItem(tm)}catch{}t(s)},[]);return[e,i]}function sO(e,t){const[i,s]=L.useState(Date.now);return L.useEffect(()=>{if(e===void 0||t!==void 0)return;const a=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(a)},[e,t]),e===void 0?"":jN((t??i)-e)}function aO({context:e}){const i=mN().sessions[e.operationId]??gO(e),[s,a]=L.useState(!1),[d,f]=L.useState([]),[c,h]=L.useState([]),p=L.useRef(null),g=L.useRef(null),m=L.useRef(null),S=L.useRef(new Set),w=DC(i),T=w.filter(R=>!ko(R.status)),C=UN(T,w,c),_=IC(w,d),b=String(s),v=_.map(R=>`${R.jobId}:${R.lastEventId}`).join(","),y=qC(b,v);L.useLayoutEffect(()=>{const R=S.current,N=w.filter(A=>R.has(A.jobId)&&ko(A.status)).map(A=>A.jobId);S.current=new Set(T.map(A=>A.jobId)),N.length!==0&&h(A=>HN(A,N,Date.now()+QN))},[T,w]),L.useEffect(()=>{if(c.length===0)return;const R=Math.min(...c.map(A=>A.expiresAt)),N=window.setTimeout(()=>{h(A=>$N(A,w,Date.now()))},Math.max(0,R-Date.now()));return()=>window.clearTimeout(N)},[w,c]),L.useEffect(()=>{s&&f(R=>zN(R,T.map(N=>N.jobId)))},[T,s]);const k=L.useCallback(()=>{a(!1),f([]),m.current?.focus()},[]),M=L.useCallback(()=>{f(C.map(R=>R.jobId)),a(!0)},[C]);return L.useLayoutEffect(()=>{s&&p.current?.focus()},[s]),L.useEffect(()=>{if(!s)return;const R=N=>{if(N.key==="Escape"){N.stopPropagation(),k();return}if(N.key==="Tab"){const A=g.current;if(!A)return;const I=Array.from(A.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(q=>!q.hasAttribute("disabled")),$=I[0],H=I[I.length-1];N.shiftKey&&document.activeElement===$?(N.preventDefault(),H?.focus()):!N.shiftKey&&document.activeElement===H&&(N.preventDefault(),$?.focus())}};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[s,k]),i.status==="dormant"?l.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{mO(i.sessionId)},children:[l.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),l.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]}):l.jsxs("div",{className:"agent-stream-host",children:[l.jsx(y_,{operationId:i.sessionId,ticketPath:YN,wsPath:XN,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>NC(i.sessionId)}),C.length>0?l.jsx(oO,{activeJobs:C,onOpenDetail:M,detailBtnRef:m}):null,s?l.jsxs("div",{ref:g,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[l.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:k}),l.jsxs("div",{className:"job-overlay-card",children:[l.jsx("button",{ref:p,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:k,children:"×"}),l.jsx("div",{ref:y.containerRef,className:"job-overlay-body",tabIndex:-1,children:_.length===0?l.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):_.map(R=>l.jsx(fO,{job:R},R.jobId))}),y.pinned?null:l.jsx("button",{type:"button",className:"follow-button",onClick:y.jumpToLatest,children:"↓ Follow"})]})]}):null]})}function oO({activeJobs:e,onOpenDetail:t,detailBtnRef:i}){const[s,a]=rO(),d=e[0],f=sO(d?.startedAt,d?.finishedAt),c=e.reduce((R,N)=>R+BN(N),0),h=IN(c),p=e.length===1&&d?jC(d.ownerCarrierId):void 0,g=e.length===1&&d?d.label:void 0,m=e.length>1?`${e.length} carriers`:d?.ownerCarrierId??"Carrier",S=FN(e),w=e.map(R=>`${R.jobId}:${R.lastEventId}`).join(","),T=`${s}:${e.map(R=>R.jobId).join(",")}`,{containerRef:C,pinned:_,jumpToLatest:b}=qC(T,w),v=e.some(R=>R.trackOrder.some(N=>{const A=R.tracks[N];return A?Sc(R.status,A.status):!1})),y=e.some(R=>!ko(R.status)),k=e.some(R=>R.status==="error"||R.trackOrder.some(N=>vd(R.tracks[N]?.status??""))),M=y?"job-dock-dot":k?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle";return l.jsxs("div",{className:"job-dock",children:[l.jsxs("div",{className:"job-dock-strip",children:[l.jsx("span",{className:M,"aria-hidden":"true"}),l.jsxs("span",{className:"job-dock-carrier",title:g,children:[p?l.jsx("span",{className:"job-dock-captain-dot","data-captain":p,"aria-hidden":"true"}):null,l.jsx("span",{className:"job-dock-captain-tag",children:m})]}),l.jsxs("span",{className:"job-dock-strip-line",style:s?{display:"none"}:void 0,"aria-hidden":"true",children:[S.thinking?l.jsx("span",{className:"thinking-chip",children:"thinking…"}):S.text,!s&&v&&S.text?l.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),l.jsxs("span",{className:"job-dock-meta",children:[f?l.jsx("span",{children:f}):null,h?l.jsx("span",{children:h}):null]}),l.jsx("button",{type:"button",className:"job-dock-grip","aria-label":s?"Collapse stream dock":"Expand stream dock","aria-expanded":s,onClick:()=>a(!s),children:s?"▼":"▲"}),l.jsx("button",{ref:i,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),l.jsxs("div",{className:`job-dock-body-wrap${s?"":" is-collapsed"}`,children:[l.jsxs("div",{ref:C,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&g?l.jsx("div",{className:"job-dock-row",children:l.jsx("span",{className:"job-dock-row-label",children:g})}):null,e.map(R=>{const N=e.length>1,A=!N&&R.trackOrder.length===1;return R.trackOrder.map(I=>{const $=R.tracks[I];return $?l.jsx(lO,{track:$,job:R,multiJob:N,singleTrack:A},`${R.jobId}:${I}`):null})})]}),_?null:l.jsx("button",{type:"button",className:"follow-button",onClick:b,children:"↓ Follow"})]})]})}function lO({track:e,job:t,multiJob:i,singleTrack:s}){const a=Sc(t.status,e.status),f=vO(e.text),c=!f&&a&&!!e.thought,h=a?_O(e):void 0,p=w_(e.status,t.status),g=i||!s,m=i?jC(t.ownerCarrierId):void 0;return l.jsxs("div",{className:"job-dock-row",children:[g?l.jsxs("span",{className:"job-dock-row-name",children:[m?l.jsx("span",{className:"job-dock-captain-dot","data-captain":m,"aria-hidden":"true"}):null,l.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}):null,l.jsxs("span",{className:`job-dock-row-status${a?" job-dock-row-status--live":""}${vd(p)?" job-dock-row-status--error":""}`,children:[p,h?` · ${h}`:""]}),f?l.jsxs("span",{className:"job-dock-row-line",children:[f,a?l.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null,c?l.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]})}function cO(){const[e,t]=L.useState([]),[i,s]=L.useState(null),{renderer:a,font:d}=TC(),f=HC();return L.useEffect(()=>{const c=new AbortController;return K6(c.signal).then(h=>t(h.clis)).catch(h=>{c.signal.aborted||s(h instanceof Error?h.message:String(h))}),()=>c.abort()},[]),l.jsxs(l.Fragment,{children:[l.jsx(uO,{}),l.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[l.jsx("div",{className:"agent-cli-head",children:l.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),l.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."}),i?l.jsx("p",{className:"settings-error",children:i}):null,l.jsx("div",{className:"agent-cli-list",children:e.map(c=>l.jsx(dO,{cli:c,codexLaunchMode:f.state?.codexLaunchMode,disabled:f.savingField!==null,onCodexLaunchModeChange:h=>{$C("codexLaunchMode",h)}},c.id))}),f.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:f.error}):null,l.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."}),l.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),l.jsx(bO,{terminalFont:d}),l.jsx(yO,{terminalRenderer:a})]})}function uO(){const e=HC(),t=e.state,i=e.savingField!==null;return L.useEffect(()=>{const s=new AbortController;return KN(s.signal),()=>s.abort()},[]),l.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?l.jsx(l.Fragment,{children:l.jsx(hO,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:i,onToggle:()=>{$C("enableMetaphor",!t.enableMetaphor)}})}):l.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),l.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function hO({title:e,help:t,onLabel:i,offLabel:s,value:a,disabled:d,onToggle:f}){return l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:e}),l.jsx("p",{className:"global-settings-help",children:t})]}),l.jsx("button",{type:"button",className:`global-settings-toggle ${a?"is-on":""}`,disabled:d,"aria-pressed":a,onClick:f,children:l.jsx("span",{children:a?i:s})})]})}function dO({cli:e,codexLaunchMode:t,disabled:i,onCodexLaunchModeChange:s}){return l.jsxs("div",{className:"agent-cli-row",children:[l.jsx("span",{className:"agent-cli-name",children:e.displayName}),l.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?l.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[l.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:i,onClick:()=>s("acp"),children:"ACP"}),l.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:i,onClick:()=>s("app-server"),children:"App Server"})]}):null,e.available&&e.version?l.jsx("span",{className:"agent-cli-version",children:e.version}):null,l.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function fO({job:e}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"job-overlay-head",children:[l.jsx("span",{className:"job-overlay-kicker",children:e.status}),l.jsx("strong",{children:e.label??e.jobId})]}),l.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const i=e.tracks[t];return i?l.jsx(pO,{track:i,jobStatus:e.status},i.trackId):null})})]})}function pO({track:e,jobStatus:t}){const i=xO(e.status,t),s=i==="track-card--live",a=w_(e.status,t);return l.jsxs("article",{className:i?`track-card ${i}`:"track-card",children:[l.jsxs("header",{className:"track-card-head",children:[l.jsx("span",{className:"track-card-title",children:e.displayName}),l.jsx("span",{className:"track-card-status",children:a})]}),e.thought?l.jsxs("details",{className:"track-card-thinking",children:[l.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),l.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:l.jsx("pre",{children:e.thought})})]}):null,e.text?l.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[l.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),l.jsxs("pre",{children:[e.text,s?l.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?l.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?l.jsx("ul",{className:"track-card-tools",children:e.tools.map(d=>l.jsx("li",{children:d.name??d.id},d.id))}):null]})}async function mO(e){Fh(await Q6(e)),OC(e)}function gO(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Zl(e.operation.payload,"cliId")??void 0,cliLabel:Zl(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Zl(e.operation.payload,"tenantId")??void 0,registrationId:Zl(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Zl(e,t){const i=e[t];return typeof i=="string"?i:null}function _O(e){const t=e.tools.find(i=>i.status!=="completed"&&i.status!=="failed"&&i.status!=="error");return t?t.name??t.id:void 0}function vO(e){const t=e.trim();if(!t)return"";const i=t.split(`
91
+ `);return i[i.length-1]?.trim()??""}function bO({terminalFont:e}){const[t,i]=L.useState([]),[s,a]=L.useState(!0),[d,f]=L.useState(null),c=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??yo.id:yo.id}:{source:"system",familyName:e.customName};L.useEffect(()=>{const p=new AbortController;return a(!0),f(null),Yw({signal:p.signal}).then(g=>{p.signal.aborted||i(g.fonts.filter(m=>m.monospace).map(m=>({family:m.family,monospace:m.monospace})))}).catch(g=>{p.signal.aborted||SO(g)||(i([]),f("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[]);const h=p=>{if(p.source==="system"){m6(p.familyName);return}const g=vc.find(m=>m.id===p.id);g&&p6(g.id)};return l.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[l.jsx("div",{className:"global-settings-row",children:l.jsxs("div",{className:"global-settings-row-text",children:[l.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",l.jsx("span",{className:"new-badge",children:"New"})]}),l.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."})]})}),l.jsx("div",{"aria-describedby":"terminal-font-help",children:l.jsx(Kw,{builtIns:vc.map(p=>({id:p.id,label:p.name,family:p.family,aliases:[p.familyName],description:p.meta})),installedFonts:t,selected:c,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:yo.family,previewText:tO,size:e.size,sizeRange:eO,loading:s,error:d,onSelectionChange:h,onSizeCommit:g6})}),l.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 yO({terminalRenderer:e}){return l.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),l.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."})]}),l.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:VN.map(t=>{const i=t.id===e;return l.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,onClick:()=>f6(t.id),children:t.label},t.id)})})]})})}function SO(e){return e instanceof DOMException&&e.name==="AbortError"}function xO(e,t){if(Sc(t,e))return"track-card--live";const i=w_(e,t);return vd(i)?"track-card--bad":i==="done"||i==="aborted"?"track-card--idle":""}function wO(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function CO(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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 EO(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",fill:"currentColor"})})}function kO(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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"})})}const TO="global-shell",AO="/plugins/terminal/global/ticket",RO="/plugins/terminal/ws",LO=168,MO={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},NO={id:"global-shell",title:"Shell",icon:OO,preferredExtraWidth:LO,render:e=>l.jsx("div",{style:MO,children:l.jsx(y_,{operationId:TO,ticketPath:AO,wsPath:RO,theme:"instrument",active:!0})})};function OO(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const DO="/plugins/terminal/shell/ticket",jO="/plugins/terminal/ws",KC={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>L.createElement(IO,{context:e})},nm={id:"terminal",operationKinds:[KC],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:()=>l.jsx(BO,{})};function IO({context:e}){return l.jsx(y_,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:DO,wsPath:jO,theme:e.theme,onExit:e.onClose})}function BO(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),l.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 PO=new Set(["agent"]),zO={id:"terminal",operationKinds:[KC,UC],settingsSections:[WC],notificationKinds:[GC],railPanels:[NO],install:e=>(AC(),d6(e.settings),eh.install?.(e)),closeOperation:async e=>{const t=await $O(e);if(t?.type==="shell"){await nm.closeOperation?.(e);return}t&&PO.has(t.type)&&await eh.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?nm.launch?.(e)??{id:""}:eh.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?nm.renderLaunchIcon?.(e):eh.renderLaunchIcon?.(e)},HO=[zO];async function $O(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const i=await t.json();return typeof i.operation?.type=="string"?{type:i.operation.type}:null}const se={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"},FO={src:se.ts,lib:se.ts,app:se.ts,test:se.shell,tests:se.shell,__tests__:se.shell,spec:se.shell,specs:se.shell,node_modules:se.binary,vendor:se.binary,dist:se.config,build:se.config,out:se.config,target:se.config,docs:se.md,doc:se.md,public:se.data,assets:se.data,static:se.data,components:se.image,scripts:se.js,styles:se.css,".git":se.html,".github":se.config,".vscode":se.css},Y1={ts:{shape:"angle",tone:se.ts},tsx:{shape:"angle",tone:se.ts},mts:{shape:"angle",tone:se.ts},cts:{shape:"angle",tone:se.ts},"d.ts":{shape:"angle",tone:se.ts},js:{shape:"angle",tone:se.js},jsx:{shape:"angle",tone:se.js},mjs:{shape:"angle",tone:se.js},cjs:{shape:"angle",tone:se.js},json:{shape:"braces",tone:se.json},jsonc:{shape:"braces",tone:se.json},json5:{shape:"braces",tone:se.json},jsonl:{shape:"braces",tone:se.json},graphql:{shape:"braces",tone:se.image},gql:{shape:"braces",tone:se.image},proto:{shape:"braces",tone:se.go},css:{shape:"hash",tone:se.css},scss:{shape:"hash",tone:se.css},sass:{shape:"hash",tone:se.css},less:{shape:"hash",tone:se.css},styl:{shape:"hash",tone:se.css},html:{shape:"markup",tone:se.html},htm:{shape:"markup",tone:se.html},xml:{shape:"markup",tone:se.html},xhtml:{shape:"markup",tone:se.html},vue:{shape:"markup",tone:se.shell},svelte:{shape:"markup",tone:se.rust},astro:{shape:"markup",tone:se.image},md:{shape:"doc",tone:se.md},mdx:{shape:"doc",tone:se.md},markdown:{shape:"doc",tone:se.md},rst:{shape:"doc",tone:se.md},txt:{shape:"doc",tone:se.default},text:{shape:"doc",tone:se.default},log:{shape:"doc",tone:se.default},adoc:{shape:"doc",tone:se.md},pdf:{shape:"doc",tone:se.ruby},py:{shape:"angle",tone:se.py},pyi:{shape:"angle",tone:se.py},pyw:{shape:"angle",tone:se.py},go:{shape:"angle",tone:se.go},rs:{shape:"angle",tone:se.rust},rb:{shape:"angle",tone:se.ruby},rake:{shape:"angle",tone:se.ruby},gemspec:{shape:"angle",tone:se.ruby},java:{shape:"angle",tone:se.html},kt:{shape:"angle",tone:se.config},kts:{shape:"angle",tone:se.config},scala:{shape:"angle",tone:se.ruby},c:{shape:"angle",tone:se.ts},h:{shape:"angle",tone:se.ts},cpp:{shape:"angle",tone:se.css},cc:{shape:"angle",tone:se.css},cxx:{shape:"angle",tone:se.css},hpp:{shape:"angle",tone:se.css},cs:{shape:"angle",tone:se.config},php:{shape:"angle",tone:se.config},swift:{shape:"angle",tone:se.html},lua:{shape:"angle",tone:se.ts},dart:{shape:"angle",tone:se.go},sh:{shape:"terminal",tone:se.shell},bash:{shape:"terminal",tone:se.shell},zsh:{shape:"terminal",tone:se.shell},fish:{shape:"terminal",tone:se.shell},ps1:{shape:"terminal",tone:se.css},bat:{shape:"terminal",tone:se.shell},cmd:{shape:"terminal",tone:se.shell},yaml:{shape:"gear",tone:se.config},yml:{shape:"gear",tone:se.config},toml:{shape:"gear",tone:se.config},ini:{shape:"gear",tone:se.config},conf:{shape:"gear",tone:se.config},cfg:{shape:"gear",tone:se.config},properties:{shape:"gear",tone:se.config},env:{shape:"gear",tone:se.config},editorconfig:{shape:"gear",tone:se.config},png:{shape:"image",tone:se.image},jpg:{shape:"image",tone:se.image},jpeg:{shape:"image",tone:se.image},gif:{shape:"image",tone:se.image},webp:{shape:"image",tone:se.image},svg:{shape:"image",tone:se.image},ico:{shape:"image",tone:se.image},bmp:{shape:"image",tone:se.image},avif:{shape:"image",tone:se.image},tiff:{shape:"image",tone:se.image},heic:{shape:"image",tone:se.image},mp4:{shape:"image",tone:se.data},mov:{shape:"image",tone:se.data},webm:{shape:"image",tone:se.data},mkv:{shape:"image",tone:se.data},mp3:{shape:"chip",tone:se.shell},wav:{shape:"chip",tone:se.shell},flac:{shape:"chip",tone:se.shell},ogg:{shape:"chip",tone:se.shell},sql:{shape:"database",tone:se.data},csv:{shape:"database",tone:se.data},tsv:{shape:"database",tone:se.data},db:{shape:"database",tone:se.data},sqlite:{shape:"database",tone:se.data},sqlite3:{shape:"database",tone:se.data},parquet:{shape:"database",tone:se.data},zip:{shape:"archive",tone:se.archive},tar:{shape:"archive",tone:se.archive},gz:{shape:"archive",tone:se.archive},tgz:{shape:"archive",tone:se.archive},bz2:{shape:"archive",tone:se.archive},xz:{shape:"archive",tone:se.archive},rar:{shape:"archive",tone:se.archive},"7z":{shape:"archive",tone:se.archive},zst:{shape:"archive",tone:se.archive},bin:{shape:"chip",tone:se.binary},exe:{shape:"chip",tone:se.binary},dll:{shape:"chip",tone:se.binary},so:{shape:"chip",tone:se.binary},dylib:{shape:"chip",tone:se.binary},wasm:{shape:"chip",tone:se.config},class:{shape:"chip",tone:se.binary},lock:{shape:"chip",tone:se.binary},woff:{shape:"chip",tone:se.config},woff2:{shape:"chip",tone:se.config},ttf:{shape:"chip",tone:se.config},otf:{shape:"chip",tone:se.config}},UO={dockerfile:{shape:"chip",tone:se.css},"docker-compose.yml":{shape:"gear",tone:se.css},"docker-compose.yaml":{shape:"gear",tone:se.css},makefile:{shape:"gear",tone:se.html},"cmakelists.txt":{shape:"gear",tone:se.html},".gitignore":{shape:"gear",tone:se.html},".gitattributes":{shape:"gear",tone:se.html},".dockerignore":{shape:"gear",tone:se.html},".npmignore":{shape:"gear",tone:se.html},".npmrc":{shape:"gear",tone:se.ruby},"package.json":{shape:"braces",tone:se.shell},"tsconfig.json":{shape:"braces",tone:se.ts},license:{shape:"doc",tone:se.json},"license.md":{shape:"doc",tone:se.json},licence:{shape:"doc",tone:se.json}},WO={shape:"default",tone:se.default},hg={angle:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),l.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"}),l.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),l.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),l.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),l.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),l.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),l.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"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:l.jsxs(l.Fragment,{children:[l.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),l.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"}),l.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),l.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"}),l.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),l.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),l.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),l.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:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:l.jsxs(l.Fragment,{children:[l.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"}),l.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:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.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"}),l.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 GO({name:e}){const t=KO(e);return l.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:hg[t.shape]})}function qO({name:e,open:t}){const i=FO[e.toLowerCase()]??se.folder;return l.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${i})`},children:t?hg.folderOpen:hg.folderClosed})}function KO(e){const t=e.toLowerCase(),i=UO[t];if(i)return i;if(t.startsWith(".env"))return{shape:"gear",tone:se.config};if(t.startsWith("readme"))return{shape:"doc",tone:se.md};if(t.endsWith(".d.ts"))return Y1["d.ts"];const s=t.lastIndexOf(".");if(s>0&&s<t.length-1){const a=t.slice(s+1),d=Y1[a];if(d)return d}return WO}function VO(e,t){return`${e??""}:${t??""}`}function dg(e,t){const i=Gh(t);if(i===null)return null;const s=e?Gh(e):"";return s===null?null:s?i?`${s}/${i}`:s:i}function Eh(e,t){const i=Gh(t),s=e?Gh(e):"";return i===null||s===null?null:s?i===s?"":i.startsWith(`${s}/`)?i.slice(s.length+1):null:i}function VC(e,t){const i=Eh(e,t.relativePath);if(i===null)return null;const s=i===""||t.parentRelativePath===null?null:Eh(e,t.parentRelativePath);if(i!==""&&t.parentRelativePath!==null&&s===null)return null;const a=[];for(const d of t.entries){const f=Eh(e,d.relativePath);f!==null&&a.push({...d,relativePath:f})}return{...t,relativePath:i,parentRelativePath:s,entries:a}}function YO(e,t){return Eh(e,t)}function Gh(e){if(e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;const t=[];for(const i of e.replaceAll("\\","/").split("/"))if(!(!i||i===".")){if(i==="..")return null;t.push(i)}return t.join("/")}const XO=200,th=30,X1=5,YC="fleet-console.fileExplorer.showHidden",Z1=500;function nr(e,t){return e===t}async function ZO({entries:e,cachedResults:t,files:i,showHidden:s,isCurrent:a,onFolderResult:d}){const f=[],c=new Map(t),h=new Set,p=new Set;let g=0;const m=S=>{for(const w of S)if(!(!QO(w,s)||h.has(w.relativePath))){if(h.size>=Z1)return;h.add(w.relativePath),f.push(w)}};for(m(e);f.length>0&&a();){const S=f.shift();if(!S)return;const w=c.get(S.relativePath);if(w){if(p.has(w.relativePath))continue;p.add(w.relativePath),m(w.entries);continue}if(g>=Z1)return;g+=1;try{const T=await i.listFolder(S.relativePath);if(!a())return;if(c.set(S.relativePath,T),d(S.relativePath,T),p.has(T.relativePath))continue;p.add(T.relativePath),m(T.entries)}catch{}}}function XC(e,t,i,s,a,d,f,c,h=new Set){const p=[];for(const g of e){if(!c&&g.name.startsWith("."))continue;const m=d.get(g.relativePath),S=m?.entries,w=m?.relativePath??g.relativePath,T=g.kind==="dir"&&h.has(w),C=g.kind==="dir"&&!T&&ZC(S??[],d,f,c);if(f&&!g.name.toLowerCase().includes(f)&&!C)continue;const _=s.has(g.relativePath)||!!(f&&C);if(p.push({entry:g,depth:t,isSelected:i===g.relativePath,isExpanded:_,isLoading:a.has(g.relativePath)}),g.kind==="dir"&&_&&!T&&S){const b=new Set(h);b.add(w),p.push(...XC(S,t+1,i,s,a,d,f,c,b))}}return p}function JO({contextKey:e,contextRelPath:t,files:i,theaterId:s,selectedPath:a,onSelect:d}){const[f,c]=L.useState(null),[h,p]=L.useState(null),[g,m]=L.useState(""),[S,w]=L.useState(new Set),[T,C]=L.useState(new Set),[_,b]=L.useState(new Map),[v,y]=L.useState(""),[k,M]=L.useState(0),[R,N]=L.useState(600),[A,I]=L.useState(()=>eD()),$=L.useRef(null),H=L.useRef(S);H.current=S;const q=L.useRef(g);q.current=g;const B=L.useRef(i);B.current=i;const Y=L.useRef(e);Y.current=e;const G=L.useRef(_);G.current=_;const P=L.useRef(0),K=!!v;L.useEffect(()=>{s&&(c(null),p(null),m(""),w(new Set),b(new Map),y(""),M(0))},[e,s]),L.useEffect(()=>{if(!s)return;const pe=e;i.listFolder(g||void 0).then(xe=>{nr(pe,Y.current)&&(c(xe),p(null))}).catch(xe=>{nr(pe,Y.current)&&p(xe instanceof Error?xe.message:"Unable to load folder")})},[e,s,g,i]),L.useEffect(()=>{const pe=++P.current;if(!K||!f)return;let xe=!0;const Le=e,Pe=()=>xe&&pe===P.current&&nr(Le,Y.current);return ZO({entries:f.entries,cachedResults:G.current,files:i,showHidden:A,isCurrent:Pe,onFolderResult:(Ue,Ae)=>{Pe()&&b(ye=>new Map(ye).set(Ue,Ae))}}),()=>{xe=!1}},[e,i,K,f,A]),L.useEffect(()=>{const pe=$.current;if(!pe)return;const xe=new ResizeObserver(()=>N(pe.clientHeight));return xe.observe(pe),N(pe.clientHeight),()=>xe.disconnect()},[]),L.useEffect(()=>{if(!s)return;let pe=!0;const xe=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(s)}`,Le=new EventSource(xe),Pe=()=>{const Ae=e;B.current.listFolder(q.current||void 0).then(ye=>{nr(Ae,Y.current)&&(c(ye),p(null))}).catch(()=>{})},Ue=()=>{Pe();for(const Ae of H.current){const ye=e;B.current.listFolder(Ae).then(Oe=>{nr(ye,Y.current)&&b(xt=>new Map(xt).set(Ae,Oe))}).catch(()=>{})}};return Le.addEventListener("change",Ae=>{let ye;try{ye=JSON.parse(Ae.data)}catch{return}if(typeof ye!="string")return;const Oe=YO(t,ye);if(Oe!==null&&((Oe===""||Oe===q.current)&&Pe(),Oe!==""&&H.current.has(Oe))){const xt=e;B.current.listFolder(Oe).then(Wn=>{nr(xt,Y.current)&&b(Gn=>new Map(Gn).set(Oe,Wn))}).catch(()=>{})}}),Le.onopen=()=>{if(pe){pe=!1;return}Ue()},()=>{Le.close()}},[t,s,i]);const V=L.useCallback(pe=>{const xe=pe.relativePath,Le=!S.has(xe);if(w(Pe=>{const Ue=new Set(Pe);return Ue.has(xe)?(Ue.delete(xe),Ue):(Ue.add(xe),Ue)}),Le){const Pe=e;C(Ue=>new Set(Ue).add(xe)),i.listFolder(xe).then(Ue=>{nr(Pe,Y.current)&&(b(Ae=>new Map(Ae).set(xe,Ue)),C(Ae=>{const ye=new Set(Ae);return ye.delete(xe),ye}))}).catch(()=>{nr(Pe,Y.current)&&C(Ue=>{const Ae=new Set(Ue);return Ae.delete(xe),Ae})})}},[e,i,S]),O=L.useCallback(pe=>{pe.kind==="dir"?V(pe):d(pe)},[V,d]),z=L.useCallback(pe=>{M(pe.currentTarget.scrollTop)},[]),j=L.useCallback(()=>{I(pe=>{const xe=!pe;try{localStorage.setItem(YC,xe?"1":"0")}catch{}return xe})},[]),W=L.useCallback(()=>{if(!s)return;const pe=e;i.listFolder(g||void 0).then(xe=>{nr(pe,Y.current)&&(c(xe),p(null))}).catch(xe=>{nr(pe,Y.current)&&p(xe instanceof Error?xe.message:"Unable to load folder")});for(const xe of S)i.listFolder(xe).then(Le=>{nr(pe,Y.current)&&b(Pe=>new Map(Pe).set(xe,Le))}).catch(()=>{})},[e,i,g,S,s]),Z=v.toLowerCase(),ne=L.useMemo(()=>f?XC(f.entries,0,a,S,T,_,Z,A):[],[f,a,S,T,_,Z,A]),te=!A&&f!==null&&f.entries.length>0&&ne.length===0&&!v,he=ne.length>XO,J=he?Math.max(0,Math.floor(k/th)-X1):0,F=he?Math.min(ne.length,Math.ceil((k+R)/th)+X1):ne.length,ae=ne.slice(J,F),fe=ne.length*th,Ce=J*th;return s?h&&!f?l.jsx("div",{className:"fexp-tree-error",children:h}):f?l.jsxs("div",{className:"fexp-tree-container",children:[l.jsxs("div",{className:"fexp-filter",children:[l.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:v,onChange:pe=>y(pe.target.value),"aria-label":"Filter files"}),v&&l.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>y(""),"aria-label":"Clear filter",children:"✕"}),l.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:W,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),l.jsx("button",{type:"button",className:`fexp-hidden-toggle${A?" is-active":""}`,onClick:j,"aria-pressed":A,"aria-label":A?"Hide hidden files":"Show hidden files",title:A?"Hide hidden files":"Show hidden files",children:A?l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[l.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[l.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),l.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),l.jsxs("div",{ref:$,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:he?z:void 0,children:[!1,he?l.jsx("div",{style:{height:fe,position:"relative"},children:l.jsx("div",{style:{transform:`translateY(${Ce}px)`},children:ae.map(pe=>l.jsx(J1,{row:pe,onEntryClick:O},pe.entry.relativePath))})}):ae.map(pe=>l.jsx(J1,{row:pe,onEntryClick:O},pe.entry.relativePath)),ne.length===0&&v&&l.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),ne.length===0&&!v&&f.entries.length===0&&l.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),te&&l.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):l.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):l.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function ZC(e,t,i,s,a=new Set){for(const d of e)if(!(!s&&d.name.startsWith("."))){if(d.name.toLowerCase().includes(i))return!0;if(d.kind==="dir"){const f=t.get(d.relativePath);if(f&&!a.has(f.relativePath)){const c=new Set(a);if(c.add(f.relativePath),ZC(f.entries,t,i,s,c))return!0}}}return!1}function QO(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function J1({row:e,onEntryClick:t}){const{entry:i,depth:s,isSelected:a,isExpanded:d,isLoading:f}=e,c=i.kind==="dir",h=s*16,p=L.useCallback(()=>t(i),[i,t]);return l.jsxs("button",{className:`fexp-tree-row${a?" is-cur":""}${c?" is-dir":" is-file"}`,style:{paddingLeft:`${h+12}px`},type:"button",role:"treeitem","aria-selected":a,"aria-expanded":c?d:void 0,onClick:p,children:[l.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:c?l.jsx(qO,{name:i.name,open:d}):l.jsx(GO,{name:i.name})}),l.jsx("span",{className:"fexp-tree-name",children:i.name}),f&&l.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function eD(){try{return localStorage.getItem(YC)==="1"}catch{return!1}}function tD({name:e,sizeHint:t}){return l.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[l.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),l.jsx("p",{className:"fexp-bin-name",children:e}),t&&l.jsx("p",{className:"fexp-bin-meta",children:t}),l.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function nD(e,t){switch(t){case"typescript":case"javascript":return rD(e);case"json":return sD(e);case"python":return oD(e);case"css":case"scss":case"sass":case"less":return lD(e);case"html":case"xml":return cD(e);case"bash":case"shell":return uD(e);case"yaml":return hD(e);default:return[{kind:"text",value:e}]}}const iD=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 rD(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),a=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:a}),i+=a.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
92
+ `,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==="`"){const{slice:s,length:a}=Os(e,i,"`","`");t.push({kind:"str",value:s}),i+=a;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Os(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;continue}if(/[0-9]/.test(e[i])||e[i]==="."&&/[0-9]/.test(e[i+1]??"")){const s=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z_$]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_$][\w$]*/);if(s){const a=s[0],d=e.slice(i+a.length).match(/^\s*\(/);iD.has(a)?t.push({kind:"key",value:a}):d?t.push({kind:"fn",value:a}):t.push({kind:"text",value:a}),i+=a.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}function sD(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==='"'){const{slice:s,length:a}=Os(e,i,'"','"'),f=e.slice(i+a).trimStart().startsWith(":");t.push({kind:f?"attr":"str",value:s}),i+=a;continue}if(/[0-9\-]/.test(e[i])){const s=e.slice(i).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(e.startsWith("true",i)||e.startsWith("false",i)||e.startsWith("null",i)){const s=e.slice(i).match(/^(true|false|null)/);if(s){t.push({kind:"key",value:s[0]}),i+=s[0].length;continue}}if(/[{}[\]:,]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}const aD=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 oD(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
93
+ `,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e.startsWith('"""',i)||e.startsWith("'''",i)){const s=e.slice(i,i+3),a=e.indexOf(s,i+3),d=a===-1?e.slice(i):e.slice(i,a+3);t.push({kind:"str",value:d}),i+=d.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Os(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;continue}if(/[0-9]/.test(e[i])){const s=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z_]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_]\w*/);if(s){const a=s[0],d=e.slice(i+a.length).match(/^\s*\(/);aD.has(a)?t.push({kind:"key",value:a}):d?t.push({kind:"fn",value:a}):t.push({kind:"text",value:a}),i+=a.length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function lD(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),a=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:a}),i+=a.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
94
+ `,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Os(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;continue}if(e[i]==="."||e[i]==="#"||e[i]===":"){const s=e.slice(i).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(s){t.push({kind:"tag",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z-]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z-][\w-]*/);if(s){const a=s[0];e.slice(i+a.length).trimStart().startsWith(":")?t.push({kind:"attr",value:a}):t.push({kind:"text",value:a}),i+=a.length;continue}}if(/[0-9]/.test(e[i])){const s=e.slice(i).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function cD(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("<!--",i)){const s=e.indexOf("-->",i+4),a=s===-1?e.slice(i):e.slice(i,s+3);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==="<"){t.push({kind:"punct",value:"<"}),i++,e[i]==="/"&&(t.push({kind:"punct",value:"/"}),i++);const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);s&&(t.push({kind:"tag",value:s[0]}),i+=s[0].length);continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Os(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;continue}if(/[a-zA-Z]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);if(s){const a=e.slice(i+s[0].length).trimStart();t.push({kind:a.startsWith("=")?"attr":"text",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function uD(e){const t=[];let i=0;const s=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(;i<e.length;){if(e[i]==="#"){const a=e.indexOf(`
95
+ `,i),d=a===-1?e.slice(i):e.slice(i,a);t.push({kind:"com",value:d}),i+=d.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:a,length:d}=Os(e,i,e[i],e[i]);t.push({kind:"str",value:a}),i+=d;continue}if(/[a-zA-Z_]/.test(e[i])){const a=e.slice(i).match(/^[a-zA-Z_][\w]*/);if(a){t.push({kind:s.has(a[0])?"key":"text",value:a[0]}),i+=a[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function hD(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
96
+ `,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Os(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;continue}if(/[a-zA-Z_]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_][\w-]*/);if(s){e.slice(i+s[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:s[0]}):["true","false","null","yes","no","on","off"].includes(s[0])?t.push({kind:"key",value:s[0]}):t.push({kind:"text",value:s[0]}),i+=s[0].length;continue}}if(/[0-9\-]/.test(e[i])){const s=e.slice(i).match(/^-?[\d]*\.?[\d]+/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function Os(e,t,i,s){let a=t+i.length;for(;a<e.length;){if(e[a]==="\\"){a+=2;continue}if(e.startsWith(s,a)){a+=s.length;break}if(s!=="`"&&e[a]===`
97
+ `)break;a++}return{slice:e.slice(t,a),length:a-t}}function dD({content:e,lang:t,truncated:i}){const s=L.useMemo(()=>fD(e,t),[e,t]);return l.jsxs("div",{className:"fexp-code-wrap",children:[i&&l.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),l.jsx("div",{className:"fexp-code-scroll",children:l.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:l.jsx("tbody",{children:s.map((a,d)=>l.jsxs("tr",{className:"fexp-code-row",children:[l.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:d+1}),l.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:a}})]},d))})})})]})}function fD(e,t){return e.split(`
98
+ `).map(s=>pD(s,t))}function pD(e,t){return t==="plaintext"||t==="markdown"?Q1(e)||" ":nD(e,t).map(s=>{const a=Q1(s.value);return s.kind==="text"?a:`<span class="syn-${s.kind}">${a}</span>`}).join("")||" "}function Q1(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function mD({src:e,name:t}){return l.jsxs("div",{className:"fexp-img-wrap",children:[l.jsx("div",{className:"fexp-img-stage",children:l.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),l.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}function C_(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var va=C_();function JC(e){va=e}var ac={exec:()=>null};function bt(e,t=""){let i=typeof e=="string"?e:e.source,s={replace:(a,d)=>{let f=typeof d=="string"?d:d.source;return f=f.replace(ri.caret,"$1"),i=i.replace(a,f),s},getRegex:()=>new RegExp(i,t)};return s}var gD=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ri={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")},_D=/^(?:[ \t]*(?:\n|$))+/,vD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,bD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,E_=/(?:[*+-]|\d{1,9}[.)])/,QC=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,e2=bt(QC).replace(/bull/g,E_).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(),SD=bt(QC).replace(/bull/g,E_).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(),k_=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xD=/^[^\n]+/,T_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,wD=bt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",T_).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),CD=bt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,E_).getRegex(),bd="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",A_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ED=bt("^ {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",A_).replace("tag",bd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),t2=bt(k_).replace("hr",Nc).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",bd).getRegex(),kD=bt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",t2).getRegex(),R_={blockquote:kD,code:vD,def:wD,fences:bD,heading:yD,hr:Nc,html:ED,lheading:e2,list:CD,newline:_D,paragraph:t2,table:ac,text:xD},eS=bt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nc).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",bd).getRegex(),TD={...R_,lheading:SD,table:eS,paragraph:bt(k_).replace("hr",Nc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",eS).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",bd).getRegex()},AD={...R_,html:bt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",A_).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:ac,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:bt(k_).replace("hr",Nc).replace("heading",` *#{1,6} *[^
99
+ ]`).replace("lheading",e2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},RD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,LD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,n2=/^( {2,}|\\)\n(?!\s*$)/,MD=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,yd=/[\p{P}\p{S}]/u,L_=/[\s\p{P}\p{S}]/u,i2=/[^\s\p{P}\p{S}]/u,ND=bt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,L_).getRegex(),r2=/(?!~)[\p{P}\p{S}]/u,OD=/(?!~)[\s\p{P}\p{S}]/u,DD=/(?:[^\s\p{P}\p{S}]|~)/u,jD=bt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",gD?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),s2=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ID=bt(s2,"u").replace(/punct/g,yd).getRegex(),BD=bt(s2,"u").replace(/punct/g,r2).getRegex(),a2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",PD=bt(a2,"gu").replace(/notPunctSpace/g,i2).replace(/punctSpace/g,L_).replace(/punct/g,yd).getRegex(),zD=bt(a2,"gu").replace(/notPunctSpace/g,DD).replace(/punctSpace/g,OD).replace(/punct/g,r2).getRegex(),HD=bt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,i2).replace(/punctSpace/g,L_).replace(/punct/g,yd).getRegex(),$D=bt(/\\(punct)/,"gu").replace(/punct/g,yd).getRegex(),FD=bt(/^<(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(),UD=bt(A_).replace("(?:-->|$)","-->").getRegex(),WD=bt("^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",UD).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,GD=bt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",qh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),o2=bt(/^!?\[(label)\]\[(ref)\]/).replace("label",qh).replace("ref",T_).getRegex(),l2=bt(/^!?\[(ref)\](?:\[\])?/).replace("ref",T_).getRegex(),qD=bt("reflink|nolink(?!\\()","g").replace("reflink",o2).replace("nolink",l2).getRegex(),tS=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,M_={_backpedal:ac,anyPunctuation:$D,autolink:FD,blockSkip:jD,br:n2,code:LD,del:ac,emStrongLDelim:ID,emStrongRDelimAst:PD,emStrongRDelimUnd:HD,escape:RD,link:GD,nolink:l2,punctuation:ND,reflink:o2,reflinkSearch:qD,tag:WD,text:MD,url:ac},KD={...M_,link:bt(/^!?\[(label)\]\((.*?)\)/).replace("label",qh).getRegex(),reflink:bt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qh).getRegex()},fg={...M_,emStrongRDelimAst:zD,emStrongLDelim:BD,url:bt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",tS).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:bt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",tS).getRegex()},VD={...fg,br:bt(n2).replace("{2,}","*").getRegex(),text:bt(fg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nh={normal:R_,gfm:TD,pedantic:AD},Bl={normal:M_,gfm:fg,breaks:VD,pedantic:KD},YD={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nS=e=>YD[e];function vr(e,t){if(t){if(ri.escapeTest.test(e))return e.replace(ri.escapeReplace,nS)}else if(ri.escapeTestNoEncode.test(e))return e.replace(ri.escapeReplaceNoEncode,nS);return e}function iS(e){try{e=encodeURI(e).replace(ri.percentDecode,"%")}catch{return null}return e}function rS(e,t){let i=e.replace(ri.findPipe,(d,f,c)=>{let h=!1,p=f;for(;--p>=0&&c[p]==="\\";)h=!h;return h?"|":" |"}),s=i.split(ri.splitPipe),a=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(ri.slashPipe,"|");return s}function Pl(e,t,i){let s=e.length;if(s===0)return"";let a=0;for(;a<s&&e.charAt(s-a-1)===t;)a++;return e.slice(0,s-a)}function XD(e,t){if(e.indexOf(t[1])===-1)return-1;let i=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return i>0?-2:-1}function sS(e,t,i,s,a){let d=t.href,f=t.title||null,c=e[1].replace(a.other.outputLinkReplace,"$1");s.state.inLink=!0;let h={type:e[0].charAt(0)==="!"?"image":"link",raw:i,href:d,title:f,text:c,tokens:s.inlineTokens(c)};return s.state.inLink=!1,h}function ZD(e,t,i){let s=e.match(i.other.indentCodeCompensation);if(s===null)return t;let a=s[1];return t.split(`
100
+ `).map(d=>{let f=d.match(i.other.beginningSpace);if(f===null)return d;let[c]=f;return c.length>=a.length?d.slice(a.length):d}).join(`
101
+ `)}var Kh=class{options;rules;lexer;constructor(e){this.options=e||va}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 i=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Pl(i,`
102
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],s=ZD(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let s=Pl(i,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(i=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Pl(t[0],`
103
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=Pl(t[0],`
104
+ `).split(`
105
+ `),s="",a="",d=[];for(;i.length>0;){let f=!1,c=[],h;for(h=0;h<i.length;h++)if(this.rules.other.blockquoteStart.test(i[h]))c.push(i[h]),f=!0;else if(!f)c.push(i[h]);else break;i=i.slice(h);let p=c.join(`
106
+ `),g=p.replace(this.rules.other.blockquoteSetextReplace,`
107
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
108
+ ${p}`:p,a=a?`${a}
109
+ ${g}`:g;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,d,!0),this.lexer.state.top=m,i.length===0)break;let S=d.at(-1);if(S?.type==="code")break;if(S?.type==="blockquote"){let w=S,T=w.raw+`
110
+ `+i.join(`
111
+ `),C=this.blockquote(T);d[d.length-1]=C,s=s.substring(0,s.length-w.raw.length)+C.raw,a=a.substring(0,a.length-w.text.length)+C.text;break}else if(S?.type==="list"){let w=S,T=w.raw+`
112
+ `+i.join(`
113
+ `),C=this.list(T);d[d.length-1]=C,s=s.substring(0,s.length-S.raw.length)+C.raw,a=a.substring(0,a.length-w.raw.length)+C.raw,i=T.substring(d.at(-1).raw.length).split(`
114
+ `);continue}}return{type:"blockquote",raw:s,tokens:d,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim(),s=i.length>1,a={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let d=this.rules.other.listItemRegex(i),f=!1;for(;e;){let h=!1,p="",g="";if(!(t=d.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let m=t[2].split(`
115
+ `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),S=e.split(`
116
+ `,1)[0],w=!m.trim(),T=0;if(this.options.pedantic?(T=2,g=m.trimStart()):w?T=t[1].length+1:(T=t[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,g=m.slice(T),T+=t[1].length),w&&this.rules.other.blankLine.test(S)&&(p+=S+`
117
+ `,e=e.substring(S.length+1),h=!0),!h){let b=this.rules.other.nextBulletRegex(T),v=this.rules.other.hrRegex(T),y=this.rules.other.fencesBeginRegex(T),k=this.rules.other.headingBeginRegex(T),M=this.rules.other.htmlBeginRegex(T);for(;e;){let R=e.split(`
118
+ `,1)[0],N;if(S=R,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),N=S):N=S.replace(this.rules.other.tabCharGlobal," "),y.test(S)||k.test(S)||M.test(S)||b.test(S)||v.test(S))break;if(N.search(this.rules.other.nonSpaceChar)>=T||!S.trim())g+=`
119
+ `+N.slice(T);else{if(w||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(m)||k.test(m)||v.test(m))break;g+=`
120
+ `+S}!w&&!S.trim()&&(w=!0),p+=R+`
121
+ `,e=e.substring(R.length+1),m=N.slice(T)}}a.loose||(f?a.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(f=!0));let C=null,_;this.options.gfm&&(C=this.rules.other.listIsTask.exec(g),C&&(_=C[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:p,task:!!C,checked:_,loose:!1,text:g,tokens:[]}),a.raw+=p}let c=a.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let h=0;h<a.items.length;h++)if(this.lexer.state.top=!1,a.items[h].tokens=this.lexer.blockTokens(a.items[h].text,[]),!a.loose){let p=a.items[h].tokens.filter(m=>m.type==="space"),g=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));a.loose=g}if(a.loose)for(let h=0;h<a.items.length;h++)a.items[h].loose=!0;return a}}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 i=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:t[0],href:s,title:a}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=rS(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
122
+ `):[],d={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(let f of s)this.rules.other.tableAlignRight.test(f)?d.align.push("right"):this.rules.other.tableAlignCenter.test(f)?d.align.push("center"):this.rules.other.tableAlignLeft.test(f)?d.align.push("left"):d.align.push(null);for(let f=0;f<i.length;f++)d.header.push({text:i[f],tokens:this.lexer.inline(i[f]),header:!0,align:d.align[f]});for(let f of a)d.rows.push(rS(f,d.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:d.align[h]})));return d}}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 i=t[1].charAt(t[1].length-1)===`
123
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}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 i=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let d=Pl(i.slice(0,-1),"\\");if((i.length-d.length)%2===0)return}else{let d=XD(t[2],"()");if(d===-2)return;if(d>-1){let f=(t[0].indexOf("!")===0?5:4)+t[1].length+d;t[2]=t[2].substring(0,d),t[0]=t[0].substring(0,f).trim(),t[3]=""}}let s=t[2],a="";if(this.options.pedantic){let d=this.rules.other.pedanticHrefTitle.exec(s);d&&(s=d[1],a=d[3])}else a=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?s=s.slice(1):s=s.slice(1,-1)),sS(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let s=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=t[s.toLowerCase()];if(!a){let d=i[0].charAt(0);return{type:"text",raw:d,text:d}}return sS(i,a,i[0],this.lexer,this.rules)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!i||this.rules.inline.punctuation.exec(i))){let a=[...s[0]].length-1,d,f,c=a,h=0,p=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+a);(s=p.exec(t))!=null;){if(d=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!d)continue;if(f=[...d].length,s[3]||s[4]){c+=f;continue}else if((s[5]||s[6])&&a%3&&!((a+f)%3)){h+=f;continue}if(c-=f,c>0)continue;f=Math.min(f,f+c+h);let g=[...s[0]][0].length,m=e.slice(0,a+s.index+g+f);if(Math.min(a,f)%2){let w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}let S=m.slice(2,-2);return{type:"strong",raw:m,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(i),a=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return s&&a&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}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 i,s;return t[2]==="@"?(i=t[1],s="mailto:"+i):(i=t[1],s=i),{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,s;if(t[2]==="@")i=t[0],s="mailto:"+i;else{let a;do a=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(a!==t[0]);i=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:i}}}},ir=class pg{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||va,this.options.tokenizer=this.options.tokenizer||new Kh,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 i={other:ri,block:nh.normal,inline:Bl.normal};this.options.pedantic?(i.block=nh.pedantic,i.inline=Bl.pedantic):this.options.gfm&&(i.block=nh.gfm,this.options.breaks?i.inline=Bl.breaks:i.inline=Bl.gfm),this.tokenizer.rules=i}static get rules(){return{block:nh,inline:Bl}}static lex(t,i){return new pg(i).lex(t)}static lexInline(t,i){return new pg(i).inlineTokens(t)}lex(t){t=t.replace(ri.carriageReturn,`
124
+ `),this.blockTokens(t,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let s=this.inlineQueue[i];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,i=[],s=!1){for(this.options.pedantic&&(t=t.replace(ri.tabCharGlobal," ").replace(ri.spaceLine,""));t;){let a;if(this.options.extensions?.block?.some(f=>(a=f.call({lexer:this},t,i))?(t=t.substring(a.raw.length),i.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let f=i.at(-1);a.raw.length===1&&f!==void 0?f.raw+=`
125
+ `:i.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let f=i.at(-1);f?.type==="paragraph"||f?.type==="text"?(f.raw+=(f.raw.endsWith(`
126
+ `)?"":`
127
+ `)+a.raw,f.text+=`
128
+ `+a.text,this.inlineQueue.at(-1).src=f.text):i.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let f=i.at(-1);f?.type==="paragraph"||f?.type==="text"?(f.raw+=(f.raw.endsWith(`
129
+ `)?"":`
130
+ `)+a.raw,f.text+=`
131
+ `+a.raw,this.inlineQueue.at(-1).src=f.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},i.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),i.push(a);continue}let d=t;if(this.options.extensions?.startBlock){let f=1/0,c=t.slice(1),h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},c),typeof h=="number"&&h>=0&&(f=Math.min(f,h))}),f<1/0&&f>=0&&(d=t.substring(0,f+1))}if(this.state.top&&(a=this.tokenizer.paragraph(d))){let f=i.at(-1);s&&f?.type==="paragraph"?(f.raw+=(f.raw.endsWith(`
132
+ `)?"":`
133
+ `)+a.raw,f.text+=`
134
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):i.push(a),s=d.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let f=i.at(-1);f?.type==="text"?(f.raw+=(f.raw.endsWith(`
135
+ `)?"":`
136
+ `)+a.raw,f.text+=`
137
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):i.push(a);continue}if(t){let f="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}inlineTokens(t,i=[]){let s=t,a=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,a.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let d;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)d=a[2]?a[2].length:0,s=s.slice(0,a.index+d)+"["+"a".repeat(a[0].length-d-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let f=!1,c="";for(;t;){f||(c=""),f=!1;let h;if(this.options.extensions?.inline?.some(g=>(h=g.call({lexer:this},t,i))?(t=t.substring(h.raw.length),i.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);let g=i.at(-1);h.type==="text"&&g?.type==="text"?(g.raw+=h.raw,g.text+=h.text):i.push(h);continue}if(h=this.tokenizer.emStrong(t,s,c)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.del(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),i.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),i.push(h);continue}let p=t;if(this.options.extensions?.startInline){let g=1/0,m=t.slice(1),S;this.options.extensions.startInline.forEach(w=>{S=w.call({lexer:this},m),typeof S=="number"&&S>=0&&(g=Math.min(g,S))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(h=this.tokenizer.inlineText(p)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(c=h.raw.slice(-1)),f=!0;let g=i.at(-1);g?.type==="text"?(g.raw+=h.raw,g.text+=h.text):i.push(h);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return i}},Vh=class{options;parser;constructor(e){this.options=e||va}space(e){return""}code({text:e,lang:t,escaped:i}){let s=(t||"").match(ri.notSpaceStart)?.[0],a=e.replace(ri.endingNewline,"")+`
138
+ `;return s?'<pre><code class="language-'+vr(s)+'">'+(i?a:vr(a,!0))+`</code></pre>
139
+ `:"<pre><code>"+(i?a:vr(a,!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,i=e.start,s="";for(let f=0;f<e.items.length;f++){let c=e.items[f];s+=this.listitem(c)}let a=t?"ol":"ul",d=t&&i!==1?' start="'+i+'"':"";return"<"+a+d+`>
145
+ `+s+"</"+a+`>
146
+ `}listitem(e){let t="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=i+" "+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=i+" "+vr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):t+=i+" "}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="",i="";for(let a=0;a<e.header.length;a++)i+=this.tablecell(e.header[a]);t+=this.tablerow({text:i});let s="";for(let a=0;a<e.rows.length;a++){let d=e.rows[a];i="";for(let f=0;f<d.length;f++)i+=this.tablecell(d[f]);s+=this.tablerow({text:i})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
149
+ <thead>
150
+ `+t+`</thead>
151
+ `+s+`</table>
152
+ `}tablerow({text:e}){return`<tr>
153
+ ${e}</tr>
154
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`</${i}>
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>${vr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:i}){let s=this.parser.parseInline(i),a=iS(e);if(a===null)return s;e=a;let d='<a href="'+e+'"';return t&&(d+=' title="'+vr(t)+'"'),d+=">"+s+"</a>",d}image({href:e,title:t,text:i,tokens:s}){s&&(i=this.parser.parseInline(s,this.parser.textRenderer));let a=iS(e);if(a===null)return vr(i);e=a;let d=`<img src="${e}" alt="${i}"`;return t&&(d+=` title="${vr(t)}"`),d+=">",d}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:vr(e.text)}},N_=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""}},rr=class mg{options;renderer;textRenderer;constructor(t){this.options=t||va,this.options.renderer=this.options.renderer||new Vh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new N_}static parse(t,i){return new mg(i).parse(t)}static parseInline(t,i){return new mg(i).parseInline(t)}parse(t,i=!0){let s="";for(let a=0;a<t.length;a++){let d=t[a];if(this.options.extensions?.renderers?.[d.type]){let c=d,h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){s+=h||"";continue}}let f=d;switch(f.type){case"space":{s+=this.renderer.space(f);continue}case"hr":{s+=this.renderer.hr(f);continue}case"heading":{s+=this.renderer.heading(f);continue}case"code":{s+=this.renderer.code(f);continue}case"table":{s+=this.renderer.table(f);continue}case"blockquote":{s+=this.renderer.blockquote(f);continue}case"list":{s+=this.renderer.list(f);continue}case"html":{s+=this.renderer.html(f);continue}case"def":{s+=this.renderer.def(f);continue}case"paragraph":{s+=this.renderer.paragraph(f);continue}case"text":{let c=f,h=this.renderer.text(c);for(;a+1<t.length&&t[a+1].type==="text";)c=t[++a],h+=`
156
+ `+this.renderer.text(c);i?s+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):s+=h;continue}default:{let c='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}parseInline(t,i=this.renderer){let s="";for(let a=0;a<t.length;a++){let d=t[a];if(this.options.extensions?.renderers?.[d.type]){let c=this.options.extensions.renderers[d.type].call({parser:this},d);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){s+=c||"";continue}}let f=d;switch(f.type){case"escape":{s+=i.text(f);break}case"html":{s+=i.html(f);break}case"link":{s+=i.link(f);break}case"image":{s+=i.image(f);break}case"strong":{s+=i.strong(f);break}case"em":{s+=i.em(f);break}case"codespan":{s+=i.codespan(f);break}case"br":{s+=i.br(f);break}case"del":{s+=i.del(f);break}case"text":{s+=i.text(f);break}default:{let c='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}},Jl=class{options;block;constructor(e){this.options=e||va}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?ir.lex:ir.lexInline}provideParser(){return this.block?rr.parse:rr.parseInline}},c2=class{defaults=C_();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=rr;Renderer=Vh;TextRenderer=N_;Lexer=ir;Tokenizer=Kh;Hooks=Jl;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(let s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{let a=s;for(let d of a.header)i=i.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let f of d)i=i.concat(this.walkTokens(f.tokens,t));break}case"list":{let a=s;i=i.concat(this.walkTokens(a.items,t));break}default:{let a=s;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let f=a[d].flat(1/0);i=i.concat(this.walkTokens(f,t))}):a.tokens&&(i=i.concat(this.walkTokens(a.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let s={...i};if(s.async=this.defaults.async||s.async||!1,i.extensions&&(i.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let d=t.renderers[a.name];d?t.renderers[a.name]=function(...f){let c=a.renderer.apply(this,f);return c===!1&&(c=d.apply(this,f)),c}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=t[a.level];d?d.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),s.extensions=t),i.renderer){let a=this.defaults.renderer||new Vh(this.defaults);for(let d in i.renderer){if(!(d in a))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let f=d,c=i.renderer[f],h=a[f];a[f]=(...p)=>{let g=c.apply(a,p);return g===!1&&(g=h.apply(a,p)),g||""}}s.renderer=a}if(i.tokenizer){let a=this.defaults.tokenizer||new Kh(this.defaults);for(let d in i.tokenizer){if(!(d in a))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let f=d,c=i.tokenizer[f],h=a[f];a[f]=(...p)=>{let g=c.apply(a,p);return g===!1&&(g=h.apply(a,p)),g}}s.tokenizer=a}if(i.hooks){let a=this.defaults.hooks||new Jl;for(let d in i.hooks){if(!(d in a))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let f=d,c=i.hooks[f],h=a[f];Jl.passThroughHooks.has(d)?a[f]=p=>{if(this.defaults.async&&Jl.passThroughHooksRespectAsync.has(d))return(async()=>{let m=await c.call(a,p);return h.call(a,m)})();let g=c.call(a,p);return h.call(a,g)}:a[f]=(...p)=>{if(this.defaults.async)return(async()=>{let m=await c.apply(a,p);return m===!1&&(m=await h.apply(a,p)),m})();let g=c.apply(a,p);return g===!1&&(g=h.apply(a,p)),g}}s.hooks=a}if(i.walkTokens){let a=this.defaults.walkTokens,d=i.walkTokens;s.walkTokens=function(f){let c=[];return c.push(d.call(this,f)),a&&(c=c.concat(a.call(this,f))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ir.lex(e,t??this.defaults)}parser(e,t){return rr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let s={...i},a={...this.defaults,...s},d=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&s.async===!1)return d(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 d(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let f=a.hooks?await a.hooks.preprocess(t):t,c=await(a.hooks?await a.hooks.provideLexer():e?ir.lex:ir.lexInline)(f,a),h=a.hooks?await a.hooks.processAllTokens(c):c;a.walkTokens&&await Promise.all(this.walkTokens(h,a.walkTokens));let p=await(a.hooks?await a.hooks.provideParser():e?rr.parse:rr.parseInline)(h,a);return a.hooks?await a.hooks.postprocess(p):p})().catch(d);try{a.hooks&&(t=a.hooks.preprocess(t));let f=(a.hooks?a.hooks.provideLexer():e?ir.lex:ir.lexInline)(t,a);a.hooks&&(f=a.hooks.processAllTokens(f)),a.walkTokens&&this.walkTokens(f,a.walkTokens);let c=(a.hooks?a.hooks.provideParser():e?rr.parse:rr.parseInline)(f,a);return a.hooks&&(c=a.hooks.postprocess(c)),c}catch(f){return d(f)}}}onError(e,t){return i=>{if(i.message+=`
157
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+vr(i.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(i);throw i}}},ma=new c2;function Nt(e,t){return ma.parse(e,t)}Nt.options=Nt.setOptions=function(e){return ma.setOptions(e),Nt.defaults=ma.defaults,JC(Nt.defaults),Nt};Nt.getDefaults=C_;Nt.defaults=va;Nt.use=function(...e){return ma.use(...e),Nt.defaults=ma.defaults,JC(Nt.defaults),Nt};Nt.walkTokens=function(e,t){return ma.walkTokens(e,t)};Nt.parseInline=ma.parseInline;Nt.Parser=rr;Nt.parser=rr.parse;Nt.Renderer=Vh;Nt.TextRenderer=N_;Nt.Lexer=ir;Nt.lexer=ir.lex;Nt.Tokenizer=Kh;Nt.Hooks=Jl;Nt.parse=Nt;Nt.options;Nt.setOptions;Nt.use;Nt.walkTokens;Nt.parseInline;rr.parse;ir.lex;const{entries:u2,setPrototypeOf:aS,isFrozen:JD,getPrototypeOf:QD,getOwnPropertyDescriptor:ej}=Object;let{freeze:si,seal:Ji,create:oo}=Object,{apply:gg,construct:_g}=typeof Reflect<"u"&&Reflect;si||(si=function(t){return t});Ji||(Ji=function(t){return t});gg||(gg=function(t,i){for(var s=arguments.length,a=new Array(s>2?s-2:0),d=2;d<s;d++)a[d-2]=arguments[d];return t.apply(i,a)});_g||(_g=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];return new t(...s)});const zl=yn(Array.prototype.forEach),tj=yn(Array.prototype.lastIndexOf),oS=yn(Array.prototype.pop),Hl=yn(Array.prototype.push),nj=yn(Array.prototype.splice),ti=Array.isArray,Ql=yn(String.prototype.toLowerCase),im=yn(String.prototype.toString),lS=yn(String.prototype.match),no=yn(String.prototype.replace),cS=yn(String.prototype.indexOf),ij=yn(String.prototype.trim),rj=yn(Number.prototype.toString),sj=yn(Boolean.prototype.toString),uS=typeof BigInt>"u"?null:yn(BigInt.prototype.toString),hS=typeof Symbol>"u"?null:yn(Symbol.prototype.toString),ln=yn(Object.prototype.hasOwnProperty),$l=yn(Object.prototype.toString),Hn=yn(RegExp.prototype.test),ih=aj(TypeError);function yn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];return gg(e,t,s)}}function aj(e){return function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return _g(e,i)}}function tt(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ql;if(aS&&aS(e,null),!ti(t))return e;let s=t.length;for(;s--;){let a=t[s];if(typeof a=="string"){const d=i(a);d!==a&&(JD(t)||(t[s]=d),a=d)}e[a]=!0}return e}function oj(e){for(let t=0;t<e.length;t++)ln(e,t)||(e[t]=null);return e}function mi(e){const t=oo(null);for(const[i,s]of u2(e))ln(e,i)&&(ti(s)?t[i]=oj(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=mi(s):t[i]=s);return t}function lj(e){switch(typeof e){case"string":return e;case"number":return rj(e);case"boolean":return sj(e);case"bigint":return uS?uS(e):"0";case"symbol":return hS?hS(e):"Symbol()";case"undefined":return $l(e);case"function":case"object":{if(e===null)return $l(e);const t=e,i=lo(t,"toString");if(typeof i=="function"){const s=i(t);return typeof s=="string"?s:$l(s)}return $l(e)}default:return $l(e)}}function lo(e,t){for(;e!==null;){const s=ej(e,t);if(s){if(s.get)return yn(s.get);if(typeof s.value=="function")return yn(s.value)}e=QD(e)}function i(){return null}return i}function cj(e){try{return Hn(e,""),!0}catch{return!1}}const dS=si(["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"]),rm=si(["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"]),sm=si(["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"]),uj=si(["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"]),am=si(["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"]),hj=si(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fS=si(["#text"]),pS=si(["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"]),om=si(["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"]),mS=si(["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"]),rh=si(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dj=Ji(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fj=Ji(/<%[\w\W]*|[\w\W]*%>/gm),pj=Ji(/\$\{[\w\W]*/gm),mj=Ji(/^data-[\-\w.\u00B7-\uFFFF]+$/),gj=Ji(/^aria-[\-\w]+$/),h2=Ji(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_j=Ji(/^(?:\w+script|data):/i),vj=Ji(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),d2=Ji(/^html$/i),bj=Ji(/^[a-z][.\w]*(-[.\w]+)+$/i);var gS=Object.freeze({__proto__:null,ARIA_ATTR:gj,ATTR_WHITESPACE:vj,CUSTOM_ELEMENT:bj,DATA_ATTR:mj,DOCTYPE_NAME:d2,ERB_EXPR:fj,IS_ALLOWED_URI:h2,IS_SCRIPT_OR_DATA:_j,MUSTACHE_EXPR:dj,TMPLIT_EXPR:pj});const Fl={element:1,text:3,progressingInstruction:7,comment:8,document:9},yj=function(){return typeof window>"u"?null:window},Sj=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const a="data-tt-policy-suffix";i&&i.hasAttribute(a)&&(s=i.getAttribute(a));const d="dompurify"+(s?"#"+s:"");try{return t.createPolicy(d,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},_S=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function f2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yj();const t=De=>f2(De);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Fl.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e;const s=i,a=s.currentScript,{DocumentFragment:d,HTMLTemplateElement:f,Node:c,Element:h,NodeFilter:p,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:S,trustedTypes:w}=e,T=h.prototype,C=lo(T,"cloneNode"),_=lo(T,"remove"),b=lo(T,"nextSibling"),v=lo(T,"childNodes"),y=lo(T,"parentNode");if(typeof f=="function"){const De=i.createElement("template");De.content&&De.content.ownerDocument&&(i=De.content.ownerDocument)}let k,M="";const{implementation:R,createNodeIterator:N,createDocumentFragment:A,getElementsByTagName:I}=i,{importNode:$}=s;let H=_S();t.isSupported=typeof u2=="function"&&typeof y=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:q,ERB_EXPR:B,TMPLIT_EXPR:Y,DATA_ATTR:G,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:O}=gS;let{IS_ALLOWED_URI:z}=gS,j=null;const W=tt({},[...dS,...rm,...sm,...am,...fS]);let Z=null;const ne=tt({},[...pS,...om,...mS,...rh]);let te=Object.seal(oo(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}})),he=null,J=null;const F=Object.seal(oo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ae=!0,fe=!0,Ce=!1,pe=!0,xe=!1,Le=!0,Pe=!1,Ue=!1,Ae=!1,ye=!1,Oe=!1,xt=!1,Wn=!0,Gn=!1;const en="user-content-";let pt=!0,tn=!1,zt={},Ut=null;const wt=tt({},["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 Ln=null;const xn=tt({},["audio","video","img","source","image","track"]);let fn=null;const ft=tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),wn="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",Dt="http://www.w3.org/1999/xhtml";let Yt=Dt,Mn=!1,Zn=null;const Ii=tt({},[wn,At,Dt],im);let vi=tt({},["mi","mo","mn","ms","mtext"]),Bi=tt({},["annotation-xml"]);const Nn=tt({},["title","style","font","a","script"]);let Ht=null;const ee=["application/xhtml+xml","text/html"],ge="text/html";let we=null,He=null;const Ct=i.createElement("form"),mt=function(X){return X instanceof RegExp||X instanceof Function},Me=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===X)return;(!X||typeof X!="object")&&(X={}),X=mi(X),Ht=ee.indexOf(X.PARSER_MEDIA_TYPE)===-1?ge:X.PARSER_MEDIA_TYPE,we=Ht==="application/xhtml+xml"?im:Ql,j=ln(X,"ALLOWED_TAGS")&&ti(X.ALLOWED_TAGS)?tt({},X.ALLOWED_TAGS,we):W,Z=ln(X,"ALLOWED_ATTR")&&ti(X.ALLOWED_ATTR)?tt({},X.ALLOWED_ATTR,we):ne,Zn=ln(X,"ALLOWED_NAMESPACES")&&ti(X.ALLOWED_NAMESPACES)?tt({},X.ALLOWED_NAMESPACES,im):Ii,fn=ln(X,"ADD_URI_SAFE_ATTR")&&ti(X.ADD_URI_SAFE_ATTR)?tt(mi(ft),X.ADD_URI_SAFE_ATTR,we):ft,Ln=ln(X,"ADD_DATA_URI_TAGS")&&ti(X.ADD_DATA_URI_TAGS)?tt(mi(xn),X.ADD_DATA_URI_TAGS,we):xn,Ut=ln(X,"FORBID_CONTENTS")&&ti(X.FORBID_CONTENTS)?tt({},X.FORBID_CONTENTS,we):wt,he=ln(X,"FORBID_TAGS")&&ti(X.FORBID_TAGS)?tt({},X.FORBID_TAGS,we):mi({}),J=ln(X,"FORBID_ATTR")&&ti(X.FORBID_ATTR)?tt({},X.FORBID_ATTR,we):mi({}),zt=ln(X,"USE_PROFILES")?X.USE_PROFILES&&typeof X.USE_PROFILES=="object"?mi(X.USE_PROFILES):X.USE_PROFILES:!1,ae=X.ALLOW_ARIA_ATTR!==!1,fe=X.ALLOW_DATA_ATTR!==!1,Ce=X.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=X.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=X.SAFE_FOR_TEMPLATES||!1,Le=X.SAFE_FOR_XML!==!1,Pe=X.WHOLE_DOCUMENT||!1,ye=X.RETURN_DOM||!1,Oe=X.RETURN_DOM_FRAGMENT||!1,xt=X.RETURN_TRUSTED_TYPE||!1,Ae=X.FORCE_BODY||!1,Wn=X.SANITIZE_DOM!==!1,Gn=X.SANITIZE_NAMED_PROPS||!1,pt=X.KEEP_CONTENT!==!1,tn=X.IN_PLACE||!1,z=cj(X.ALLOWED_URI_REGEXP)?X.ALLOWED_URI_REGEXP:h2,Yt=typeof X.NAMESPACE=="string"?X.NAMESPACE:Dt,vi=ln(X,"MATHML_TEXT_INTEGRATION_POINTS")&&X.MATHML_TEXT_INTEGRATION_POINTS&&typeof X.MATHML_TEXT_INTEGRATION_POINTS=="object"?mi(X.MATHML_TEXT_INTEGRATION_POINTS):tt({},["mi","mo","mn","ms","mtext"]),Bi=ln(X,"HTML_INTEGRATION_POINTS")&&X.HTML_INTEGRATION_POINTS&&typeof X.HTML_INTEGRATION_POINTS=="object"?mi(X.HTML_INTEGRATION_POINTS):tt({},["annotation-xml"]);const _e=ln(X,"CUSTOM_ELEMENT_HANDLING")&&X.CUSTOM_ELEMENT_HANDLING&&typeof X.CUSTOM_ELEMENT_HANDLING=="object"?mi(X.CUSTOM_ELEMENT_HANDLING):oo(null);if(te=oo(null),ln(_e,"tagNameCheck")&&mt(_e.tagNameCheck)&&(te.tagNameCheck=_e.tagNameCheck),ln(_e,"attributeNameCheck")&&mt(_e.attributeNameCheck)&&(te.attributeNameCheck=_e.attributeNameCheck),ln(_e,"allowCustomizedBuiltInElements")&&typeof _e.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=_e.allowCustomizedBuiltInElements),xe&&(fe=!1),Oe&&(ye=!0),zt&&(j=tt({},fS),Z=oo(null),zt.html===!0&&(tt(j,dS),tt(Z,pS)),zt.svg===!0&&(tt(j,rm),tt(Z,om),tt(Z,rh)),zt.svgFilters===!0&&(tt(j,sm),tt(Z,om),tt(Z,rh)),zt.mathMl===!0&&(tt(j,am),tt(Z,mS),tt(Z,rh))),F.tagCheck=null,F.attributeCheck=null,ln(X,"ADD_TAGS")&&(typeof X.ADD_TAGS=="function"?F.tagCheck=X.ADD_TAGS:ti(X.ADD_TAGS)&&(j===W&&(j=mi(j)),tt(j,X.ADD_TAGS,we))),ln(X,"ADD_ATTR")&&(typeof X.ADD_ATTR=="function"?F.attributeCheck=X.ADD_ATTR:ti(X.ADD_ATTR)&&(Z===ne&&(Z=mi(Z)),tt(Z,X.ADD_ATTR,we))),ln(X,"ADD_URI_SAFE_ATTR")&&ti(X.ADD_URI_SAFE_ATTR)&&tt(fn,X.ADD_URI_SAFE_ATTR,we),ln(X,"FORBID_CONTENTS")&&ti(X.FORBID_CONTENTS)&&(Ut===wt&&(Ut=mi(Ut)),tt(Ut,X.FORBID_CONTENTS,we)),ln(X,"ADD_FORBID_CONTENTS")&&ti(X.ADD_FORBID_CONTENTS)&&(Ut===wt&&(Ut=mi(Ut)),tt(Ut,X.ADD_FORBID_CONTENTS,we)),pt&&(j["#text"]=!0),Pe&&tt(j,["html","head","body"]),j.table&&(tt(j,["tbody"]),delete he.tbody),X.TRUSTED_TYPES_POLICY){if(typeof X.TRUSTED_TYPES_POLICY.createHTML!="function")throw ih('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof X.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ih('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=X.TRUSTED_TYPES_POLICY,M=k.createHTML("")}else k===void 0&&(k=Sj(w,a)),k!==null&&typeof M=="string"&&(M=k.createHTML(""));si&&si(X),He=X},Re=tt({},[...rm,...sm,...uj]),$e=tt({},[...am,...hj]),$t=function(X){let _e=y(X);(!_e||!_e.tagName)&&(_e={namespaceURI:Yt,tagName:"template"});const Te=Ql(X.tagName),nt=Ql(_e.tagName);return Zn[X.namespaceURI]?X.namespaceURI===At?_e.namespaceURI===Dt?Te==="svg":_e.namespaceURI===wn?Te==="svg"&&(nt==="annotation-xml"||vi[nt]):!!Re[Te]:X.namespaceURI===wn?_e.namespaceURI===Dt?Te==="math":_e.namespaceURI===At?Te==="math"&&Bi[nt]:!!$e[Te]:X.namespaceURI===Dt?_e.namespaceURI===At&&!Bi[nt]||_e.namespaceURI===wn&&!vi[nt]?!1:!$e[Te]&&(Nn[Te]||!Re[Te]):!!(Ht==="application/xhtml+xml"&&Zn[X.namespaceURI]):!1},it=function(X){Hl(t.removed,{element:X});try{y(X).removeChild(X)}catch{_(X)}},de=function(X,_e){try{Hl(t.removed,{attribute:_e.getAttributeNode(X),from:_e})}catch{Hl(t.removed,{attribute:null,from:_e})}if(_e.removeAttribute(X),X==="is")if(ye||Oe)try{it(_e)}catch{}else try{_e.setAttribute(X,"")}catch{}},ot=function(X){let _e=null,Te=null;if(Ae)X="<remove></remove>"+X;else{const Bt=lS(X,/^[\r\n\t ]+/);Te=Bt&&Bt[0]}Ht==="application/xhtml+xml"&&Yt===Dt&&(X='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+X+"</body></html>");const nt=k?k.createHTML(X):X;if(Yt===Dt)try{_e=new S().parseFromString(nt,Ht)}catch{}if(!_e||!_e.documentElement){_e=R.createDocument(Yt,"template",null);try{_e.documentElement.innerHTML=Mn?M:nt}catch{}}const Qe=_e.body||_e.documentElement;return X&&Te&&Qe.insertBefore(i.createTextNode(Te),Qe.childNodes[0]||null),Yt===Dt?I.call(_e,Pe?"html":"body")[0]:Pe?_e.documentElement:Qe},jt=function(X){return N.call(X.ownerDocument||X,X,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Xe=function(X){return X instanceof m&&(typeof X.nodeName!="string"||typeof X.textContent!="string"||typeof X.removeChild!="function"||!(X.attributes instanceof g)||typeof X.removeAttribute!="function"||typeof X.setAttribute!="function"||typeof X.namespaceURI!="string"||typeof X.insertBefore!="function"||typeof X.hasChildNodes!="function")},Ee=function(X){return typeof c=="function"&&X instanceof c};function Ke(De,X,_e){zl(De,Te=>{Te.call(t,X,_e,He)})}const It=function(X){let _e=null;if(Ke(H.beforeSanitizeElements,X,null),Xe(X))return it(X),!0;const Te=we(X.nodeName);if(Ke(H.uponSanitizeElement,X,{tagName:Te,allowedTags:j}),Le&&X.hasChildNodes()&&!Ee(X.firstElementChild)&&Hn(/<[/\w!]/g,X.innerHTML)&&Hn(/<[/\w!]/g,X.textContent)||Le&&X.namespaceURI===Dt&&Te==="style"&&Ee(X.firstElementChild)||X.nodeType===Fl.progressingInstruction||Le&&X.nodeType===Fl.comment&&Hn(/<[/\w]/g,X.data))return it(X),!0;if(he[Te]||!(F.tagCheck instanceof Function&&F.tagCheck(Te))&&!j[Te]){if(!he[Te]&&Jn(Te)&&(te.tagNameCheck instanceof RegExp&&Hn(te.tagNameCheck,Te)||te.tagNameCheck instanceof Function&&te.tagNameCheck(Te)))return!1;if(pt&&!Ut[Te]){const nt=y(X)||X.parentNode,Qe=v(X)||X.childNodes;if(Qe&&nt){const Bt=Qe.length;for(let Xt=Bt-1;Xt>=0;--Xt){const rn=C(Qe[Xt],!0);nt.insertBefore(rn,b(X))}}}return it(X),!0}return X instanceof h&&!$t(X)||(Te==="noscript"||Te==="noembed"||Te==="noframes")&&Hn(/<\/no(script|embed|frames)/i,X.innerHTML)?(it(X),!0):(xe&&X.nodeType===Fl.text&&(_e=X.textContent,zl([q,B,Y],nt=>{_e=no(_e,nt," ")}),X.textContent!==_e&&(Hl(t.removed,{element:X.cloneNode()}),X.textContent=_e)),Ke(H.afterSanitizeElements,X,null),!1)},On=function(X,_e,Te){if(J[_e]||Wn&&(_e==="id"||_e==="name")&&(Te in i||Te in Ct))return!1;const nt=Z[_e]||F.attributeCheck instanceof Function&&F.attributeCheck(_e,X);if(!(fe&&!J[_e]&&Hn(G,_e))){if(!(ae&&Hn(P,_e))){if(!nt||J[_e]){if(!(Jn(X)&&(te.tagNameCheck instanceof RegExp&&Hn(te.tagNameCheck,X)||te.tagNameCheck instanceof Function&&te.tagNameCheck(X))&&(te.attributeNameCheck instanceof RegExp&&Hn(te.attributeNameCheck,_e)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(_e,X))||_e==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&Hn(te.tagNameCheck,Te)||te.tagNameCheck instanceof Function&&te.tagNameCheck(Te))))return!1}else if(!fn[_e]){if(!Hn(z,no(Te,V,""))){if(!((_e==="src"||_e==="xlink:href"||_e==="href")&&X!=="script"&&cS(Te,"data:")===0&&Ln[X])){if(!(Ce&&!Hn(K,no(Te,V,"")))){if(Te)return!1}}}}}}return!0},bi=tt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Jn=function(X){return!bi[Ql(X)]&&Hn(O,X)},yi=function(X){Ke(H.beforeSanitizeAttributes,X,null);const{attributes:_e}=X;if(!_e||Xe(X))return;const Te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let nt=_e.length;for(;nt--;){const Qe=_e[nt],{name:Bt,namespaceURI:Xt,value:rn}=Qe,Se=we(Bt),Be=rn;let ze=Bt==="value"?Be:ij(Be);if(Te.attrName=Se,Te.attrValue=ze,Te.keepAttr=!0,Te.forceKeepAttr=void 0,Ke(H.uponSanitizeAttribute,X,Te),ze=Te.attrValue,Gn&&(Se==="id"||Se==="name")&&cS(ze,en)!==0&&(de(Bt,X),ze=en+ze),Le&&Hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ze)){de(Bt,X);continue}if(Se==="attributename"&&lS(ze,"href")){de(Bt,X);continue}if(Te.forceKeepAttr)continue;if(!Te.keepAttr){de(Bt,X);continue}if(!pe&&Hn(/\/>/i,ze)){de(Bt,X);continue}xe&&zl([q,B,Y],Zt=>{ze=no(ze,Zt," ")});const gt=we(X.nodeName);if(!On(gt,Se,ze)){de(Bt,X);continue}if(k&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Xt)switch(w.getAttributeType(gt,Se)){case"TrustedHTML":{ze=k.createHTML(ze);break}case"TrustedScriptURL":{ze=k.createScriptURL(ze);break}}if(ze!==Be)try{Xt?X.setAttributeNS(Xt,Bt,ze):X.setAttribute(Bt,ze),Xe(X)?it(X):oS(t.removed)}catch{de(Bt,X)}}Ke(H.afterSanitizeAttributes,X,null)},Si=function(X){let _e=null;const Te=jt(X);for(Ke(H.beforeSanitizeShadowDOM,X,null);_e=Te.nextNode();)Ke(H.uponSanitizeShadowNode,_e,null),It(_e),yi(_e),_e.content instanceof d&&Si(_e.content);Ke(H.afterSanitizeShadowDOM,X,null)};return t.sanitize=function(De){let X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_e=null,Te=null,nt=null,Qe=null;if(Mn=!De,Mn&&(De="<!-->"),typeof De!="string"&&!Ee(De)&&(De=lj(De),typeof De!="string"))throw ih("dirty is not a string, aborting");if(!t.isSupported)return De;if(Ue||Me(X),t.removed=[],typeof De=="string"&&(tn=!1),tn){const rn=De.nodeName;if(typeof rn=="string"){const Se=we(rn);if(!j[Se]||he[Se])throw ih("root node is forbidden and cannot be sanitized in-place")}}else if(De instanceof c)_e=ot("<!---->"),Te=_e.ownerDocument.importNode(De,!0),Te.nodeType===Fl.element&&Te.nodeName==="BODY"||Te.nodeName==="HTML"?_e=Te:_e.appendChild(Te);else{if(!ye&&!xe&&!Pe&&De.indexOf("<")===-1)return k&&xt?k.createHTML(De):De;if(_e=ot(De),!_e)return ye?null:xt?M:""}_e&&Ae&&it(_e.firstChild);const Bt=jt(tn?De:_e);for(;nt=Bt.nextNode();)It(nt),yi(nt),nt.content instanceof d&&Si(nt.content);if(tn)return De;if(ye){if(xe){_e.normalize();let rn=_e.innerHTML;zl([q,B,Y],Se=>{rn=no(rn,Se," ")}),_e.innerHTML=rn}if(Oe)for(Qe=A.call(_e.ownerDocument);_e.firstChild;)Qe.appendChild(_e.firstChild);else Qe=_e;return(Z.shadowroot||Z.shadowrootmode)&&(Qe=$.call(s,Qe,!0)),Qe}let Xt=Pe?_e.outerHTML:_e.innerHTML;return Pe&&j["!doctype"]&&_e.ownerDocument&&_e.ownerDocument.doctype&&_e.ownerDocument.doctype.name&&Hn(d2,_e.ownerDocument.doctype.name)&&(Xt="<!DOCTYPE "+_e.ownerDocument.doctype.name+`>
158
+ `+Xt),xe&&zl([q,B,Y],rn=>{Xt=no(Xt,rn," ")}),k&&xt?k.createHTML(Xt):Xt},t.setConfig=function(){let De=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Me(De),Ue=!0},t.clearConfig=function(){He=null,Ue=!1},t.isValidAttribute=function(De,X,_e){He||Me({});const Te=we(De),nt=we(X);return On(Te,nt,_e)},t.addHook=function(De,X){typeof X=="function"&&Hl(H[De],X)},t.removeHook=function(De,X){if(X!==void 0){const _e=tj(H[De],X);return _e===-1?void 0:nj(H[De],_e,1)[0]}return oS(H[De])},t.removeHooks=function(De){H[De]=[]},t.removeAllHooks=function(){H=_S()},t}var oc=f2(),lm,vS;function xj(){if(vS)return lm;vS=1;function e(ee){return ee instanceof Map?ee.clear=ee.delete=ee.set=function(){throw new Error("map is read-only")}:ee instanceof Set&&(ee.add=ee.clear=ee.delete=function(){throw new Error("set is read-only")}),Object.freeze(ee),Object.getOwnPropertyNames(ee).forEach(ge=>{const we=ee[ge],He=typeof we;(He==="object"||He==="function")&&!Object.isFrozen(we)&&e(we)}),ee}class t{constructor(ge){ge.data===void 0&&(ge.data={}),this.data=ge.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(ee){return ee.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function s(ee,...ge){const we=Object.create(null);for(const He in ee)we[He]=ee[He];return ge.forEach(function(He){for(const Ct in He)we[Ct]=He[Ct]}),we}const a="</span>",d=ee=>!!ee.scope,f=(ee,{prefix:ge})=>{if(ee.startsWith("language:"))return ee.replace("language:","language-");if(ee.includes(".")){const we=ee.split(".");return[`${ge}${we.shift()}`,...we.map((He,Ct)=>`${He}${"_".repeat(Ct+1)}`)].join(" ")}return`${ge}${ee}`};class c{constructor(ge,we){this.buffer="",this.classPrefix=we.classPrefix,ge.walk(this)}addText(ge){this.buffer+=i(ge)}openNode(ge){if(!d(ge))return;const we=f(ge.scope,{prefix:this.classPrefix});this.span(we)}closeNode(ge){d(ge)&&(this.buffer+=a)}value(){return this.buffer}span(ge){this.buffer+=`<span class="${ge}">`}}const h=(ee={})=>{const ge={children:[]};return Object.assign(ge,ee),ge};class p{constructor(){this.rootNode=h(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ge){this.top.children.push(ge)}openNode(ge){const we=h({scope:ge});this.add(we),this.stack.push(we)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ge){return this.constructor._walk(ge,this.rootNode)}static _walk(ge,we){return typeof we=="string"?ge.addText(we):we.children&&(ge.openNode(we),we.children.forEach(He=>this._walk(ge,He)),ge.closeNode(we)),ge}static _collapse(ge){typeof ge!="string"&&ge.children&&(ge.children.every(we=>typeof we=="string")?ge.children=[ge.children.join("")]:ge.children.forEach(we=>{p._collapse(we)}))}}class g extends p{constructor(ge){super(),this.options=ge}addText(ge){ge!==""&&this.add(ge)}startScope(ge){this.openNode(ge)}endScope(){this.closeNode()}__addSublanguage(ge,we){const He=ge.root;we&&(He.scope=`language:${we}`),this.add(He)}toHTML(){return new c(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function m(ee){return ee?typeof ee=="string"?ee:ee.source:null}function S(ee){return C("(?=",ee,")")}function w(ee){return C("(?:",ee,")*")}function T(ee){return C("(?:",ee,")?")}function C(...ee){return ee.map(we=>m(we)).join("")}function _(ee){const ge=ee[ee.length-1];return typeof ge=="object"&&ge.constructor===Object?(ee.splice(ee.length-1,1),ge):{}}function b(...ee){return"("+(_(ee).capture?"":"?:")+ee.map(He=>m(He)).join("|")+")"}function v(ee){return new RegExp(ee.toString()+"|").exec("").length-1}function y(ee,ge){const we=ee&&ee.exec(ge);return we&&we.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(ee,{joinWith:ge}){let we=0;return ee.map(He=>{we+=1;const Ct=we;let mt=m(He),Me="";for(;mt.length>0;){const Re=k.exec(mt);if(!Re){Me+=mt;break}Me+=mt.substring(0,Re.index),mt=mt.substring(Re.index+Re[0].length),Re[0][0]==="\\"&&Re[1]?Me+="\\"+String(Number(Re[1])+Ct):(Me+=Re[0],Re[0]==="("&&we++)}return Me}).map(He=>`(${He})`).join(ge)}const R=/\b\B/,N="[a-zA-Z]\\w*",A="[a-zA-Z_]\\w*",I="\\b\\d+(\\.\\d+)?",$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",H="\\b(0b[01]+)",q="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",B=(ee={})=>{const ge=/^#![ ]*\//;return ee.binary&&(ee.begin=C(ge,/.*\b/,ee.binary,/\b.*/)),s({scope:"meta",begin:ge,end:/$/,relevance:0,"on:begin":(we,He)=>{we.index!==0&&He.ignoreMatch()}},ee)},Y={begin:"\\\\[\\s\\S]",relevance:0},G={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Y]},P={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Y]},K={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/},V=function(ee,ge,we={}){const He=s({scope:"comment",begin:ee,end:ge,contains:[]},we);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 Ct=b("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:C(/[ ]+/,"(",Ct,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),He},O=V("//","$"),z=V("/\\*","\\*/"),j=V("#","$"),W={scope:"number",begin:I,relevance:0},Z={scope:"number",begin:$,relevance:0},ne={scope:"number",begin:H,relevance:0},te={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Y,{begin:/\[/,end:/\]/,relevance:0,contains:[Y]}]},he={scope:"title",begin:N,relevance:0},J={scope:"title",begin:A,relevance:0},F={begin:"\\.\\s*"+A,relevance:0};var fe=Object.freeze({__proto__:null,APOS_STRING_MODE:G,BACKSLASH_ESCAPE:Y,BINARY_NUMBER_MODE:ne,BINARY_NUMBER_RE:H,COMMENT:V,C_BLOCK_COMMENT_MODE:z,C_LINE_COMMENT_MODE:O,C_NUMBER_MODE:Z,C_NUMBER_RE:$,END_SAME_AS_BEGIN:function(ee){return Object.assign(ee,{"on:begin":(ge,we)=>{we.data._beginMatch=ge[1]},"on:end":(ge,we)=>{we.data._beginMatch!==ge[1]&&we.ignoreMatch()}})},HASH_COMMENT_MODE:j,IDENT_RE:N,MATCH_NOTHING_RE:R,METHOD_GUARD:F,NUMBER_MODE:W,NUMBER_RE:I,PHRASAL_WORDS_MODE:K,QUOTE_STRING_MODE:P,REGEXP_MODE:te,RE_STARTERS_RE:q,SHEBANG:B,TITLE_MODE:he,UNDERSCORE_IDENT_RE:A,UNDERSCORE_TITLE_MODE:J});function Ce(ee,ge){ee.input[ee.index-1]==="."&&ge.ignoreMatch()}function pe(ee,ge){ee.className!==void 0&&(ee.scope=ee.className,delete ee.className)}function xe(ee,ge){ge&&ee.beginKeywords&&(ee.begin="\\b("+ee.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ee.__beforeBegin=Ce,ee.keywords=ee.keywords||ee.beginKeywords,delete ee.beginKeywords,ee.relevance===void 0&&(ee.relevance=0))}function Le(ee,ge){Array.isArray(ee.illegal)&&(ee.illegal=b(...ee.illegal))}function Pe(ee,ge){if(ee.match){if(ee.begin||ee.end)throw new Error("begin & end are not supported with match");ee.begin=ee.match,delete ee.match}}function Ue(ee,ge){ee.relevance===void 0&&(ee.relevance=1)}const Ae=(ee,ge)=>{if(!ee.beforeMatch)return;if(ee.starts)throw new Error("beforeMatch cannot be used with starts");const we=Object.assign({},ee);Object.keys(ee).forEach(He=>{delete ee[He]}),ee.keywords=we.keywords,ee.begin=C(we.beforeMatch,S(we.begin)),ee.starts={relevance:0,contains:[Object.assign(we,{endsParent:!0})]},ee.relevance=0,delete we.beforeMatch},ye=["of","and","for","in","not","or","if","then","parent","list","value"],Oe="keyword";function xt(ee,ge,we=Oe){const He=Object.create(null);return typeof ee=="string"?Ct(we,ee.split(" ")):Array.isArray(ee)?Ct(we,ee):Object.keys(ee).forEach(function(mt){Object.assign(He,xt(ee[mt],ge,mt))}),He;function Ct(mt,Me){ge&&(Me=Me.map(Re=>Re.toLowerCase())),Me.forEach(function(Re){const $e=Re.split("|");He[$e[0]]=[mt,Wn($e[0],$e[1])]})}}function Wn(ee,ge){return ge?Number(ge):Gn(ee)?0:1}function Gn(ee){return ye.includes(ee.toLowerCase())}const en={},pt=ee=>{console.error(ee)},tn=(ee,...ge)=>{console.log(`WARN: ${ee}`,...ge)},zt=(ee,ge)=>{en[`${ee}/${ge}`]||(console.log(`Deprecated as of ${ee}. ${ge}`),en[`${ee}/${ge}`]=!0)},Ut=new Error;function wt(ee,ge,{key:we}){let He=0;const Ct=ee[we],mt={},Me={};for(let Re=1;Re<=ge.length;Re++)Me[Re+He]=Ct[Re],mt[Re+He]=!0,He+=v(ge[Re-1]);ee[we]=Me,ee[we]._emit=mt,ee[we]._multi=!0}function Ln(ee){if(Array.isArray(ee.begin)){if(ee.skip||ee.excludeBegin||ee.returnBegin)throw pt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ut;if(typeof ee.beginScope!="object"||ee.beginScope===null)throw pt("beginScope must be object"),Ut;wt(ee,ee.begin,{key:"beginScope"}),ee.begin=M(ee.begin,{joinWith:""})}}function xn(ee){if(Array.isArray(ee.end)){if(ee.skip||ee.excludeEnd||ee.returnEnd)throw pt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ut;if(typeof ee.endScope!="object"||ee.endScope===null)throw pt("endScope must be object"),Ut;wt(ee,ee.end,{key:"endScope"}),ee.end=M(ee.end,{joinWith:""})}}function fn(ee){ee.scope&&typeof ee.scope=="object"&&ee.scope!==null&&(ee.beginScope=ee.scope,delete ee.scope)}function ft(ee){fn(ee),typeof ee.beginScope=="string"&&(ee.beginScope={_wrap:ee.beginScope}),typeof ee.endScope=="string"&&(ee.endScope={_wrap:ee.endScope}),Ln(ee),xn(ee)}function wn(ee){function ge(Me,Re){return new RegExp(m(Me),"m"+(ee.case_insensitive?"i":"")+(ee.unicodeRegex?"u":"")+(Re?"g":""))}class we{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Re,$e){$e.position=this.position++,this.matchIndexes[this.matchAt]=$e,this.regexes.push([$e,Re]),this.matchAt+=v(Re)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Re=this.regexes.map($e=>$e[1]);this.matcherRe=ge(M(Re,{joinWith:"|"}),!0),this.lastIndex=0}exec(Re){this.matcherRe.lastIndex=this.lastIndex;const $e=this.matcherRe.exec(Re);if(!$e)return null;const $t=$e.findIndex((de,ot)=>ot>0&&de!==void 0),it=this.matchIndexes[$t];return $e.splice(0,$t),Object.assign($e,it)}}class He{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Re){if(this.multiRegexes[Re])return this.multiRegexes[Re];const $e=new we;return this.rules.slice(Re).forEach(([$t,it])=>$e.addRule($t,it)),$e.compile(),this.multiRegexes[Re]=$e,$e}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Re,$e){this.rules.push([Re,$e]),$e.type==="begin"&&this.count++}exec(Re){const $e=this.getMatcher(this.regexIndex);$e.lastIndex=this.lastIndex;let $t=$e.exec(Re);if(this.resumingScanAtSamePosition()&&!($t&&$t.index===this.lastIndex)){const it=this.getMatcher(0);it.lastIndex=this.lastIndex+1,$t=it.exec(Re)}return $t&&(this.regexIndex+=$t.position+1,this.regexIndex===this.count&&this.considerAll()),$t}}function Ct(Me){const Re=new He;return Me.contains.forEach($e=>Re.addRule($e.begin,{rule:$e,type:"begin"})),Me.terminatorEnd&&Re.addRule(Me.terminatorEnd,{type:"end"}),Me.illegal&&Re.addRule(Me.illegal,{type:"illegal"}),Re}function mt(Me,Re){const $e=Me;if(Me.isCompiled)return $e;[pe,Pe,ft,Ae].forEach(it=>it(Me,Re)),ee.compilerExtensions.forEach(it=>it(Me,Re)),Me.__beforeBegin=null,[xe,Le,Ue].forEach(it=>it(Me,Re)),Me.isCompiled=!0;let $t=null;return typeof Me.keywords=="object"&&Me.keywords.$pattern&&(Me.keywords=Object.assign({},Me.keywords),$t=Me.keywords.$pattern,delete Me.keywords.$pattern),$t=$t||/\w+/,Me.keywords&&(Me.keywords=xt(Me.keywords,ee.case_insensitive)),$e.keywordPatternRe=ge($t,!0),Re&&(Me.begin||(Me.begin=/\B|\b/),$e.beginRe=ge($e.begin),!Me.end&&!Me.endsWithParent&&(Me.end=/\B|\b/),Me.end&&($e.endRe=ge($e.end)),$e.terminatorEnd=m($e.end)||"",Me.endsWithParent&&Re.terminatorEnd&&($e.terminatorEnd+=(Me.end?"|":"")+Re.terminatorEnd)),Me.illegal&&($e.illegalRe=ge(Me.illegal)),Me.contains||(Me.contains=[]),Me.contains=[].concat(...Me.contains.map(function(it){return Dt(it==="self"?Me:it)})),Me.contains.forEach(function(it){mt(it,$e)}),Me.starts&&mt(Me.starts,Re),$e.matcher=Ct($e),$e}if(ee.compilerExtensions||(ee.compilerExtensions=[]),ee.contains&&ee.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ee.classNameAliases=s(ee.classNameAliases||{}),mt(ee)}function At(ee){return ee?ee.endsWithParent||At(ee.starts):!1}function Dt(ee){return ee.variants&&!ee.cachedVariants&&(ee.cachedVariants=ee.variants.map(function(ge){return s(ee,{variants:null},ge)})),ee.cachedVariants?ee.cachedVariants:At(ee)?s(ee,{starts:ee.starts?s(ee.starts):null}):Object.isFrozen(ee)?s(ee):ee}var Yt="11.11.1";class Mn extends Error{constructor(ge,we){super(ge),this.name="HTMLInjectionError",this.html=we}}const Zn=i,Ii=s,vi=Symbol("nomatch"),Bi=7,Nn=function(ee){const ge=Object.create(null),we=Object.create(null),He=[];let Ct=!0;const mt="Could not find the language '{}', did you forget to load/include a language module?",Me={disableAutodetect:!0,name:"Plain text",contains:[]};let Re={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function $e(Se){return Re.noHighlightRe.test(Se)}function $t(Se){let Be=Se.className+" ";Be+=Se.parentNode?Se.parentNode.className:"";const ze=Re.languageDetectRe.exec(Be);if(ze){const gt=X(ze[1]);return gt||(tn(mt.replace("{}",ze[1])),tn("Falling back to no-highlight mode for this block.",Se)),gt?ze[1]:"no-highlight"}return Be.split(/\s+/).find(gt=>$e(gt)||X(gt))}function it(Se,Be,ze){let gt="",Zt="";typeof Be=="object"?(gt=Se,ze=Be.ignoreIllegals,Zt=Be.language):(zt("10.7.0","highlight(lang, code, ...args) has been deprecated."),zt("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),Zt=Se,gt=Be),ze===void 0&&(ze=!0);const qn={code:gt,language:Zt};Xt("before:highlight",qn);const xi=qn.result?qn.result:de(qn.language,qn.code,ze);return xi.code=qn.code,Xt("after:highlight",xi),xi}function de(Se,Be,ze,gt){const Zt=Object.create(null);function qn(ke,je){return ke.keywords[je]}function xi(){if(!qe.keywords){pn.addText(Et);return}let ke=0;qe.keywordPatternRe.lastIndex=0;let je=qe.keywordPatternRe.exec(Et),Ze="";for(;je;){Ze+=Et.substring(ke,je.index);const lt=Dn.case_insensitive?je[0].toLowerCase():je[0],nn=qn(qe,lt);if(nn){const[Pi,$o]=nn;if(pn.addText(Ze),Ze="",Zt[lt]=(Zt[lt]||0)+1,Zt[lt]<=Bi&&(Xr+=$o),Pi.startsWith("_"))Ze+=je[0];else{const Ic=Dn.classNameAliases[Pi]||Pi;wi(je[0],Ic)}}else Ze+=je[0];ke=qe.keywordPatternRe.lastIndex,je=qe.keywordPatternRe.exec(Et)}Ze+=Et.substring(ke),pn.addText(Ze)}function ai(){if(Et==="")return;let ke=null;if(typeof qe.subLanguage=="string"){if(!ge[qe.subLanguage]){pn.addText(Et);return}ke=de(qe.subLanguage,Et,!0,jc[qe.subLanguage]),jc[qe.subLanguage]=ke._top}else ke=jt(Et,qe.subLanguage.length?qe.subLanguage:null);qe.relevance>0&&(Xr+=ke.relevance),pn.__addSublanguage(ke._emitter,ke.language)}function Ft(){qe.subLanguage!=null?ai():xi(),Et=""}function wi(ke,je){ke!==""&&(pn.startScope(je),pn.addText(ke),pn.endScope())}function Oc(ke,je){let Ze=1;const lt=je.length-1;for(;Ze<=lt;){if(!ke._emit[Ze]){Ze++;continue}const nn=Dn.classNameAliases[ke[Ze]]||ke[Ze],Pi=je[Ze];nn?wi(Pi,nn):(Et=Pi,xi(),Et=""),Ze++}}function ya(ke,je){return ke.scope&&typeof ke.scope=="string"&&pn.openNode(Dn.classNameAliases[ke.scope]||ke.scope),ke.beginScope&&(ke.beginScope._wrap?(wi(Et,Dn.classNameAliases[ke.beginScope._wrap]||ke.beginScope._wrap),Et=""):ke.beginScope._multi&&(Oc(ke.beginScope,je),Et="")),qe=Object.create(ke,{parent:{value:qe}}),qe}function Po(ke,je,Ze){let lt=y(ke.endRe,Ze);if(lt){if(ke["on:end"]){const nn=new t(ke);ke["on:end"](je,nn),nn.isMatchIgnored&&(lt=!1)}if(lt){for(;ke.endsParent&&ke.parent;)ke=ke.parent;return ke}}if(ke.endsWithParent)return Po(ke.parent,je,Ze)}function Sa(ke){return qe.matcher.regexIndex===0?(Et+=ke[0],1):(Zr=!0,0)}function Ed(ke){const je=ke[0],Ze=ke.rule,lt=new t(Ze),nn=[Ze.__beforeBegin,Ze["on:begin"]];for(const Pi of nn)if(Pi&&(Pi(ke,lt),lt.isMatchIgnored))return Sa(je);return Ze.skip?Et+=je:(Ze.excludeBegin&&(Et+=je),Ft(),!Ze.returnBegin&&!Ze.excludeBegin&&(Et=je)),ya(Ze,ke),Ze.returnBegin?0:je.length}function oi(ke){const je=ke[0],Ze=Be.substring(ke.index),lt=Po(qe,ke,Ze);if(!lt)return vi;const nn=qe;qe.endScope&&qe.endScope._wrap?(Ft(),wi(je,qe.endScope._wrap)):qe.endScope&&qe.endScope._multi?(Ft(),Oc(qe.endScope,ke)):nn.skip?Et+=je:(nn.returnEnd||nn.excludeEnd||(Et+=je),Ft(),nn.excludeEnd&&(Et=je));do qe.scope&&pn.closeNode(),!qe.skip&&!qe.subLanguage&&(Xr+=qe.relevance),qe=qe.parent;while(qe!==lt.parent);return lt.starts&&ya(lt.starts,ke),nn.returnEnd?0:je.length}function zo(){const ke=[];for(let je=qe;je!==Dn;je=je.parent)je.scope&&ke.unshift(je.scope);ke.forEach(je=>pn.openNode(je))}let Bs={};function xa(ke,je){const Ze=je&&je[0];if(Et+=ke,Ze==null)return Ft(),0;if(Bs.type==="begin"&&je.type==="end"&&Bs.index===je.index&&Ze===""){if(Et+=Be.slice(je.index,je.index+1),!Ct){const lt=new Error(`0 width match regex (${Se})`);throw lt.languageName=Se,lt.badRule=Bs.rule,lt}return 1}if(Bs=je,je.type==="begin")return Ed(je);if(je.type==="illegal"&&!ze){const lt=new Error('Illegal lexeme "'+Ze+'" for mode "'+(qe.scope||"<unnamed>")+'"');throw lt.mode=qe,lt}else if(je.type==="end"){const lt=oi(je);if(lt!==vi)return lt}if(je.type==="illegal"&&Ze==="")return Et+=`
160
+ `,1;if(Ho>1e5&&Ho>je.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Et+=Ze,Ze.length}const Dn=X(Se);if(!Dn)throw pt(mt.replace("{}",Se)),new Error('Unknown language: "'+Se+'"');const Dc=wn(Dn);let wa="",qe=gt||Dc;const jc={},pn=new Re.__emitter(Re);zo();let Et="",Xr=0,wr=0,Ho=0,Zr=!1;try{if(Dn.__emitTokens)Dn.__emitTokens(Be,pn);else{for(qe.matcher.considerAll();;){Ho++,Zr?Zr=!1:qe.matcher.considerAll(),qe.matcher.lastIndex=wr;const ke=qe.matcher.exec(Be);if(!ke)break;const je=Be.substring(wr,ke.index),Ze=xa(je,ke);wr=ke.index+Ze}xa(Be.substring(wr))}return pn.finalize(),wa=pn.toHTML(),{language:Se,value:wa,relevance:Xr,illegal:!1,_emitter:pn,_top:qe}}catch(ke){if(ke.message&&ke.message.includes("Illegal"))return{language:Se,value:Zn(Be),illegal:!0,relevance:0,_illegalBy:{message:ke.message,index:wr,context:Be.slice(wr-100,wr+100),mode:ke.mode,resultSoFar:wa},_emitter:pn};if(Ct)return{language:Se,value:Zn(Be),illegal:!1,relevance:0,errorRaised:ke,_emitter:pn,_top:qe};throw ke}}function ot(Se){const Be={value:Zn(Se),illegal:!1,relevance:0,_top:Me,_emitter:new Re.__emitter(Re)};return Be._emitter.addText(Se),Be}function jt(Se,Be){Be=Be||Re.languages||Object.keys(ge);const ze=ot(Se),gt=Be.filter(X).filter(Te).map(Ft=>de(Ft,Se,!1));gt.unshift(ze);const Zt=gt.sort((Ft,wi)=>{if(Ft.relevance!==wi.relevance)return wi.relevance-Ft.relevance;if(Ft.language&&wi.language){if(X(Ft.language).supersetOf===wi.language)return 1;if(X(wi.language).supersetOf===Ft.language)return-1}return 0}),[qn,xi]=Zt,ai=qn;return ai.secondBest=xi,ai}function Xe(Se,Be,ze){const gt=Be&&we[Be]||ze;Se.classList.add("hljs"),Se.classList.add(`language-${gt}`)}function Ee(Se){let Be=null;const ze=$t(Se);if($e(ze))return;if(Xt("before:highlightElement",{el:Se,language:ze}),Se.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Se);return}if(Se.children.length>0&&(Re.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(Se)),Re.throwUnescapedHTML))throw new Mn("One of your code blocks includes unescaped HTML.",Se.innerHTML);Be=Se;const gt=Be.textContent,Zt=ze?it(gt,{language:ze,ignoreIllegals:!0}):jt(gt);Se.innerHTML=Zt.value,Se.dataset.highlighted="yes",Xe(Se,ze,Zt.language),Se.result={language:Zt.language,re:Zt.relevance,relevance:Zt.relevance},Zt.secondBest&&(Se.secondBest={language:Zt.secondBest.language,relevance:Zt.secondBest.relevance}),Xt("after:highlightElement",{el:Se,result:Zt,text:gt})}function Ke(Se){Re=Ii(Re,Se)}const It=()=>{Jn(),zt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function On(){Jn(),zt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let bi=!1;function Jn(){function Se(){Jn()}if(document.readyState==="loading"){bi||window.addEventListener("DOMContentLoaded",Se,!1),bi=!0;return}document.querySelectorAll(Re.cssSelector).forEach(Ee)}function yi(Se,Be){let ze=null;try{ze=Be(ee)}catch(gt){if(pt("Language definition for '{}' could not be registered.".replace("{}",Se)),Ct)pt(gt);else throw gt;ze=Me}ze.name||(ze.name=Se),ge[Se]=ze,ze.rawDefinition=Be.bind(null,ee),ze.aliases&&_e(ze.aliases,{languageName:Se})}function Si(Se){delete ge[Se];for(const Be of Object.keys(we))we[Be]===Se&&delete we[Be]}function De(){return Object.keys(ge)}function X(Se){return Se=(Se||"").toLowerCase(),ge[Se]||ge[we[Se]]}function _e(Se,{languageName:Be}){typeof Se=="string"&&(Se=[Se]),Se.forEach(ze=>{we[ze.toLowerCase()]=Be})}function Te(Se){const Be=X(Se);return Be&&!Be.disableAutodetect}function nt(Se){Se["before:highlightBlock"]&&!Se["before:highlightElement"]&&(Se["before:highlightElement"]=Be=>{Se["before:highlightBlock"](Object.assign({block:Be.el},Be))}),Se["after:highlightBlock"]&&!Se["after:highlightElement"]&&(Se["after:highlightElement"]=Be=>{Se["after:highlightBlock"](Object.assign({block:Be.el},Be))})}function Qe(Se){nt(Se),He.push(Se)}function Bt(Se){const Be=He.indexOf(Se);Be!==-1&&He.splice(Be,1)}function Xt(Se,Be){const ze=Se;He.forEach(function(gt){gt[ze]&&gt[ze](Be)})}function rn(Se){return zt("10.7.0","highlightBlock will be removed entirely in v12.0"),zt("10.7.0","Please use highlightElement now."),Ee(Se)}Object.assign(ee,{highlight:it,highlightAuto:jt,highlightAll:Jn,highlightElement:Ee,highlightBlock:rn,configure:Ke,initHighlighting:It,initHighlightingOnLoad:On,registerLanguage:yi,unregisterLanguage:Si,listLanguages:De,getLanguage:X,registerAliases:_e,autoDetection:Te,inherit:Ii,addPlugin:Qe,removePlugin:Bt}),ee.debugMode=function(){Ct=!1},ee.safeMode=function(){Ct=!0},ee.versionString=Yt,ee.regex={concat:C,lookahead:S,either:b,optional:T,anyNumberOfTimes:w};for(const Se in fe)typeof fe[Se]=="object"&&e(fe[Se]);return Object.assign(ee,fe),ee},Ht=Nn({});return Ht.newInstance=()=>Nn({}),lm=Ht,Ht.HighlightJS=Ht,Ht.default=Ht,lm}var wj=xj();const Ki=Xg(wj);function bS(e){const t=e.regex,i={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},d=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),f={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,a]};a.contains.push(c);const h={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},m={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},S=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=e.SHEBANG({binary:`(${S.join("|")})`,relevance:10}),T={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},C=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],b={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["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"],M=["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:C,literal:_,built_in:[...v,...y,"set","shopt",...k,...M]},contains:[w,e.SHEBANG(),T,m,d,f,b,c,h,p,g,i]}}const yS="[A-Za-z$_][0-9A-Za-z$_]*",Cj=["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"],Ej=["true","false","null","undefined","NaN","Infinity"],p2=["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"],m2=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],g2=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],kj=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Tj=[].concat(g2,p2,m2);function SS(e){const t=e.regex,i=(V,{after:O})=>{const z="</"+V[0].slice(1);return V.input.indexOf(z,O)!==-1},s=yS,a={begin:"<>",end:"</>"},d=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(V,O)=>{const z=V[0].length+V.index,j=V.input[z];if(j==="<"||j===","){O.ignoreMatch();return}j===">"&&(i(V,{after:z})||O.ignoreMatch());let W;const Z=V.input.substring(z);if(W=Z.match(/^\s*=/)){O.ignoreMatch();return}if((W=Z.match(/^\s+extends\s+/))&&W.index===0){O.ignoreMatch();return}}},c={$pattern:yS,keyword:Cj,literal:Ej,built_in:Tj,"variable.language":kj},h="[0-9](_?[0-9])*",p=`\\.(${h})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",m={className:"number",variants:[{begin:`(\\b(${g})((${p})|\\.)?|(${p}))[eE][+-]?(${h})\\b`},{begin:`\\b(${g})\\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},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},v={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,T,C,_,{match:/\$\d+/},m];S.contains=y.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(y)});const k=[].concat(v,S.contains),M=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(k)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:M},N={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},A={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:{_:[...p2,...m2]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(V){return t.concat("(?!",V.join("|"),")")}const B={match:t.concat(/\b/,q([...g2,"super","import"].map(V=>`${V}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,T,C,_,v,{match:/\$\d+/},m,A,{scope:"attr",match:s+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:P,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:c,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:d},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},B,H,N,G,{match:/\$[(.]/}]}}function Aj(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],a={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,i,e.QUOTE_STRING_MODE,a,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function xS(e){const t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},s={begin:"^[-\\*]{3,}",end:"$"},a={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}]},d={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},f={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,h={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),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}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},m=e.inherit(p,{contains:[]}),S=e.inherit(g,{contains:[]});p.contains.push(S),g.contains.push(m);let w=[i,h];return[p,g,m,S].forEach(b=>{b.contains=b.contains.concat(w)}),w=w.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:w},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:w}]}]},i,d,p,g,{className:"quote",begin:"^>\\s+",contains:w,end:"$"},a,s,h,f,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function wS(e){const t=e.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["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"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,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"]},h={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},g={begin:/\{\{/,relevance:0},m={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h,g,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,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,p]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S="[0-9](_?[0-9])*",w=`(\\b(${S}))?\\.(${S})|\\b(${S})\\.`,T=`\\b|${s.join("|")}`,C={className:"number",relevance:0,variants:[{begin:`(\\b(${S})|(${w}))[eE][+-]?(${S})[jJ]?(?=${T})`},{begin:`(${w})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${T})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${T})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${T})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${T})`},{begin:`\\b(${S})[jJ](?=${T})`}]},_={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",h,C,m,e.HASH_COMMENT_MODE]}]};return p.contains=[m,C,h],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[h,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},m,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[C,b,m]}]}}const Yh="[A-Za-z$_][0-9A-Za-z$_]*",_2=["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"],v2=["true","false","null","undefined","NaN","Infinity"],b2=["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"],y2=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],S2=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],x2=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],w2=[].concat(S2,b2,y2);function Rj(e){const t=e.regex,i=(V,{after:O})=>{const z="</"+V[0].slice(1);return V.input.indexOf(z,O)!==-1},s=Yh,a={begin:"<>",end:"</>"},d=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(V,O)=>{const z=V[0].length+V.index,j=V.input[z];if(j==="<"||j===","){O.ignoreMatch();return}j===">"&&(i(V,{after:z})||O.ignoreMatch());let W;const Z=V.input.substring(z);if(W=Z.match(/^\s*=/)){O.ignoreMatch();return}if((W=Z.match(/^\s+extends\s+/))&&W.index===0){O.ignoreMatch();return}}},c={$pattern:Yh,keyword:_2,literal:v2,built_in:w2,"variable.language":x2},h="[0-9](_?[0-9])*",p=`\\.(${h})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",m={className:"number",variants:[{begin:`(\\b(${g})((${p})|\\.)?|(${p}))[eE][+-]?(${h})\\b`},{begin:`\\b(${g})\\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},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},v={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,T,C,_,{match:/\$\d+/},m];S.contains=y.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(y)});const k=[].concat(v,S.contains),M=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(k)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:M},N={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},A={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:{_:[...b2,...y2]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(V){return t.concat("(?!",V.join("|"),")")}const B={match:t.concat(/\b/,q([...S2,"super","import"].map(V=>`${V}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,T,C,_,v,{match:/\$\d+/},m,A,{scope:"attr",match:s+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:P,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:c,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:d},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},B,H,N,G,{match:/\$[(.]/}]}}function CS(e){const t=e.regex,i=Rj(e),s=Yh,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},f={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[i.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},h=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],p={$pattern:Yh,keyword:_2.concat(h),literal:v2,built_in:w2.concat(a),"variable.language":x2},g={className:"meta",begin:"@"+s},m=(C,_,b)=>{const v=C.contains.findIndex(y=>y.label===_);if(v===-1)throw new Error("can not find mode to replace");C.contains.splice(v,1,b)};Object.assign(i.keywords,p),i.exports.PARAMS_CONTAINS.push(g);const S=i.contains.find(C=>C.scope==="attr"),w=Object.assign({},S,{match:t.concat(s,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,S,w]),i.contains=i.contains.concat([g,d,f,w]),m(i,"shebang",e.SHEBANG()),m(i,"use_strict",c);const T=i.contains.find(C=>C.label==="func.def");return T.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}const Lj=/\[\[wiki:([^\]]+)\]\]/g,Mj=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,Nj=/^(\S[^:]*?):[ \t]*(.*)$/,Oj=new c2({gfm:!0,breaks:!1}),ES={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},cm=Kj();function xc(e,t={}){const{entries:i,content:s}=Ij(e),a=zj(s,t.resolveWikiLink),d=Oj.parse(a,{async:!1}),f=Pj(i),c=oc.sanitize(f+d,ES),h=new DOMParser().parseFromString(c,"text/html");return $j(h,t.omitDuplicateTitle),Hj(h),Fj(h),Wj(h),{html:oc.sanitize(h.body.innerHTML,ES),toc:Gj(h)}}function Dj(e){const t=new TextEncoder().encode(e);let i="";for(const s of t)i+=String.fromCharCode(s);return btoa(i)}function jj(e){const t=atob(e),i=new Uint8Array(t.length);for(let s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return new TextDecoder().decode(i)}function Ij(e){const t=Mj.exec(e);return t?{entries:Bj(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function Bj(e){const t=[];for(const i of e.split(/\r?\n/)){const s=i.replace(/\s+$/,"");if(s.trim()==="")continue;const a=Nj.exec(s);if(a){const[,c="",h=""]=a;t.push({key:c.trim(),value:h.trim()});continue}const d=t[t.length-1];if(!d)continue;const f=s.trim();d.value=d.value?`${d.value} ${f}`:f}return t}function Pj(e){return e.length===0?"":`<dl class="frontmatter">${e.map(i=>`<dt>${lc(i.key)}</dt><dd>${lc(i.value)}</dd>`).join("")}</dl>`}function zj(e,t){return e.replace(Lj,(i,s)=>{const a=s.trim();if(!a)return"";if(!t)return lc(`[[wiki:${a}]]`);const d=t(a);if(d===null)return lc(`[[wiki:${a}]]`);const f=lc(a),c=encodeURIComponent(a);return`<a href="${d}" data-entry-id="${c}">${f}</a>`})}function Hj(e){const t=new Map;for(const i of e.querySelectorAll("h2, h3")){const s=i.textContent?.trim()??"",a=Xj(s||"section"),d=t.get(a)??0;t.set(a,d+1),i.id=d===0?a:`${a}-${d+1}`}}function $j(e,t){if(!t)return;const i=e.body.querySelector("h1, h2, h3, h4, h5, h6");!i||i.tagName.toLowerCase()!=="h1"||kS(i.textContent??"")===kS(t)&&i.remove()}function Fj(e){for(const t of e.querySelectorAll("pre > code")){const i=Vj(t.className),s=t.textContent??"",a=t.parentElement;if(!a)continue;if(i==="mermaid"){const f=e.createElement("div");f.className="diagram-block",f.setAttribute("data-mermaid-source",Dj(s)),f.setAttribute("data-diagram-state","pending"),a.replaceWith(f);continue}const d=qj(s,i);t.innerHTML=d,t.classList.add("hljs"),a.classList.add("code-block"),a.dataset.code=s,a.insertBefore(Uj(e,i||"text"),a.firstChild)}}function Uj(e,t){const i=e.createElement("div");i.className="code-block-toolbar";const s=e.createElement("span");s.className="code-block-dots",s.setAttribute("aria-hidden","true");for(let f=0;f<3;f++)s.append(e.createElement("span"));const a=e.createElement("span");a.className="code-block-language",a.textContent=t;const d=e.createElement("button");return d.className="copy-code",d.type="button",d.dataset.action="copy-code",d.setAttribute("aria-label",`Copy ${t} code`),d.textContent="Copy",i.append(s,a,d),i}function Wj(e){for(const t of e.querySelectorAll("a")){const i=t.getAttribute("href")??"";Yj(i)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function Gj(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 qj(e,t){return t&&cm.getLanguage(t)?cm.highlight(e,{language:t}).value:cm.highlightAuto(e).value}function Kj(){return Ki.registerLanguage("bash",bS),Ki.registerLanguage("sh",bS),Ki.registerLanguage("javascript",SS),Ki.registerLanguage("js",SS),Ki.registerLanguage("json",Aj),Ki.registerLanguage("markdown",xS),Ki.registerLanguage("md",xS),Ki.registerLanguage("python",wS),Ki.registerLanguage("py",wS),Ki.registerLanguage("typescript",CS),Ki.registerLanguage("ts",CS),Ki}function Vj(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function Yj(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function Xj(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function kS(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function lc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Zj="modulepreload",Jj=function(e){return"/console/"+e},TS={},Qj=function(t,i,s){let a=Promise.resolve();if(i&&i.length>0){let h=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),c=f?.nonce||f?.getAttribute("nonce");a=h(i.map(p=>{if(p=Jj(p),p in TS)return;TS[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":Zj,g||(S.as="script"),S.crossOrigin="",S.href=p,c&&S.setAttribute("nonce",c),document.head.appendChild(S),g)return new Promise((w,T)=>{S.addEventListener("load",w),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${p}`)))})}))}function d(f){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=f,window.dispatchEvent(c),!c.defaultPrevented)throw f}return a.then(f=>{for(const c of f||[])c.status==="rejected"&&d(c.reason);return t().catch(d)})},e8=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",t8=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),n8=/^on/i,i8={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},AS="diagramInteractionBound",r8=/^oklch\s*\(\s*([^)]+)\s*\)$/i,s8=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Xi=[25,50,75,100,125,150,200],a8=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let um=null;const RS=new WeakSet;let o8=0,l8=0,wc=null;function Ts(e){const t=e.trim();if(!t)return t;const i=L8(t);return i?M8(i):t}function O_(e){if(RS.has(e))return;RS.add(e),LS(e);const t=e instanceof Node?e:document.body;new MutationObserver(s=>{let a=!1;for(const d of s)if(d.type==="childList"){wc&&!wc.trigger.isConnected&&ec(!1);for(const f of d.addedNodes)if(f instanceof Element&&(f.matches?.(".diagram-block[data-mermaid-source]")||f.querySelector?.(".diagram-block[data-mermaid-source]"))){a=!0;break}if(a)break}a&&LS(e)}).observe(t,{childList:!0,subtree:!0})}function LS(e){const t=e.querySelectorAll(e8);for(const i of t)i.dataset.diagramHydrating!=="true"&&(i.dataset.diagramHydrating="true",i.dataset.diagramState="pending",c8(i))}async function c8(e){const t=e.getAttribute("data-mermaid-source")??"";let i="";try{i=jj(t)}catch{hm(e,"Invalid diagram source");return}if(!i.trim()){hm(e,"Empty diagram source");return}try{const s=await h8(),a=`mermaid-diagram-${++o8}`,{svg:d}=await s.render(a,i);e.innerHTML=u8(d),p8(e,d),m8(e),g8(e),e.dataset.diagramState="rendered"}catch(s){const a=s instanceof Error?s.message:String(s);hm(e,a)}}function hm(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function u8(e){const t=(i,s)=>{n8.test(s.attrName)&&(s.keepAttr=!1)};oc.addHook("uponSanitizeAttribute",t);try{return oc.sanitize(e,i8)}finally{oc.removeHook("uponSanitizeAttribute",t)}}async function h8(){return um||(um=(async()=>{const e=await Qj(()=>import("./mermaid.core-DcGkHMSR.js").then(i=>i.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:d8(),themeCSS:f8(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),um}function d8(){const e=getComputedStyle(document.documentElement),t=(C,_)=>{const b=e.getPropertyValue(C).trim();return Ts(b||_)},i=(C,_)=>e.getPropertyValue(C).trim()||_,s=t("--brass","#c69a4a"),a=t("--brass-bright","#e6b86a"),d=t("--brass-deep","#a0782a"),f=t("--aurora","#8bd7e6"),c=t("--aurora-deep","#1f8aa8"),h=t("--coral","#ef7c63"),p=t("--ink-deep","#1d2734"),g=t("--ink-fog","#a6afbb"),m=t("--ink-pearl","#e6e9ef"),S=t("--ink-spectral","#bcc4d0"),w=[a,s,f,h,Ts("oklch(70% 0.11 68)"),c,Ts("oklch(76% 0.09 205)"),d,Ts("oklch(68% 0.14 30)"),g,Ts("oklch(62% 0.08 228)"),Ts("oklch(52% 0.05 248)")],T=Object.fromEntries(a8.map((C,_)=>[C,w[_]??p]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:m,primaryBorderColor:s,secondaryColor:"transparent",secondaryTextColor:m,secondaryBorderColor:a,tertiaryColor:"transparent",tertiaryTextColor:S,tertiaryBorderColor:s,lineColor:c,edgeLabelBackground:"transparent",titleColor:a,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:s,clusterBkg:"transparent",clusterBorder:s,pieTitleTextColor:a,pieTitleTextSize:i("--font-size-title-lg","19px"),pieSectionTextColor:m,pieSectionTextSize:i("--font-size-md","13px"),pieLegendTextColor:m,pieLegendTextSize:i("--font-size-lg","14px"),pieStrokeColor:d,pieStrokeWidth:"1.35px",pieOuterStrokeColor:a,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...T}}function f8(){const e=getComputedStyle(document.documentElement),t=(p,g)=>{const m=e.getPropertyValue(p).trim();return Ts(m||g)},i=t("--brass-deep","#a0782a"),s=t("--brass-bright","#e6b86a"),a=t("--aurora-deep","#1f8aa8"),d=t("--ink-abyss","#131920"),f=Ts("oklch(15% 0.04 250 / 34%)"),c=t("--surface-glass","#1d2734"),h=t("--ink-pearl","#e6e9ef");return`
161
+ .node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
162
+ stroke: ${i};
163
+ fill: ${c};
164
+ }
165
+ .edgePath path, .messageLine0, .messageLine1, .relation {
166
+ stroke: ${a};
167
+ }
168
+ .nodeLabel, .edgeLabel, .actor text, .messageText {
169
+ fill: ${h};
170
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
171
+ }
172
+ .pieCircle {
173
+ stroke: ${i};
174
+ stroke-width: 1.35px;
175
+ opacity: 0.96;
176
+ filter: drop-shadow(0 0 1.5px ${f});
177
+ }
178
+ .pieOuterCircle {
179
+ stroke: ${s};
180
+ opacity: 0.7;
181
+ }
182
+ .slice, .legend text, .pieTitleText {
183
+ fill: ${h};
184
+ paint-order: stroke;
185
+ stroke: ${d};
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: ${d};
209
+ stroke-width: 1.5px;
210
+ paint-order: stroke;
211
+ filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${s});
212
+ }
213
+ `}function p8(e,t){const i=new DOMParser().parseFromString(t,"image/svg+xml"),s=Array.from(i.querySelectorAll("a")),a=Array.from(e.querySelectorAll("a")),d=Math.min(s.length,a.length);for(let f=0;f<d;f++){const c=s[f],h=a[f];if(!c||!h)continue;const p=c.getAttribute("href")??c.getAttribute("xlink:href")??"",g=E2(p);g&&h.setAttribute("href",g)}}function m8(e){const t=e.querySelector("svg");if(!t)return;let i;try{i=t.getBBox()}catch{return}const{x:s,y:a,width:d,height:f}=i;!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(d)||!Number.isFinite(f)||s<0||a<0||d<=0||f<=0||t.setAttribute("viewBox",`${po(s)} ${po(a)} ${po(d)} ${po(f)}`)}function g8(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),T8(e),e.dataset[AS]!=="true"&&(e.dataset[AS]="true",e.addEventListener("click",_8),e.addEventListener("keydown",v8))}function _8(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||Xh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),C2(t))}function v8(e){if(e.key!=="Enter"&&e.key!==" "||Xh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),C2(t))}function C2(e){const t=e.querySelector("svg");if(!t)return;ec(!1);const i=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",s=document.createElement(i?"dialog":"div"),a=++l8,d=`diagram-lightbox-title-${a}`;s.className="diagram-lightbox",s.setAttribute("aria-labelledby",d),i||(s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.tabIndex=-1);const f=document.createElement("div");f.className="diagram-lightbox__frame";const c=document.createElement("div");c.className="diagram-lightbox__header";const h=document.createElement("h2");h.id=d,h.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 g=document.createElement("div");g.className="diagram-lightbox__controls",g.setAttribute("aria-label","Diagram zoom controls");const m=sh("−","Zoom out","out"),S=document.createElement("span");S.className="diagram-lightbox__zoom-readout",S.setAttribute("aria-live","polite");const w=sh("+","Zoom in","in"),T=sh("Fit","Fit diagram to viewport","fit"),C=sh("Reset","Reset diagram zoom","reset");g.append(m,S,w,T,C);const _=document.createElement("div");_.className="diagram-lightbox__viewport";const b=S8(t),v=t.cloneNode(!0);v.removeAttribute("style"),w8(v,`diagram-lightbox-svg-${a}`),_.append(v),c.append(h,g,p),f.append(c,_),s.append(f),document.body.append(s);const y=new b8(_,v,S,b);m.addEventListener("click",()=>y.zoomOut()),w.addEventListener("click",()=>y.zoomIn()),T.addEventListener("click",()=>y.fit()),C.addEventListener("click",()=>y.reset());const k=C8(s),M=A=>{(A.target===s||A.target===p)&&ec(!0)},R=A=>{if(A.key==="Escape"){A.preventDefault(),ec(!0);return}y.handleKeyboard(A)||A.key==="Tab"&&k8(A,s)},N={dialog:s,trigger:e,inertStates:k,onClick:M,onKeyDown:R,cleanupPanZoom:()=>y.destroy()};i&&(N.onCancel=A=>{A.preventDefault(),ec(!0)},s.addEventListener("cancel",N.onCancel),s.showModal()),s.addEventListener("click",M),document.addEventListener("keydown",R,!0),wc=N,y.fit(),p.focus()}function sh(e,t,i){const s=document.createElement("button");return s.className="diagram-lightbox__zoom-button",s.type="button",s.dataset.zoomAction=i,s.setAttribute("aria-label",t),s.textContent=e,s}class b8{constructor(t,i,s,a){this.viewport=t,this.svg=i,this.readout=s,this.baseSize=a,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=Xi.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,Xi.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Xi.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,i=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,s=Math.min(t/this.baseSize.width,i/this.baseSize.height),a=Math.floor(s*100),d=Xi.findIndex(c=>c>a),f=d===-1?Xi.length-1:Math.max(0,d-1);this.applyZoom(f),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-i)/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*(ah(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(ah(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const i=ah(this.zoomIndex),s=i/100;this.svg.setAttribute("width",po(this.baseSize.width*s)),this.svg.setAttribute("height",po(this.baseSize.height*s)),this.readout.textContent=`${i}%`}zoomAroundViewportCenter(t){const i=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,i.left+i.width/2,i.top+i.height/2)}zoomAroundPoint(t,i,s){if(t===this.zoomIndex)return;const a=this.svgWidth,d=this.svgHeight,f=this.viewport.getBoundingClientRect(),c=this.viewport.scrollLeft+i-f.left,h=this.viewport.scrollTop+s-f.top;this.applyZoom(t),this.viewport.scrollLeft=c/a*this.svgWidth-(i-f.left),this.viewport.scrollTop=h/d*this.svgHeight-(s-f.top)}onPointerDown=t=>{if(t.button!==0||Xh(t.target))return;const i=t.pointerId??1;if(this.pointers.set(i,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:i},this.viewport.setPointerCapture?.(i)};onPointerMove=t=>{const i=t.pointerId??1;if(this.pointers.has(i)&&this.pointers.set(i,t),this.pinchStart&&this.pointers.size>=2){const s=this.pointerDistance()/this.pinchStart.distance,a=ah(this.pinchStart.zoomIndex)*s;this.applyZoom(x8(a));return}!this.dragStart||this.dragStart.pointerId!==i||(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 i=t.pointerId??1;this.pointers.delete(i),this.viewport.releasePointerCapture?.(i),this.dragStart?.pointerId===i&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const i=t.deltaY<0?Math.min(this.zoomIndex+1,Xi.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(i,t.clientX,t.clientY)};onDoubleClick=t=>{Xh(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Xi.indexOf(200)?Xi.indexOf(100):Xi.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,i]=Array.from(this.pointers.values());return!t||!i?1:Math.hypot(i.clientX-t.clientX,i.clientY-t.clientY)}}function y8(e){const t=MS(e.getAttribute("width")),i=MS(e.getAttribute("height"));if(t&&i)return{width:t,height:i};const s=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],a=s[2],d=s[3],f=a!==void 0&&Number.isFinite(a)&&a>0?a:null,c=d!==void 0&&Number.isFinite(d)&&d>0?d:null;return{width:t??f??800,height:i??c??600}}function S8(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:y8(e)}function MS(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)&&i>0?i:null}function po(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function x8(e){let t=0,i=Number.POSITIVE_INFINITY;return Xi.forEach((s,a)=>{const d=Math.abs(s-e);d<i&&(i=d,t=a)}),t}function ah(e){return Xi[e]??Xi[0]}function w8(e,t){const i=e.getAttribute("id")??"";e.setAttribute("id",t);const s=e.querySelector("style");!i||!s?.textContent||(s.textContent=s.textContent.split(`#${i}`).join(`#${t}`))}function ec(e){const t=wc;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),E8(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),wc=null,e&&t.trigger.isConnected&&t.trigger.focus())}function C8(e){const t=[];for(const i of Array.from(document.body.children))!(i instanceof HTMLElement)||i===e||(t.push({element:i,ariaHidden:i.getAttribute("aria-hidden"),inert:i.inert}),i.inert=!0,i.setAttribute("aria-hidden","true"));return t}function E8(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 k8(e,t){const i=Array.from(t.querySelectorAll(t8)).filter(R8);if(i.length===0){e.preventDefault(),t.focus();return}const s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}function T8(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function Xh(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!A8(t)}function A8(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function R8(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function E2(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 s;try{s=new URL(t)}catch{return null}return s.origin!==window.location.origin?null:E2(s.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const s=t.slice(7);let a;try{a=decodeURIComponent(s)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(a)?`/entry/${encodeURIComponent(a)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function L8(e){const t=r8.exec(e);if(!t)return null;const i=t[1]?.trim();if(!i)return null;const s=i.indexOf("/"),a=s>=0?i.slice(0,s):i,d=s>=0?i.slice(s+1).trim():"",f=a.trim().split(/[\s,]+/).filter(Boolean);if(f.length!==3)return null;const[c,h,p]=f;if(!c||!h||!p)return null;const g=dm(c,1),m=dm(h,.4),S=N8(p);if(g===null||m===null||S===null)return null;let w=1;if(s>=0){const T=dm(d,1);if(T===null)return null;w=T}return{L:g,C:m,h:S,alpha:w}}function M8(e){const t=e.h*Math.PI/180,i=e.C*Math.cos(t),s=e.C*Math.sin(t),a=e.L,d=a+.3963377774*i+.2158037573*s,f=a-.1055613458*i-.0638541728*s,c=a-.0894841775*i-1.291485548*s,h=d**3,p=f**3,g=c**3,m=4.0767416621*h-3.3077115913*p+.2309699292*g,S=-1.2684380046*h+2.6097574011*p-.3413193965*g,w=-.0041960863*h-.7034186147*p+1.707614701*g,T=oh(fm(m)),C=oh(fm(S)),_=oh(fm(w));if(e.alpha<1){const b=oh(e.alpha);return`#${ta(T)}${ta(C)}${ta(_)}${ta(b)}`}return`#${ta(T)}${ta(C)}${ta(_)}`}function dm(e,t){if(!e)return null;if(e.endsWith("%")){const s=Number(e.slice(0,-1));return Number.isFinite(s)?s/100*t:null}const i=Number(e);return Number.isFinite(i)?i:null}function N8(e){const t=s8.exec(e);if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)?i:null}function fm(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 oh(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function ta(e){return e.toString(16).padStart(2,"0")}const O8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),D8=new Set(["img.shields.io"]),j8=/^[a-z][a-z0-9+.-]*:/i;function NS(e,t){const i=e.trim();if(!i||i.startsWith("#")||i.startsWith("//")||j8.test(i))return null;const s=k2(i);if(!s)return null;const a=P8(s);return a===null?null:z8(a,t)}function I8(e){const t=k2(e).toLowerCase();return[...O8].some(i=>t.endsWith(i))}function OS(e,t,i=null){const s=i?`${i.replaceAll("\\","/")}/`:"";return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(`${s}${t}`)}`}function B8(e){try{const t=new URL(e);return t.protocol==="https:"&&D8.has(t.hostname)}catch{return!1}}function k2(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function P8(e){try{return decodeURI(e)}catch{return null}}function z8(e,t){const i=e.replace(/\\/g,"/"),s=t.replace(/\\/g,"/"),a=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",d=i.startsWith("/")?i:`${a}/${i}`,f=[];for(const c of d.split("/"))if(!(!c||c===".")){if(c===".."){if(f.length===0)return null;f.pop();continue}f.push(c)}return f.length>0?f.join("/"):null}function H8({content:e,onOpenPath:t,relativePath:i,theaterId:s,contextRelPath:a,truncated:d}){const f=L.useMemo(()=>{const S=xc(e).html,w=new DOMParser().parseFromString(S,"text/html");return pm(w.body,{allowLocalImageMarkers:!1,currentRelativePath:i,theaterId:s,contextRelPath:a}),w.body.innerHTML},[e,i,s,a]),c=L.useRef(null);L.useEffect(()=>{const S=c.current;if(!S)return;O_(S),pm(S,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s,contextRelPath:a});const w=new MutationObserver(()=>pm(S,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s,contextRelPath:a}));return w.observe(S,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>w.disconnect()},[f,i,s,a]);const h=L.useCallback(S=>{const w=S.target.closest('[data-action="copy-code"]');if(!w)return;const T=w.closest("pre")?.getAttribute("data-code");if(!T)return;navigator.clipboard?.writeText(T);const C=w.textContent;w.textContent="Copied",window.setTimeout(()=>{w.textContent=C},1200)},[]),p=L.useCallback(S=>{const T=S.target.closest("[data-fexp-open-path]");if(!T)return;const C=T.dataset.fexpOpenPath;C&&(S.preventDefault(),t(C))},[t]),g=L.useCallback(S=>{if(S.key!=="Enter"&&S.key!==" ")return;const T=S.target.closest("[data-fexp-open-path]");if(!T)return;const C=T.dataset.fexpOpenPath;C&&(S.preventDefault(),t(C))},[t]),m=L.useCallback(S=>{h(S),p(S)},[h,p]);return l.jsxs("div",{className:"fexp-md-wrap",children:[d&&l.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),l.jsx("div",{ref:c,className:"markdown-body",onClick:m,onKeyDown:g,dangerouslySetInnerHTML:{__html:f}})]})}function pm(e,t){for(const i of e.querySelectorAll("a[href]")){const s=i.getAttribute("href")??"",a=NS(s,t.currentRelativePath);a?(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("data-fexp-open-path",a),i.removeAttribute("aria-disabled")):s&&!/^(https?:|mailto:|#)/i.test(s)&&(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("aria-disabled","true"))}for(const i of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const s=i.getAttribute("src")??"",a=i.getAttribute("data-fexp-local-image-path");if(i.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&a&&s===OS(t.theaterId,a,t.contextRelPath)){i.removeAttribute("srcset");continue}if(i.removeAttribute("data-fexp-local-image-path"),i.tagName==="IMG"&&B8(s)){i.removeAttribute("srcset"),i.removeAttribute("aria-hidden");continue}const d=NS(s,t.currentRelativePath);if(i.removeAttribute("srcset"),i.tagName==="IMG"&&t.theaterId&&d&&I8(d)){i.setAttribute("src",OS(t.theaterId,d,t.contextRelPath)),i.setAttribute("data-fexp-local-image-path",d),i.removeAttribute("aria-hidden");continue}i.removeAttribute("src"),i.tagName==="IMG"&&$8(i)}}function $8(e){const t=e.getAttribute("alt")?.trim(),i=e.ownerDocument.createElement("span");i.className="fexp-md-blocked-image",i.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(i)}const F8=360,D_=248,j_=200,Zh=160,Jh=4;function U8(e){return e-j_-Jh>=Zh}function W8(e,t,i){const s=i-j_-Jh;return s<Zh?e:Math.max(Zh,Math.min(s,e-t))}function G8(e){const t=j_+Jh;return`minmax(0, 1fr) ${Jh}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function q8(e){return e?F8:null}const T2="fleet-console.file-explorer.treePaneWidth",I_={selectedPath:null,viewState:{kind:"none"}},K8={...I_,treePaneWidth:D_},A2=new Map,DS=new Map,vg=new Set;let Qh=J8();function V8(e){return L.useSyncExternalStore(Z8,()=>X8(e),()=>K8)}function jS(e,t){e&&M2(e,{selectedPath:t})}function xs(e,t){e&&M2(e,{viewState:t})}function Y8(e){Qh=N2(e);try{localStorage.setItem(T2,String(Qh))}catch{}R2()}function R2(){for(const e of vg)e()}function L2(e){return A2.get(e)??I_}function X8(e){const t=e??"__none__",i=e!=null?L2(e):I_,s=DS.get(t);if(s&&s.selectedPath===i.selectedPath&&s.viewState===i.viewState&&s.treePaneWidth===Qh)return s;const a={...i,treePaneWidth:Qh};return DS.set(t,a),a}function M2(e,t){A2.set(e,{...L2(e),...t}),R2()}function Z8(e){return vg.add(e),()=>{vg.delete(e)}}function J8(){try{return N2(Number(localStorage.getItem(T2)))}catch{return D_}}function N2(e){return!Number.isFinite(e)||e<=0?D_:Math.max(Zh,Math.round(e))}const Q8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),e7={id:"file-explorer",title:"Files",icon:i7,pathAware:!0,render:e=>l.jsx(n7,{...e})};function t7(e,t){return{listFolder:async i=>{if(!e)throw new Error("no_theater");const s=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:dg(t,i??"")})});if(!s.ok){const f=await s.json();throw new Error(f.error??"list_failed")}const a=await s.json(),d=VC(t,a);if(!d)throw new Error("context_boundary");return d}}}function n7(e){const{theaterId:t}=e,i=e.pathContext.relPath,s=VO(t,i),{selectedPath:a,viewState:d,treePaneWidth:f}=V8(s),c=L.useRef(f);c.current=f;const h=L.useRef(null),[p,g]=L.useState(!1),m=L.useMemo(()=>t7(t,i),[t,i]),S=L.useCallback(async(b,v)=>{if(!t){xs(t,{kind:"error",message:"no_theater"});return}jS(s,b);const y=v??b.split("/").filter(Boolean).at(-1)??b,k=y.slice(y.lastIndexOf(".")).toLowerCase();if(Q8.has(k)){const M=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(dg(i,b)??"")}`:"";xs(s,{kind:"image",relativePath:b,name:y,src:M});return}xs(s,{kind:"loading"});try{const M=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:dg(i,b)})});if(!M.ok){const A=await M.json();throw new Error(A.error??"read_failed")}const R=await M.json();if(R.binary){xs(s,{kind:"binary",name:y});return}const N=VC(i,{relativePath:R.relativePath,parentRelativePath:null,entries:[]})?.relativePath;if(N===void 0)throw new Error("context_boundary");xs(s,{kind:"code",relativePath:N,content:R.content,lang:R.lang,truncated:R.truncated})}catch(M){const R=M instanceof Error?M.message:"Unable to load file";R==="binary_file"?xs(s,{kind:"binary",name:y}):xs(s,{kind:"error",message:R})}},[i,s,t]),w=L.useCallback(async b=>{b.kind==="file"&&await S(b.relativePath,b.name)},[S]),T=L.useCallback(()=>{xs(s,{kind:"none"}),jS(s,null)},[s]),C=L.useCallback(b=>{b.preventDefault();const v=h.current;if(!v)return;const y=v.getBoundingClientRect().width;if(!U8(y))return;const k=b.clientX,M=c.current;g(!0);const R=A=>{const I=A.clientX-k,$=W8(M,I,y);c.current=$,Y8($)},N=()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",N),g(!1)};document.addEventListener("pointermove",R),document.addEventListener("pointerup",N)},[]),_=d.kind!=="none";return L.useLayoutEffect(()=>{e.requestExtraWidth?.(q8(_))},[e,_]),l.jsxs("div",{ref:h,className:`fexp-root${_?" is-split":" is-tree-only"}${p?" is-dragging":""}`,style:_?{gridTemplateColumns:G8(f)}:void 0,children:[_&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"fexp-viewer-pane",children:[l.jsxs("div",{className:"fexp-viewer-head",children:[l.jsx("span",{className:"fexp-viewer-filename",children:d.kind!=="loading"&&d.kind!=="error"?"relativePath"in d?d.relativePath:d.name:""}),l.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:T,"aria-label":"Close viewer",children:"✕"})]}),l.jsxs("div",{className:"fexp-viewer-body",children:[d.kind==="loading"&&l.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),d.kind==="error"&&l.jsx("div",{className:"fexp-viewer-error",children:d.message}),d.kind==="code"&&d.lang==="markdown"&&l.jsx(H8,{content:d.content,onOpenPath:S,relativePath:d.relativePath,theaterId:t,truncated:d.truncated,contextRelPath:i}),d.kind==="code"&&d.lang!=="markdown"&&l.jsx(dD,{content:d.content,lang:d.lang,truncated:d.truncated}),d.kind==="image"&&l.jsx(mD,{src:d.src,name:d.name}),d.kind==="binary"&&l.jsx(tD,{name:d.name})]})]}),l.jsx("div",{className:"fexp-divider",onPointerDown:C,"aria-hidden":"true"})]}),l.jsx("div",{className:"fexp-tree-pane",children:l.jsx(JO,{files:m,theaterId:t,contextKey:s,contextRelPath:i,selectedPath:a,onSelect:w},s)})]})}function i7(){return l.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:l.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 r7={id:"file-explorer",railPanels:[e7]},s7=[r7],a7={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function o7(e){const t={dirs:{},files:[]};for(const i of e){const s=i.path.split("/");s.pop();let a=t;for(const d of s)a.dirs[d]||(a.dirs[d]={dirs:{},files:[]}),a=a.dirs[d];a.files.push(i)}return t}function O2({files:e,selectedPath:t,onSelect:i}){const s=o7(e);return l.jsx(D2,{node:s,depth:0,selectedPath:t,onSelect:i})}function D2({node:e,depth:t,selectedPath:i,onSelect:s}){return l.jsxs(l.Fragment,{children:[Object.entries(e.dirs).map(([a,d])=>l.jsx(l7,{dirKey:a,node:d,depth:t,selectedPath:i,onSelect:s},a)),e.files.map(a=>l.jsx(c7,{entry:a,depth:t,selectedPath:i,onSelect:s},a.path))]})}function l7({dirKey:e,node:t,depth:i,selectedPath:s,onSelect:a}){const[d,f]=L.useState(!1),c=L.useCallback(()=>f(m=>!m),[]);let h=e,p=t;for(;Object.keys(p.dirs).length===1&&p.files.length===0;){const m=Object.keys(p.dirs)[0];h+="/"+m,p=p.dirs[m]}const g=i*16+12;return l.jsxs("div",{className:`diff-folder${d?" is-collapsed":""}`,children:[l.jsxs("button",{type:"button",className:"diff-folder-row",style:{paddingLeft:`${g}px`},onClick:c,"aria-expanded":!d,children:[l.jsx("svg",{className:"diff-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("svg",{className:"diff-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l.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"})}),l.jsx("span",{className:"diff-folder-name",children:h})]}),!d&&l.jsx(D2,{node:p,depth:i+1,selectedPath:s,onSelect:a})]})}function c7({entry:e,depth:t,selectedPath:i,onSelect:s}){const a=e.path===i,d=L.useCallback(()=>s(e),[e,s]),f=t*16+12,c=e.path.split("/").pop()??e.path;return l.jsxs("button",{type:"button",className:`diff-file-row${a?" is-cur":""}`,style:{paddingLeft:`${f}px`},title:e.path,onClick:d,children:[l.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:a7[e.status]??e.status}),l.jsx("span",{className:"diff-file-name",children:l.jsx("span",{className:"diff-file-fn",children:c})}),l.jsxs("span",{className:"diff-nums",children:[e.additions>0&&l.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&l.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const IS="fleet-console.diff.changesCollapsed",u7={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function h7(e,t){const i=t.toLowerCase();return i?e.filter(s=>s.path.toLowerCase().includes(i)):e}function d7(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function f7({ctx:e,viewMode:t,selectedPath:i,subPath:s,onSelect:a,filterText:d}){const[f,c]=L.useState({kind:"loading"}),[h,p]=L.useState(0),[g,m]=L.useState(()=>d7(IS));L.useEffect(()=>{if(!e.theaterId){c({kind:"error",message:"no_theater"});return}let _=!1;return c({kind:"loading"}),fetch("/plugins/diff/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:s})}).then(async b=>{if(!b.ok){const k=(await b.json()).error??"git_failed";_||c(k==="no_git_repo"||k==="git_unavailable"?{kind:"notice",reason:k}:{kind:"error",message:k});return}const v=await b.json();_||c({kind:"ok",files:v.files})}).catch(b=>{_||c({kind:"error",message:b instanceof Error?b.message:"unknown"})}),()=>{_=!0}},[e.theaterId,s,h]);const S=L.useCallback(()=>p(_=>_+1),[]),w=L.useCallback(()=>{m(_=>{const b=!_;try{localStorage.setItem(IS,b?"1":"0")}catch{}return b})},[]),T=L.useMemo(()=>f.kind==="ok"?h7(f.files,d):[],[d,f]);if(f.kind==="loading")return l.jsx("div",{className:"diff-sections-loading",children:"Loading…"});if(f.kind==="notice"){const _=f.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=f.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 l.jsxs("div",{className:"diff-sections-notice",children:[l.jsx("strong",{className:"diff-notice-title",children:_}),l.jsx("span",{className:"diff-notice-body",children:b}),l.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]})}if(f.kind==="error")return l.jsxs("div",{className:"diff-sections-error",children:[l.jsx("span",{children:f.message}),l.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]});const C=d?`${T.length}/${f.files.length}`:String(f.files.length);return l.jsx("div",{className:"diff-sections",children:l.jsxs("div",{className:`diff-section${g?" is-collapsed":""}`,children:[l.jsxs("button",{type:"button",className:"diff-section-head",onClick:w,children:[l.jsx("svg",{className:"diff-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{className:"diff-section-name",children:"Changes"}),l.jsx("span",{className:"diff-count-badge",children:C})]}),!g&&l.jsx("div",{className:"diff-section-rows",children:T.length===0?l.jsx("div",{className:"diff-empty-row",children:d?"No matching items":"No changes"}):t==="tree"?l.jsx(O2,{files:T,selectedPath:i,onSelect:a}):T.map(_=>l.jsx(j2,{entry:_,isSelected:_.path===i,onSelect:a},_.path))})]})})}function j2({entry:e,isSelected:t,onSelect:i}){const s=L.useCallback(()=>i(e),[e,i]),a=e.path.endsWith("/")?e.path.slice(0,-1):e.path,d=a.lastIndexOf("/"),f=d>=0?a.slice(0,d+1):"",c=(d>=0?a.slice(d+1):a)+(e.path.endsWith("/")?"/":"");return l.jsxs("button",{type:"button",className:`diff-file-row${t?" is-cur":""}`,title:e.path,onClick:s,children:[l.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":u7[e.status]??e.status,children:e.status}),l.jsxs("span",{className:"diff-file-name",children:[l.jsx("span",{className:"diff-file-fn",children:c}),f&&l.jsx("span",{className:"diff-file-dir",children:f})]}),l.jsxs("span",{className:"diff-nums",children:[e.additions>0&&l.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&l.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}function I2(e,t){return JSON.stringify([e,t])}const bg=12,io=28,mm=3,p7=5,BS=["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 Ul(e){return e*bg+6}function na(e){return BS[e%BS.length]??"var(--ink-fog)"}function m7({node:e,laneCount:t,collapsed:i=!1}){const s=Math.max(t,1),a=i?10:0,d=s*bg+a,f=Ul(e.lane),c=io/2;return l.jsxs("svg",{width:d,height:io,viewBox:`0 0 ${d} ${io}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(h=>l.jsx("line",{x1:Ul(h),y1:0,x2:Ul(h),y2:io,stroke:na(h),strokeWidth:1.5},`pt-${h}`)),e.connectAbove&&l.jsx("line",{x1:f,y1:0,x2:f,y2:c-mm,stroke:na(e.lane),strokeWidth:1.5}),e.connectBelow&&l.jsx("line",{x1:f,y1:c+mm,x2:f,y2:io,stroke:na(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(h=>l.jsx("line",{x1:Ul(h),y1:0,x2:f,y2:c,stroke:na(h),strokeWidth:1.5,strokeLinecap:"round"},`mf-${h}`)),e.branchToLanes.map(h=>l.jsx("line",{x1:f,y1:c,x2:Ul(h),y2:io,stroke:na(h),strokeWidth:1.5,strokeLinecap:"round"},`bt-${h}`)),e.isHead&&l.jsx("circle",{cx:f,cy:c,r:p7,fill:"none",stroke:na(e.lane),strokeWidth:1.5}),l.jsx("circle",{cx:f,cy:c,r:mm,fill:na(e.lane)}),i&&l.jsx("text",{x:s*bg+2,y:c+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const gm=8;function g7(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],i=[];let s=!1,a=0;for(let d=0;d<e.length;d++){const f=e[d],c=f.fullHash,h=[...f.parents],p=[];for(let C=0;C<t.length;C++)t[C]===c&&p.push(C);let g,m=!1;const S=[];if(p.length===0){const C=t.indexOf(null);C>=0?g=C:t.length<gm?(g=t.length,t.push(null)):(s=!0,g=gm-1,t[g]=null,m=!0)}else{g=Math.min(...p);for(const C of p)C!==g&&(S.push(C),t[C]=null)}const w=[];if(h.length===0)t[g]=null;else{t[g]=m?null:h[0]??null;for(const C of h.slice(1))if(!(t.indexOf(C)>=0)){const b=t.indexOf(null);if(b>=0)t[b]=C,w.push(b);else if(t.length<gm){const v=t.length;t.push(C),w.push(v)}else s=!0}}const T=t.map((C,_)=>({h:C,i:_})).filter(({h:C,i:_})=>C!==null&&_!==g).map(({i:C})=>C);a=Math.max(a,g,...w,...T),i.push({lane:g,isHead:f.refs.some(C=>C==="HEAD"||C.startsWith("HEAD ->")),connectAbove:p.length>0,connectBelow:h.length>0&&t[g]===h[0],passThroughLanes:T,mergeFromLanes:S,branchToLanes:w})}return{nodes:i,activeLaneCount:a+1,collapsed:s}}const _7=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 v7(e){let t="",i=0;const s=(a,d)=>`<span class="diff-token-${a}">${d}</span>`;for(;i<e.length;){const a=e[i];if(a==="&"){const d=e.indexOf(";",i+1);if(d>=0){t+=e.slice(i,d+1),i=d+1;continue}}if(a==="/"&&e[i+1]==="/"||a==="#"){t+=s("comment",e.slice(i));break}if(a==='"'||a==="'"||a==="`"){const d=a,f=i++;for(;i<e.length;){if(e[i]==="\\"){i+=2;continue}if(e[i++]===d)break}t+=s("string",e.slice(f,i));continue}if(/[0-9]/.test(a)&&!/[A-Za-z0-9_$]/.test(e[i-1]??"")){const d=i;for(;i<e.length&&/[0-9.xXa-fA-F]/.test(e[i]);)i++;t+=s("number",e.slice(d,i));continue}if(/[A-Za-z_$]/.test(a)){const d=i;for(;i<e.length&&/[A-Za-z0-9_$]/.test(e[i]);)i++;const f=e.slice(d,i);t+=_7.has(f)?s("keyword",f):/^[A-Z]/.test(f)?s("type",f):f;continue}if("{}()[].,;:=<>+-*/&|?!".includes(a)){t+=s("punctuation",a),i++;continue}t+=a,i++}return t}const b7=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,y7=/^diff --git a\/(.+) b\/(.+)$/;function S7(e){if(!e)return[];const t=e.split(`
214
+ `);t[t.length-1]===""&&t.pop();const i=[];let s=0,a=0,d=!0;for(const f of t)if(!f.startsWith("\\")){if(f.startsWith("diff --git ")){const c=y7.exec(f),h=c?.[1],p=c?.[2]??f,g=h!==void 0&&h!==p?h:void 0;i.push({kind:"file-label",text:p,oldPath:g}),d=!0;continue}if(d){if(f.startsWith("new file mode")||f.startsWith("deleted file mode")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from ")||f.startsWith("rename to ")||f.startsWith("similarity index")||f.startsWith("dissimilarity index")){i.push({kind:"meta",text:f});continue}if(f.startsWith("index ")||f.startsWith("--- ")||f.startsWith("+++ "))continue;if(!f.startsWith("@@")){f!==""&&i.push({kind:"ctx",text:` ${f}`});continue}}if(f.startsWith("@@")){d=!1;const c=b7.exec(f);if(c){s=parseInt(c[1]??"0",10),a=parseInt(c[2]??"0",10);const h=c[3]?.trimEnd()??"",p=`@@ -${c[1]??""} +${c[2]??""} @@${h?` ${h.trimStart()}`:""}`;i.push({kind:"hunk-label",text:p})}else i.push({kind:"hunk-label",text:f});continue}f.startsWith("+")?i.push({kind:"add",text:f,newLine:a++}):f.startsWith("-")?i.push({kind:"del",text:f,oldLine:s++}):i.push({kind:"ctx",text:f,oldLine:s++,newLine:a++})}return i}function lh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B2({ctx:e,file:t,mode:i,subPath:s,commit:a}){const[d,f]=L.useState({kind:"loading"});if(L.useEffect(()=>{if(!e.theaterId){f({kind:"error",message:"no_theater"});return}let g=!1;return f({kind:"loading"}),a?e.api.fetch("diff","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:a.theaterId,ref:a.fullHash,filePath:t.path,...t.oldPath??a.oldPath?{oldPath:t.oldPath??a.oldPath}:{},subPath:a.subPath})}).then(async m=>{if(!m.ok)throw new Error((await m.json()).error??"git_failed");const S=await m.json();g||f({kind:"ok",result:S})}).catch(m=>{g||f({kind:"error",message:m instanceof Error?m.message:"unknown"})}):e.api.fetch("diff","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,filePath:t.path,mode:i,subPath:s})}).then(async m=>{if(!m.ok)throw new Error((await m.json()).error??"git_failed");const S=await m.json();g||f({kind:"ok",result:S})}).catch(m=>{g||f({kind:"error",message:m instanceof Error?m.message:"unknown"})}),()=>{g=!0}},[e.api,e.theaterId,t.oldPath,t.path,i,s,a]),d.kind==="loading")return l.jsx("div",{className:"diff-hunk-loading",children:"Loading…"});if(d.kind==="error")return l.jsx("div",{className:"diff-hunk-error",children:d.message});const{result:c}=d,p=S7(c.content).filter(g=>g.kind!=="file-label");return l.jsxs("div",{className:"diff-hunk-wrap",children:[c.truncated&&l.jsx("div",{className:"diff-truncated-badge",children:"Diff truncated"}),l.jsx("div",{className:"diff-hunk-scroll",children:l.jsx("table",{className:"diff-hunk-table",cellSpacing:0,cellPadding:0,children:l.jsx("tbody",{children:p.map((g,m)=>l.jsx("tr",{className:`diff-line diff-line-${g.kind}`,children:g.kind==="hunk-label"?l.jsx("td",{colSpan:4,className:"diff-line-label",dangerouslySetInnerHTML:{__html:lh(g.text)}}):g.kind==="meta"?l.jsx("td",{colSpan:4,className:"diff-line-meta",dangerouslySetInnerHTML:{__html:lh(g.text)}}):g.kind==="file-label"?l.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:lh(g.text)}}):l.jsxs(l.Fragment,{children:[l.jsx("td",{className:"diff-gutter diff-gutter-old",children:g.oldLine??""}),l.jsx("td",{className:"diff-gutter diff-gutter-new",children:g.newLine??""}),l.jsx("td",{className:"diff-marker",children:g.kind==="add"?"+":g.kind==="del"?"−":""}),l.jsx("td",{className:"diff-line-code",dangerouslySetInnerHTML:{__html:v7(lh(g.text.length>0?g.text.slice(1):g.text))}})]})},m))})})})]})}function P2(e,t=new Date){const i=new Date(e*1e3);if(!Number.isFinite(i.getTime()))return"—";const s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),d=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),f=Math.round((a-d)/864e5);return f===0?`Today ${s}`:f===1?`Yesterday ${s}`:`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function B_(e){const t=[];for(const i of e.refs)if(i==="HEAD")t.push({label:"HEAD",kind:"head"});else if(i.startsWith("HEAD -> refs/heads/"))t.push({label:i.slice(19),kind:"branch"});else if(i.startsWith("HEAD -> "))t.push({label:i.slice(8),kind:"branch"});else if(i.startsWith("tag: refs/tags/"))t.push({label:i.slice(15),kind:"tag"});else if(i.startsWith("tag: "))t.push({label:i.slice(5),kind:"tag"});else if(i.startsWith("refs/remotes/")){const s=i.slice(13);s.endsWith("/HEAD")||t.push({label:s,kind:"remote"})}else i.startsWith("refs/worktrees/")?t.push({label:i.slice(15),kind:"worktree"}):i.startsWith("refs/heads/")?t.push({label:i.slice(11),kind:"branch"}):t.push({label:i,kind:"branch"});return t}const z2=140,H2=140,Vr=4,$2=null;function x7({startWidth:e,dx:t,containerWidth:i,listPaneMinWidth:s,hunkPaneMinWidth:a,dividerWidth:d}){const f=i-a-d;return f<s?$2:Math.max(s,Math.min(f,e-t))}function w7(e){const t=z2+Vr;return`minmax(0, 1fr) ${Vr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function C7(e){const t=H2+Vr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Vr}px minmax(0, 1fr)`}function F2(e,t,i,s,a,d=Vr){const f=i-a-d;return f<s?$2:Math.max(s,Math.min(f,e+t))}function E7(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Vr}px minmax(120px, 1fr)`}function k7(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Vr}px minmax(140px, 1fr)`}function U2({documentTarget:e,windowTarget:t,onMove:i,onFinish:s}){let a=!0;const d=()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",f),e.removeEventListener("pointercancel",f),t.removeEventListener("blur",f)},f=()=>{a&&(a=!1,d(),s())},c=()=>{a&&(a=!1,d())};return e.addEventListener("pointermove",i),e.addEventListener("pointerup",f),e.addEventListener("pointercancel",f),t.addEventListener("blur",f),c}const T7=400,W2="fleet-console.history.listPaneWidth",PS="fleet-console.history.headerHeight",zS="fleet-console.history.fileListWidth",G2="fleet-console.history.filesView",A7=360,q2=220,R7=214,L7=180;function M7(e,t){return t.find(i=>i.branch===null&&i.sha===e.fullHash)??null}function N7(e,t){const i=t.toLowerCase();return i?e.filter(s=>s.subject.toLowerCase().includes(i)||s.authorName.toLowerCase().includes(i)||s.shortHash.toLowerCase().includes(i)||s.fullHash.toLowerCase().includes(i)||s.refs.some(a=>a.toLowerCase().includes(i))||B_(s).some(a=>a.label.toLowerCase().includes(i))):e}function O7(e){return e==="Escape"}function HS({current:e}){return e?l.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:l.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):l.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:l.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 D7({entry:e,checkouts:t,selected:i,graphNode:s,laneCount:a,layoutCollapsed:d,onSelect:f}){const c=B_(e),h=M7(e,t);return l.jsxs("button",{type:"button",className:`history-commit-row${i?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>f(e),children:[l.jsx("span",{className:"history-commit-subject",children:e.subject}),l.jsx("span",{className:"history-commit-sha",children:e.shortHash}),l.jsx("span",{className:"history-commit-time",children:P2(e.authorAt)}),l.jsxs("span",{className:"history-commit-badges",children:[c.map(p=>{const g=p.kind==="branch"?t.find(m=>m.branch===p.label):null;return l.jsxs("span",{className:`history-badge history-badge--${p.kind}`,children:[g&&l.jsx(HS,{current:g.isCurrent}),p.label]},`${p.kind}:${p.label}`)}),h&&l.jsxs("span",{className:"history-badge history-badge--worktree",children:[l.jsx(HS,{current:h.isCurrent}),"detached"]})]}),l.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:l.jsx(m7,{node:s,laneCount:a,collapsed:d})})]})}function j7({ctx:e,target:t,onSelectCommit:i,onClose:s}){const[a,d]=L.useState({kind:"loading"}),[f,c]=L.useState("details"),[h,p]=L.useState(null),[g,m]=L.useState(!1),[S,w]=L.useState(()=>yg(PS,R7)),[T,C]=L.useState(()=>yg(zS,L7)),[_,b]=L.useState(H7),v=L.useRef(null),y=L.useRef(null),k=L.useRef(null),M=L.useRef(S),R=L.useRef(T),N=L.useMemo(()=>({fullHash:t.fullHash,theaterId:e.theaterId??"",subPath:e.pathContext.relPath??""}),[t.fullHash,e.theaterId,e.pathContext.relPath]);L.useEffect(()=>{let $=!1;return d({kind:"loading"}),e.api.fetch("diff","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,ref:t.fullHash,subPath:e.pathContext.relPath??""})}).then(async H=>{if(!H.ok)throw new Error((await H.json()).error??"git_failed");return H.json()}).then(H=>{$||(d({kind:"ok",result:H}),p(H.files[0]?.path??null))}).catch(H=>{$||d({kind:"error",message:H instanceof Error?H.message:"unknown"})}),()=>{$=!0}},[e.api,e.pathContext.relPath,e.theaterId,t.fullHash]),L.useEffect(()=>()=>k.current?.(),[]);const A=L.useCallback(($,H)=>{$.preventDefault();const q=H==="y"?v.current:y.current;if(!q)return;const B=H==="y"?M.current:R.current,Y=H==="y"?$.clientY:$.clientX,G=H==="y"?q.getBoundingClientRect().height:q.getBoundingClientRect().width;k.current?.(),k.current=U2({documentTarget:document,windowTarget:window,onMove:P=>{const K=P,V=F2(B,(H==="y"?K.clientY:K.clientX)-Y,G,120,120);V!==null&&(H==="y"?(M.current=V,w(V)):(R.current=V,C(V)))},onFinish:()=>{const P=H==="y"?M.current:R.current;try{localStorage.setItem(H==="y"?PS:zS,String(P))}catch{}k.current=null}})},[]),I=a.kind==="loading"?l.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):a.kind==="error"?l.jsx("div",{className:"history-inspector-empty history-inspector-error",children:a.message}):(()=>{const{meta:$,files:H}=a.result,q=H.find(O=>O.path===h)??H[0]??null,B=H.reduce((O,z)=>O+z.additions,0),Y=H.reduce((O,z)=>O+z.deletions,0),G=t.entry,P=(O,z)=>{p(O.path),z&&c("changes")},K=O=>{b(O);try{localStorage.setItem(G2,O)}catch{}},V=()=>{const O=navigator.clipboard?.writeText(t.fullHash);O&&O.then(()=>{m(!0),window.setTimeout(()=>m(!1),1200)}).catch(()=>{})};return f==="details"?l.jsxs("div",{ref:v,className:"history-details-tab",style:{gridTemplateRows:E7(S)},children:[l.jsx(I7,{meta:$,entry:G,fullHash:t.fullHash,copied:g,onCopy:V,onParent:O=>i({fullHash:O})}),l.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:O=>A(O,"y")}),l.jsx($S,{files:H,selectedPath:h,additions:B,deletions:Y,viewMode:_,onViewMode:K,onSelect:O=>P(O,!0)})]}):l.jsx("div",{className:"history-changes-tab",children:l.jsxs("div",{ref:y,className:"history-changes-columns",style:{gridTemplateColumns:k7(T)},children:[l.jsx($S,{files:H,selectedPath:h,additions:B,deletions:Y,viewMode:_,onViewMode:K,onSelect:O=>P(O,!1)}),l.jsx("div",{className:"history-divider",onPointerDown:O=>A(O,"x")}),q?l.jsxs("div",{className:"history-file-diff",children:[l.jsxs("div",{className:"history-file-diff-head",children:[l.jsx("span",{title:q.path,children:q.path}),l.jsxs("div",{children:[l.jsx("button",{type:"button","aria-label":"Previous file",disabled:H.indexOf(q)===0,onClick:()=>P(H[H.indexOf(q)-1],!1),children:"‹"}),l.jsx("button",{type:"button","aria-label":"Next file",disabled:H.indexOf(q)===H.length-1,onClick:()=>P(H[H.indexOf(q)+1],!1),children:"›"})]})]}),l.jsx(B2,{ctx:e,file:q,mode:"unified",subPath:e.pathContext.relPath??"",commit:N})]}):l.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return l.jsxs("div",{className:"history-inspector",onKeyDown:$=>{O7($.key)&&($.preventDefault(),s())},children:[l.jsxs("div",{className:"history-segmented",children:[l.jsx("button",{type:"button","aria-pressed":f==="details",onClick:()=>c("details"),children:"Details"}),l.jsxs("button",{type:"button","aria-pressed":f==="changes",onClick:()=>c("changes"),children:["Changes ",a.kind==="ok"&&l.jsx("span",{children:a.result.files.length})]}),l.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:s,children:"✕"})]}),I]})}function I7({meta:e,entry:t,fullHash:i,copied:s,onCopy:a,onParent:d}){return l.jsxs("div",{className:"history-inspector-head",children:[l.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&l.jsx("pre",{className:"history-inspector-message",children:e.body}),l.jsxs("div",{className:"history-author",children:[l.jsx("span",{className:"history-avatar",children:$7(e.authorName)}),l.jsxs("span",{children:[l.jsx("b",{children:e.authorName}),l.jsx("small",{children:e.authorEmail})]}),l.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??P2(e.authorAt)})]}),l.jsxs("div",{className:"history-inspector-ids",children:[l.jsxs("button",{type:"button",className:`history-sha-copy${s?" is-copied":""}`,onClick:a,children:[i,l.jsx("span",{children:s?"copied":"copy"})]}),e.parents.map(f=>l.jsxs("button",{type:"button",className:"history-parent",onClick:()=>d(f.full),children:["parent ",f.short]},f.full))]}),t&&l.jsx("div",{className:"history-ref-chips",children:B_(t).map(f=>l.jsx("span",{className:`history-badge history-badge--${f.kind}`,children:f.label},`${f.kind}:${f.label}`))})]})}function $S({files:e,selectedPath:t,additions:i,deletions:s,viewMode:a,onViewMode:d,onSelect:f}){return l.jsxs("section",{className:"history-commit-files",children:[l.jsxs("div",{className:"history-files-title",children:[l.jsx("span",{className:"history-files-label",children:"Changed files"}),l.jsxs("span",{className:"history-files-stats",children:[e.length," ",l.jsxs("i",{children:["+",i]})," ",l.jsxs("em",{children:["−",s]})]}),l.jsxs("div",{className:"diff-view-toggle history-files-view-toggle",children:[l.jsx("button",{type:"button",className:`diff-toggle-btn${a==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":a==="list",onClick:()=>d("list"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsx("button",{type:"button",className:`diff-toggle-btn${a==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":a==="tree",onClick:()=>d("tree"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),l.jsx("div",{className:"history-files-scroll",children:a==="tree"?l.jsx(O2,{files:e,selectedPath:t,onSelect:f}):e.map(c=>l.jsx(j2,{entry:c,isSelected:c.path===t,onSelect:f},c.path))})]})}function B7({ctx:e}){return l.jsx(P7,{ctx:e},I2(e.theaterId,e.pathContext.relPath))}function P7({ctx:e}){const[t,i]=L.useState({kind:"loading"}),[s,a]=L.useState(null),[d,f]=L.useState(""),[c,h]=L.useState(0),[p,g]=L.useState(z7),m=L.useRef(null),S=L.useRef(null),w=L.useRef(p),T=e.pathContext.relPath??"";L.useEffect(()=>{if(!e.theaterId){i({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let v=!1;return i({kind:"loading"}),e.api.fetch("diff","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:T})}).then(async y=>{if(!y.ok)throw new Error((await y.json()).error??"git_failed");return y.json()}).then(y=>{v||i({kind:"ok",commits:y.commits,checkouts:y.checkouts,truncated:y.truncated??!1})}).catch(y=>{v||i({kind:"error",message:y instanceof Error?y.message:"unknown"})}),()=>{v=!0}},[e.api,e.theaterId,c,T]),L.useLayoutEffect(()=>(e.requestExtraWidth?.(s?T7:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,s]),L.useEffect(()=>()=>S.current?.(),[]);const C=L.useCallback(v=>{v.preventDefault();const y=m.current;if(!y)return;const k=w.current,M=v.clientX,R=y.getBoundingClientRect().width;S.current?.(),S.current=U2({documentTarget:document,windowTarget:window,onMove:N=>{const A=F2(k,N.clientX-M,R,q2,H2,Vr);A!==null&&(w.current=A,g(A))},onFinish:()=>{try{localStorage.setItem(W2,String(w.current))}catch{}S.current=null}})},[]),_=L.useMemo(()=>t.kind==="ok"?N7(t.commits,d):[],[d,t]),b=t.kind==="ok"?g7(_):null;return l.jsxs("div",{ref:m,className:"history-root",style:s?{gridTemplateColumns:C7(p)}:void 0,children:[l.jsxs("div",{className:"history-list-pane",children:[l.jsxs("div",{className:"history-toolbar",children:[l.jsxs("div",{className:"history-filter",children:[l.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:d,onChange:v=>f(v.target.value)}),d&&l.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>f(""),children:"✕"})]}),t.kind==="ok"&&l.jsx("span",{className:"history-count",children:d?`${_.length}/${t.commits.length}`:t.commits.length})]}),l.jsxs("div",{className:"history-list",children:[t.kind==="loading"&&l.jsx("div",{className:"history-empty",children:"Loading…"}),t.kind==="error"&&l.jsxs("div",{className:"history-error",children:[t.message,l.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:()=>h(v=>v+1),children:"Retry"})]}),t.kind==="ok"&&t.commits.length===0&&l.jsx("div",{className:"history-empty",children:"No history"}),t.kind==="ok"&&t.commits.length>0&&_.length===0&&l.jsx("div",{className:"history-empty",children:"No matching items"}),t.kind==="ok"&&b&&_.map((v,y)=>l.jsx(D7,{entry:v,checkouts:t.checkouts,selected:s?.fullHash===v.fullHash,graphNode:b.nodes[y],laneCount:b.activeLaneCount,layoutCollapsed:b.collapsed,onSelect:k=>a({fullHash:k.fullHash,entry:k})},v.fullHash)),t.kind==="ok"&&(t.truncated||t.commits.length>=200)&&l.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"history-divider",onPointerDown:C}),l.jsx("div",{className:"history-detail-pane",children:l.jsx(j7,{ctx:e,target:s,onSelectCommit:a,onClose:()=>a(null)})})]})]})}function z7(){return yg(W2,A7,q2)}function H7(){try{const e=localStorage.getItem(G2);if(e==="list"||e==="tree")return e}catch{}return"list"}function yg(e,t,i=0){try{const s=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(s)&&s>=i)return s}catch{}return t}function $7(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}function F7(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M5 3v12M10 7v8M14 11v4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),l.jsx("path",{d:"M5 7c1.8 0 2.4 0 5 0M10 11c1.4 0 2.2 0 4 0",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}const U7={id:"history",title:"History",icon:()=>l.jsx(F7,{}),pathAware:!0,render:e=>l.jsx(B7,{ctx:e})},Sg=new Set;let P_={file:null};function K2(){for(const e of Sg)e()}function W7(e){return Sg.add(e),()=>{Sg.delete(e)}}function FS(){return P_}function G7(e,t){const i=L.useSyncExternalStore(W7,FS,FS);return!i.file||i.file.theaterId!==e||i.file.subPath!==t?null:i.file}function q7(e,t,i){P_={file:{entry:e,subPath:t,theaterId:i}},K2()}function US(){P_={file:null},K2()}const V2="fleet-console.diff.viewMode",Y2="fleet-console.diff.listPaneWidth",K7=400,V7=248,X2=220;function Y7(){try{const e=localStorage.getItem(V2);if(e==="list"||e==="tree")return e}catch{}return"list"}function X7(){try{const e=localStorage.getItem(Y2),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(X2,t)}catch{}return V7}function Z7(e){return e.entry.status==="U"?"untracked":"unified"}function J7({ctx:e}){const t=I2(e.theaterId,e.pathContext.relPath);return l.jsx(Q7,{ctx:e},t)}function Q7({ctx:e}){const[t,i]=L.useState(Y7),[s,a]=L.useState(""),d=e.pathContext.relPath??"",f=G7(e.theaterId??null,d),[c,h]=L.useState(X7),p=L.useRef(c),g=L.useRef(null),[m,S]=L.useState(!1);L.useLayoutEffect(()=>()=>US(),[]);const w=L.useCallback(v=>{e.theaterId&&q7(v,d,e.theaterId)},[e.theaterId,d]),T=L.useCallback(()=>US(),[]),C=L.useCallback(v=>{i(v);try{localStorage.setItem(V2,v)}catch{}},[]),_=L.useCallback(v=>{v.preventDefault();const y=g.current;if(!y)return;const k=y.getBoundingClientRect().width,M=v.clientX,R=p.current;S(!0);const N=I=>{const $=x7({startWidth:R,dx:I.clientX-M,containerWidth:k,listPaneMinWidth:X2,hunkPaneMinWidth:z2,dividerWidth:Vr});$!==null&&(p.current=$,h($))},A=()=>{document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",A),S(!1);try{localStorage.setItem(Y2,String(p.current))}catch{}};document.addEventListener("pointermove",N),document.addEventListener("pointerup",A)},[]);L.useLayoutEffect(()=>(e.requestExtraWidth?.(f?K7:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,f]);const b=f?Z7(f):null;return l.jsxs("div",{ref:g,className:`diff-root${f?" has-hunk":""}${m?" is-dragging":""}`,style:f?{gridTemplateColumns:w7(c)}:void 0,children:[f&&b?l.jsxs("div",{className:"diff-hunk-pane",children:[l.jsxs("div",{className:"diff-hunk-head",children:[l.jsx("span",{children:f.entry.path}),l.jsx("button",{type:"button",onClick:T,children:"✕"})]}),l.jsx(B2,{ctx:e,file:f.entry,mode:b,subPath:f.subPath})]}):null,f?l.jsx("div",{className:"diff-divider",onPointerDown:_,"aria-hidden":"true"}):null,l.jsxs("div",{className:"diff-list-pane",children:[l.jsxs("div",{className:"diff-toolbar",children:[l.jsxs("div",{className:"diff-filter",children:[l.jsx("input",{type:"text",className:"diff-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:s,onChange:v=>a(v.target.value)}),s?l.jsx("button",{type:"button",className:"diff-filter-clear","aria-label":"Clear filter",onClick:()=>a(""),children:"✕"}):null]}),l.jsxs("div",{className:"diff-view-toggle",children:[l.jsx("button",{type:"button",className:`diff-toggle-btn${t==="list"?" is-active":""}`,title:"List view","aria-pressed":t==="list",onClick:()=>C("list"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsx("button",{type:"button",className:`diff-toggle-btn${t==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":t==="tree",onClick:()=>C("tree"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),l.jsx(f7,{ctx:e,viewMode:t,selectedPath:f?.entry.path??null,subPath:d,onSelect:w,filterText:s})]})]})}function eI(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),l.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),l.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),l.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const tI={id:"diff",title:"Diff",icon:()=>l.jsx(eI,{}),pathAware:!0,render:e=>l.jsx(J7,{ctx:e})},nI={id:"diff",railPanels:[tI,U7]},iI=[nI],ch=["claude-code","codex","cursor","opencode"],rI={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},sI="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function aI({source:e,skill:t,theaterId:i,relPath:s,onCancel:a,onStarted:d,jobLog:f}){const[c,h]=L.useState(i?"project":"global"),[p,g]=L.useState(!0),[m,S]=L.useState(new Set(ch)),{status:w,start:T}=f,C=w==="running",_=w==="done",b=w==="error",v=L.useCallback(()=>{g(!0),S(new Set(ch))},[]),y=L.useCallback(M=>{g(!1),S(R=>{const N=new Set(R);return N.has(M)?N.delete(M):N.add(M),N})},[]),k=L.useCallback(()=>{const M=p?ch:Array.from(m);if(M.length===0)return;const R={source:e,skill:t,scope:c,agents:M};c==="project"&&i&&(R.theaterId=i,R.relPath=s),T("/plugins/skills/install",R),d(c)},[p,m,e,t,c,i,s,T,d]);return l.jsxs("div",{className:"skills-install-flow",children:[l.jsxs("div",{className:"skills-scope-toggle",children:[l.jsx("button",{type:"button",className:`skills-scope-btn${c==="project"?" is-active":""}`,onClick:()=>h("project"),disabled:!i||C||_,title:i?void 0:"Select a Theater to install project skills",children:"Project"}),l.jsx("button",{type:"button",className:`skills-scope-btn${c==="global"?" is-active":""}`,onClick:()=>h("global"),disabled:C||_,children:"Global"})]}),l.jsxs("div",{className:"skills-agents-row",children:[l.jsx("button",{type:"button",className:`skills-agent-chip${p?" is-active":""}`,onClick:v,disabled:C||_,children:"All agents"}),ch.map(M=>l.jsx("button",{type:"button",className:`skills-agent-chip${!p&&m.has(M)?" is-active":""}`,onClick:()=>y(M),disabled:C||_,children:rI[M]},M))]}),l.jsx("p",{className:"skills-permission-warning",children:sI}),!C&&!_&&!b&&l.jsxs("div",{className:"skills-card-actions",children:[l.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:a,children:"Cancel"}),l.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:k,disabled:!p&&m.size===0,children:"Install now"})]})]})}const oI=4e3;function Z2({status:e,lines:t,runningLabel:i,doneLabel:s,errorLabel:a,onDismiss:d,onRetry:f}){const[c,h]=L.useState(!1),p=L.useRef(null),g=L.useRef(null);L.useEffect(()=>{e==="running"&&h(!1)},[e]),L.useEffect(()=>{const _=p.current;_&&(_.scrollTop=_.scrollHeight)},[t]),L.useEffect(()=>{if(e==="done")return g.current=setTimeout(()=>{h(!1),d()},oI),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[e,d]);const m=L.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),h(!1),d()},[d]),S=L.useCallback(()=>h(_=>!_),[]);if(e==="idle")return null;const w=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",T=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",C=e==="running"?i:e==="done"?s:a;return l.jsxs("div",{className:"skills-dock",children:[c&&l.jsxs("div",{ref:p,className:"skills-dock-log",children:[t.map((_,b)=>l.jsx("div",{className:"skills-dock-log-line",children:_},b)),e==="done"&&l.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",s]}),e==="error"&&l.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",a]})]}),l.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${c?" is-open":""}`,"aria-expanded":c,onClick:S,onKeyDown:_=>{_.target===_.currentTarget&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),S())},children:[l.jsx("span",{className:w,"aria-hidden":"true"}),l.jsx("span",{className:T,"aria-live":"polite",children:C}),e==="running"&&t.length>0&&l.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&l.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m()},children:"✕"}),e==="error"&&l.jsxs(l.Fragment,{children:[f!=null&&l.jsx("button",{type:"button",className:"skills-dock-retry",onClick:_=>{_.stopPropagation(),f()},children:"Retry"}),l.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m()},children:"✕"})]}),l.jsx("span",{className:`skills-dock-chevron${c?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const lI={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},xg=new Set;let Rn=lI;function Is(){for(const e of xg)e()}function cI(e){return xg.add(e),()=>{xg.delete(e)}}function WS(){return Rn}function z_(){return L.useSyncExternalStore(cI,WS,WS)}function uh(e){Rn={...Rn,activeTab:e},Is()}function GS(e){Rn={...Rn,scope:e},Is()}function uI(e){Rn={...Rn,filterText:e},Is()}function hI(e){Rn={...Rn,searchQuery:e},Is()}function co(e,t){Rn={...Rn,searchResults:e,searchLoading:t},Is()}function ed(e,t){return JSON.stringify([e,t])}function wg(e,t){return e.installedContextKey===t}function _m(e,t,i){Rn.installedContextKey===e&&(Rn={...Rn,installedList:t,installedLoading:i},Is())}function Cg(e){Rn={...Rn,installFormOpenId:e},Is()}function dI(e){Rn={...Rn,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Is()}const qS=750;function J2(){const[e,t]=L.useState({status:"idle",lines:[]}),i=L.useRef(null),s=L.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);L.useEffect(()=>()=>s(),[s]);const a=L.useCallback(()=>{s(),t({status:"idle",lines:[]})},[s]),d=L.useCallback((f,c)=>{s(),t({status:"running",lines:[]}),(async()=>{const h=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).catch(()=>null);if(!h?.ok){t({status:"error",lines:[]});return}const{jobId:p}=await h.json();let g=0;const m=async()=>{const S=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(p)}&cursor=${g}`).catch(()=>null);if(!S?.ok){t(T=>({...T,status:"error"}));return}const w=await S.json();g=w.nextCursor,t(T=>({...T,lines:[...T.lines,...w.lines]})),w.status==="running"?i.current=setTimeout(()=>{m()},qS):t(T=>({...T,status:w.status}))};i.current=setTimeout(()=>{m()},qS)})()},[s]);return{...e,start:d,reset:a}}const fI=300,kh=2;function pI(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function mI(e){if(e.length<kh){co([],!1);return}co([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){co([],!1);return}const i=await t.json();co(i.skills??[],!1)}catch{co([],!1)}}function gI({result:e,theaterId:t,relPath:i,isFormOpen:s,onInstallClick:a,onReadMore:d,onInstallStarted:f,jobLog:c}){const h={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return l.jsxs("div",{className:`skills-card${s?" is-expanded":""}`,children:[l.jsxs("div",{className:"skills-card-header",children:[l.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>d(h,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&l.jsx("span",{className:"skills-card-installs",children:pI(e.installs)})]}),l.jsx("span",{className:"skills-card-meta",children:e.source}),l.jsx("div",{className:"skills-card-actions",children:l.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:a,children:s?"Cancel":"Install"})}),s&&l.jsx(aI,{source:e.source,skill:e.name,theaterId:t,relPath:i,onCancel:a,onStarted:p=>f(e.name,p),jobLog:c})]})}function _I({theaterId:e,relPath:t,onReadMore:i,onInstallSuccess:s}){const{searchQuery:a,searchResults:d,searchLoading:f,installFormOpenId:c}=z_(),h=L.useRef(null),p=J2(),[g,m]=L.useState(null),S=L.useCallback(T=>{if(hI(T),h.current&&clearTimeout(h.current),T.length<kh){co([],!1);return}h.current=setTimeout(()=>{mI(T)},fI)},[]);L.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),L.useEffect(()=>{p.status!=="done"||!g||(s(g.name,g.scope),Cg(null),m(null))},[p.status,g,s]);const w=g?`Installing ${g.name}…`:"Installing…";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"skills-tab-body",children:[l.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:a,onChange:T=>S(T.target.value),"aria-label":"Search skills registry"}),f&&l.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!f&&a.length>=kh&&d.length===0&&l.jsxs("div",{className:"skills-empty-state",children:['No results for "',a,'".']}),!f&&a.length>0&&a.length<kh&&l.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),l.jsx("div",{className:"skills-card-list",children:d.map(T=>l.jsx(gI,{result:T,theaterId:e,relPath:t,isFormOpen:c===T.id,onInstallClick:()=>Cg(c===T.id?null:T.id),onReadMore:i,onInstallStarted:(C,_)=>m({name:C,scope:_}),jobLog:p},T.id))})]}),l.jsx(Z2,{status:p.status,lines:p.lines,runningLabel:w,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:p.reset})]})}const vI=2600;function bI({skill:e,onReadMore:t,onUpdate:i,onRemove:s,isUpdating:a}){const[d,f]=L.useState(!1),c=L.useRef(null),h=L.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]),p=L.useCallback(()=>{d?(h(),f(!1),s?.(e.name,e.scope)):(f(!0),c.current=setTimeout(()=>f(!1),vI))},[d,h,s,e.name,e.scope]);return L.useEffect(()=>()=>h(),[h]),l.jsxs("div",{className:"skills-card",children:[l.jsxs("div",{className:"skills-card-header",children:[l.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),l.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&l.jsx("span",{className:"skills-card-meta",children:e.source}),l.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),l.jsxs("div",{className:"skills-card-actions",children:[i&&l.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>i(e.scope),disabled:a,children:a?"Updating…":"Update all"}),s&&l.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${d?" is-armed":""}`,onClick:p,"aria-label":d?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:d?"Remove?":"✕"})]})]})}async function yI(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}&relPath=${encodeURIComponent(t??"")}`:"",s=await fetch(`/plugins/skills/list${i}`);return s.ok?(await s.json()).skills??[]:[]}function SI({theaterId:e,relPath:t,onReadMore:i,refreshKey:s}){const a=z_(),{scope:d,filterText:f}=a,c=ed(e,t),h=wg(a,c)?a.installedList:[],p=wg(a,c)&&a.installedLoading,g=J2(),m=L.useRef(null),S=L.useCallback((y,k)=>{const M=ed(y,k);_m(M,[],!0),yI(y,k).then(R=>_m(M,R,!1)).catch(()=>_m(M,[],!1))},[]);L.useEffect(()=>{S(e,t)},[e,t,S,s]),L.useEffect(()=>{(g.status==="done"||g.status==="error")&&S(e,t)},[g.status,e,t,S]);const w=L.useCallback(y=>{const k=y;m.current=k;const M={scope:k};k==="project"&&e&&(M.theaterId=e,M.relPath=t),g.start("/plugins/skills/update",M)},[e,t,g]),T=L.useCallback((y,k)=>{const M={scope:k,skill:y};k==="project"&&e&&(M.theaterId=e,M.relPath=t),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}).then(()=>S(e,t)).catch(()=>null)},[e,t,S]),C=L.useCallback(()=>{m.current&&w(m.current)},[w]),_=d==="project"&&!e?"global":d,b=h.filter(y=>y.scope!==_?!1:f?y.name.toLowerCase().includes(f.toLowerCase()):!0),v=g.status==="running"&&m.current===_;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"skills-tab-body",children:[l.jsxs("div",{className:"skills-scope-toggle",children:[l.jsx("button",{type:"button",className:`skills-scope-btn${_==="project"?" is-active":""}`,onClick:()=>GS("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),l.jsx("button",{type:"button",className:`skills-scope-btn${_==="global"?" is-active":""}`,onClick:()=>GS("global"),children:"Global"})]}),l.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:f,onChange:y=>uI(y.target.value),"aria-label":"Filter installed skills"}),p&&l.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!p&&b.length===0&&l.jsx("div",{className:"skills-empty-state",children:f?"No skills match the filter.":`No ${_} skills installed.`}),l.jsx("div",{className:"skills-card-list",children:b.map(y=>l.jsx(bI,{skill:y,onReadMore:i,onUpdate:w,onRemove:T,isUpdating:v},`${y.scope}:${y.name}`))})]}),l.jsx(Z2,{status:g.status,lines:g.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:g.reset,onRetry:C})]})}function vm(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";i&&!/^(https?:|mailto:|#)/i.test(i)&&(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 xI({content:e}){const t=L.useMemo(()=>{const a=xc(e).html,d=new DOMParser().parseFromString(a,"text/html");return vm(d.body),d.body.innerHTML},[e]),i=L.useRef(null);L.useEffect(()=>{const a=i.current;if(!a)return;vm(a);const d=new MutationObserver(()=>vm(a));return d.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>d.disconnect()},[t]);const s=L.useCallback(a=>{const d=a.target.closest('[data-action="copy-code"]');if(!d)return;const f=d.closest("pre")?.getAttribute("data-code");if(!f)return;navigator.clipboard?.writeText(f);const c=d.textContent;d.textContent="Copied",window.setTimeout(()=>{d.textContent=c},1200)},[]);return l.jsx("div",{ref:i,className:"markdown-body",onClick:s,dangerouslySetInnerHTML:{__html:t}})}const wI=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),CI="Skills run with full agent permissions. Review before use.";function EI(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(wI)),s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}function kI({skill:e,isInstalled:t,theaterId:i,relPath:s,onClose:a,onInstall:d}){const[f,c]=L.useState(null),[h,p]=L.useState(!1),g=L.useRef(null),m=L.useRef(null),S=L.useRef(null);if(L.useEffect(()=>{e&&g.current===null&&(g.current=document.activeElement)},[e]),L.useEffect(()=>{if(!e){c(null);return}p(!0),c(null);let T=!1;return(async()=>{try{let _;if(t){const v={scope:e.scope,skill:e.name};e.scope==="project"&&i&&(v.theaterId=i,v.relPath=s),_=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}else _=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:i,relPath:s})});if(T)return;if(!_.ok){p(!1);return}const b=await _.json();T||(c(b.markdown??""),p(!1))}catch{T||p(!1)}})(),()=>{T=!0}},[e,t,i,s]),L.useEffect(()=>{if(!e)return;const T=C=>{C.key==="Escape"?(C.preventDefault(),a()):C.key==="Tab"&&EI(C,S.current),C.stopImmediatePropagation()};return m.current?.focus(),window.addEventListener("keydown",T,!0),()=>{window.removeEventListener("keydown",T,!0);const C=g.current;g.current=null,C?.focus?.()}},[e,a]),L.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const w=e.displayPath||e.source||null;return js.createPortal(l.jsx("div",{className:"skills-overlay-backdrop",onClick:a,"aria-hidden":"true",children:l.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:T=>T.stopPropagation(),children:[l.jsxs("div",{className:"skills-overlay-header",children:[l.jsx("span",{className:"skills-overlay-title",children:e.name}),w&&l.jsx("span",{className:"skills-overlay-meta",children:w}),l.jsx("button",{ref:m,type:"button",className:"skills-overlay-close",onClick:a,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:"skills-overlay-body",children:[h&&l.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!h&&f===null&&l.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),f!==null&&l.jsx(xI,{content:f})]}),l.jsxs("div",{className:"skills-overlay-footer",children:[l.jsx("p",{className:"skills-permission-warning",children:CI}),!t&&l.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{a(),d()},children:"Install"})]})]})}),document.body)}const TI=3200;function AI({message:e,onDismiss:t}){return L.useEffect(()=>{if(!e)return;const i=setTimeout(t,TI);return()=>clearTimeout(i)},[e,t]),e?l.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function RI({ctx:e}){const t=ed(e.theaterId,e.pathContext.relPath);return l.jsx(LI,{ctx:e},t)}function LI({ctx:e}){const{theaterId:t}=e,i=z_(),{activeTab:s}=i,a=ed(e.theaterId,e.pathContext.relPath),[d,f]=L.useState(null),[c,h]=L.useState(null),[p,g]=L.useState(0),m=wg(i,a)?i.installedList.length:0;L.useLayoutEffect(()=>{dI(a)},[a]);const S=L.useCallback(_=>{f({skill:_,isInstalled:!0})},[]),w=L.useCallback((_,b)=>{f({skill:_,isInstalled:!1,registryId:b})},[]),T=L.useCallback((_,b)=>{h(`Installed ${_} to ${b}`),g(v=>v+1),uh("installed")},[]),C=L.useCallback(()=>{d?.registryId&&(Cg(d.registryId),uh("find")),f(null)},[d]);return l.jsxs("div",{className:"skills-root",children:[l.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":s==="installed",className:`skills-tab-btn${s==="installed"?" is-active":""}`,onClick:()=>uh("installed"),children:["Installed",m>0?` ${m}`:""]}),l.jsx("button",{type:"button",role:"tab","aria-selected":s==="find",className:`skills-tab-btn${s==="find"?" is-active":""}`,onClick:()=>uh("find"),children:"Find"})]}),s==="installed"?l.jsx(SI,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:S,refreshKey:p}):l.jsx(_I,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:w,onInstallSuccess:T}),l.jsx(AI,{message:c,onDismiss:()=>h(null)}),l.jsx(kI,{skill:d?.skill??null,isInstalled:d?.isInstalled??!1,theaterId:t,relPath:e.pathContext.relPath,onClose:()=>f(null),onInstall:C})]})}function MI(){return l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:l.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 NI={id:"skills",title:"Skills",icon:MI,pathAware:!0,render:e=>l.jsx(RI,{ctx:e})},OI={id:"skills",railPanels:[NI]},DI=[OI],Q2=[...HO,...s7,...iI,...DI],jI=tE(Q2),eE=L.createContext(jI),II=eE.Provider;async function BI(){const e=[...Q2],t=new Set(e.map(s=>s.id)),i=await PI();for(const s of i){if(t.has(s.id)){console.warn(`Skipping external plugin with duplicate id: ${s.id}`);continue}const a=await zI(s);if(a){if(t.has(a.id)){console.warn(`Skipping external plugin with duplicate id: ${a.id}`);continue}t.add(a.id),e.push(a)}}return tE(e)}function Io(){return L.useContext(eE)}async function PI(){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($I):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function zI(e){try{const t=await import(e.clientUrl),i=t.default??t.plugin;return HI(i)?i:(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 tE(e){const t=new Set,i=[];for(const s of e)for(const a of s.railPanels??[]){if(t.has(a.id)){console.warn(`Skipping rail panel with duplicate id: ${a.id}`);continue}t.add(a.id),i.push(a)}return{plugins:e,operationKinds:e.flatMap(s=>s.operationKinds??[]),settingsSections:e.flatMap(s=>s.settingsSections??[]),notificationKinds:e.flatMap(s=>s.notificationKinds??[]),railPanels:i}}function HI(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function $I(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 FI=288,UI=520,Wl=12,ws=[{id:"operations",label:"Operations"},{id:"map",label:"Map"}],WI=/mac|iphone|ipad|ipod/i;function nE({anchor:e,viewportBounds:t,placement:i="cursor",mode:s="full",catalog:a,canLaunch:d,formationView:f=!1,renderKindIcon:c,onLaunchKind:h,onResetView:p,onToggleFormation:g,onClose:m}){const S=L.useRef(null),w=L.useRef(null),T=L.useRef({operations:null,map:null}),[C,_]=L.useState("operations");KI();const b=s==="full",v=s==="full"||s==="launch",y=s==="full";L.useEffect(()=>{const R=A=>{S.current?.contains(A.target)||m()},N=A=>{A.key==="Escape"&&m()};return document.addEventListener("mousedown",R),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",N)}},[m]),L.useEffect(()=>{w.current?.focus()},[]);const k=(R,N=!1)=>{_(R),N&&window.requestAnimationFrame(()=>T.current[R]?.focus())},M=R=>{const N=ws.findIndex(I=>I.id===C),A=ws.length-1;if(R.key==="ArrowRight"||R.key==="ArrowLeft"){R.preventDefault();const I=R.key==="ArrowRight"?1:-1,$=ws[(N+I+ws.length)%ws.length];k($.id,!0)}else R.key==="Home"?(R.preventDefault(),k(ws[0].id,!0)):R.key==="End"&&(R.preventDefault(),k(ws[A].id,!0))};return l.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${i==="above"?"operation-launch-control--up":""}`,ref:S,style:qI(e,t,i),"data-canvas-blocker":!0,children:l.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:w,children:[l.jsxs("div",{className:"canvas-context-menu-head",children:[l.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:l.jsx(GI,{})}),l.jsx("span",{className:"canvas-context-menu-head-text",children:l.jsx("strong",{children:"Canvas controls"})})]}),b?l.jsx("div",{className:"canvas-context-menu-tabs",role:"tablist","aria-label":"Canvas control sections",children:ws.map(R=>l.jsx("button",{ref:N=>{T.current[R.id]=N},type:"button",id:`canvas-control-tab-${R.id}`,className:"canvas-context-menu-tab",role:"tab","aria-selected":C===R.id,"aria-controls":`canvas-control-panel-${R.id}`,tabIndex:C===R.id?0:-1,onClick:()=>k(R.id),onKeyDown:M,children:R.label},R.id))}):null,v?l.jsxs("div",{id:"canvas-control-panel-operations",role:"tabpanel","aria-labelledby":"canvas-control-tab-operations",className:"canvas-context-menu-panel",hidden:b?C!=="operations":void 0,children:[l.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),a.length>0?a.map((R,N)=>l.jsxs("div",{children:[N>0?l.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,l.jsx("p",{className:"canvas-context-menu-plugin",children:R.title}),R.kinds.map(A=>{const I=A.disabled===!0||!d;return l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:I,title:A.disabledReason,onClick:()=>h(R.id,A),children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c(R.id,A)??l.jsx(XI,{})}),l.jsx("span",{className:"theater-menu-label",children:A.title}),A.disabledReason?l.jsx("span",{className:"operation-launch-menu-reason",children:A.disabledReason}):null]},`${R.id}:${A.id}`)})]},R.id)):l.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]}):null,y?l.jsx(l.Fragment,{children:l.jsxs("div",{id:"canvas-control-panel-map",role:"tabpanel","aria-labelledby":"canvas-control-tab-map",className:"canvas-context-menu-panel",hidden:b?C!=="map":void 0,children:[l.jsx("p",{className:"canvas-context-menu-section",children:"View"}),l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item",onClick:p,children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:l.jsx(VI,{})}),l.jsx("span",{className:"theater-menu-label",children:"Reset view"})]}),g?l.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":f,className:"theater-menu-item canvas-context-menu-item",onClick:g,children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:f?"✓":l.jsx(YI,{})}),l.jsx("span",{className:"theater-menu-label",children:"Formation view"})]}):null]})}):null]})})}function GI(){return l.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),l.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"}),l.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function qI(e,t,i){const s=t?Math.max(Wl,Math.min(e.x,t.width-FI-Wl)):e.x;if(i==="above")return{left:s,bottom:Math.max(Wl,e.y)};const a=t?Math.max(Wl,Math.min(e.y,t.height-UI-Wl)):e.y;return{left:s,top:a}}function KI(){const t=navigator.userAgentData?.platform??navigator.platform;return WI.test(t)?"⌘":"Ctrl"}function VI(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function YI(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function XI(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function iE(e,t){const i=document.activeElement;e===null||!(i instanceof Node)||!e.contains(i)||document.querySelector(t)?.focus()}const hh="directory-browser-sectors";function rE({open:e,onCancel:t,onConfirm:i}){const[s,a]=L.useState(null),[d,f]=L.useState(null),[c,h]=L.useState(null),[p,g]=L.useState(""),[m,S]=L.useState(""),[w,T]=L.useState(0),C=L.useRef(null),_=L.useRef(null),b=async(G,P)=>{f(G),h(null),g(""),T(0);try{const K=await HR(G,P);a(K)}catch(K){if(K instanceof DOMException&&K.name==="AbortError")return;h(K instanceof dt?K.message:String(K))}finally{f(null)}};L.useEffect(()=>{if(!e)return;const G=new AbortController;return b(null,G.signal),()=>G.abort()},[e]),L.useEffect(()=>{e&&C.current?.focus()},[e,s?.path]);const v=s?.entries??[],y=L.useMemo(()=>{const G=p.trim().toLowerCase();return G===""?v:v.filter(P=>P.name.toLowerCase().includes(G))},[v,p]),k=L.useMemo(()=>s?ZI(s):[],[s]),M=s?KS(s.path):null,R=s?.roots??[],N=R.length>1,A=y.length===0?-1:Math.min(w,y.length-1);if(L.useEffect(()=>{if(A<0)return;_.current?.querySelector(`[data-index="${A}"]`)?.scrollIntoView({block:"nearest"})},[A,s?.path]),!e)return null;const I=G=>{G.accessible&&d===null&&b(G.path)},$=()=>{s?.parentPath!=null&&d===null&&b(s.parentPath)},H=()=>{const G=m.trim();G!==""&&d===null&&b(G)},q=s?.path??null,B=A>=0?`${hh}-${A}`:void 0,Y=G=>{switch(G.key){case"Escape":p!==""?g(""):t();return;case"ArrowDown":G.preventDefault(),T(P=>Math.min(P+1,Math.max(y.length-1,0)));return;case"ArrowUp":G.preventDefault(),T(P=>Math.max(P-1,0));return;case"Enter":{G.preventDefault();const P=y[A];P&&I(P);return}case"Backspace":p===""&&(G.preventDefault(),$());return;default:return}};return js.createPortal(l.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[l.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),l.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:Y,children:[l.jsxs("header",{className:"directory-browser-header",children:[l.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:l.jsx(eB,{})}),l.jsxs("div",{className:"directory-browser-heading",children:[l.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),l.jsx("h2",{children:"Add Theater"})]}),l.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),N?l.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[l.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),l.jsx("div",{className:"directory-browser-root-chips",children:R.map(G=>{const P=M!=null&&KS(G)===M;return l.jsx("button",{type:"button",className:`directory-browser-root-chip ${P?"is-active":""}`,"aria-current":P?"location":void 0,disabled:d!==null,title:G,onClick:()=>{d===null&&b(G)},onKeyDown:K=>K.stopPropagation(),children:QI(G)},G)})})]}):null,l.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:k.map((G,P)=>{const K=P===k.length-1;return l.jsxs("span",{className:"directory-browser-course-seg",children:[P>0?l.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,l.jsx("button",{type:"button",className:`directory-browser-crumb ${K?"is-current":""}`,"aria-current":K?"location":void 0,disabled:K||d!==null,title:G.path,onClick:()=>{b(G.path)},children:G.label})]},G.path)})}),l.jsxs("div",{className:"directory-browser-toolbar",children:[l.jsxs("div",{className:"directory-browser-filter",children:[l.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:l.jsx(nB,{})}),l.jsx("input",{ref:C,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":hh,value:p,spellCheck:!1,autoComplete:"off",onChange:G=>{g(G.target.value),T(0)}})]}),l.jsxs("button",{type:"button",className:"directory-browser-up",disabled:s?.parentPath==null||d!==null,title:"Up one folder (Backspace)",onClick:$,children:[l.jsx(iB,{}),l.jsx("span",{children:"Up"})]})]}),l.jsxs("div",{className:"directory-browser-jump",children:[l.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:m,spellCheck:!1,autoComplete:"off",onChange:G=>S(G.target.value),onKeyDown:G=>{G.stopPropagation(),G.key==="Enter"&&(G.preventDefault(),H())}}),l.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:m.trim()===""||d!==null,onClick:H,onKeyDown:G=>G.stopPropagation(),children:"Go"})]}),c?l.jsx("p",{className:"directory-browser-error",role:"alert",children:c}):null,l.jsx("div",{className:"directory-browser-list",id:hh,role:"listbox","aria-label":"Folders","aria-busy":d!==null,"aria-activedescendant":B,ref:_,children:d!==null?l.jsxs("p",{className:"directory-browser-state is-live",children:[l.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):y.length===0?l.jsx("p",{className:"directory-browser-state",children:p!==""?"No folders match the filter.":"No folders available."}):y.map((G,P)=>l.jsxs("div",{id:`${hh}-${P}`,"data-index":P,role:"option","aria-selected":P===A,"aria-disabled":!G.accessible,className:`directory-browser-sector ${P===A?"is-active":""} ${G.accessible?"":"is-locked"}`,title:G.path,onClick:()=>{T(P),I(G)},children:[l.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:l.jsx(tB,{})}),l.jsx("span",{className:"directory-browser-sector-name",children:G.name}),G.accessible?l.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):l.jsxs("span",{className:"directory-browser-sector-lock",children:[l.jsx(rB,{})," Locked"]})]},G.path))}),s?.truncated?l.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,l.jsxs("footer",{className:"directory-browser-actions",children:[l.jsxs("div",{className:"directory-browser-target",children:[l.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),l.jsx("span",{className:"directory-browser-target-path",title:q??"",children:q??"Loading…"})]}),l.jsxs("div",{className:"directory-browser-buttons",children:[l.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),l.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:q===null||d!==null,onClick:()=>q&&i(q),children:"Add Theater"})]})]})]})]}),document.body)}function ZI(e){if(JI(e)==="/"){const f=[{label:"/",path:"/"}];let c="";for(const h of e.path.split("/").filter(Boolean))c+=`/${h}`,f.push({label:h,path:c});return f}const i=/^([A-Za-z]:)\\?/.exec(e.path),s=i?`${i[1]}\\`:e.roots[0]??"C:\\",a=[{label:s,path:s}];let d=s.replace(/\\$/,"");for(const f of e.path.slice(s.length).split("\\").filter(Boolean))d+=`\\${f}`,a.push({label:f,path:d});return a}function JI(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function KS(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function QI(e){return e.replace(/[\\/]+$/,"")||e}function eB(){return l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),l.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 tB(){return l.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:l.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 nB(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function iB(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 rB(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.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 Sd=[{key:"red",label:"Red",color:"oklch(70% 0.12 25)"},{key:"orange",label:"Orange",color:"oklch(73% 0.12 50)"},{key:"amber",label:"Amber",color:"oklch(78% 0.11 70)"},{key:"yellow",label:"Yellow",color:"oklch(84% 0.11 95)"},{key:"lime",label:"Lime",color:"oklch(81% 0.12 120)"},{key:"green",label:"Green",color:"oklch(74% 0.12 145)"},{key:"emerald",label:"Emerald",color:"oklch(73% 0.10 165)"},{key:"teal",label:"Teal",color:"oklch(74% 0.09 185)"},{key:"cyan",label:"Cyan",color:"oklch(76% 0.09 205)"},{key:"sky",label:"Sky",color:"oklch(74% 0.10 230)"},{key:"blue",label:"Blue",color:"oklch(70% 0.11 255)"},{key:"indigo",label:"Indigo",color:"oklch(68% 0.11 278)"},{key:"violet",label:"Violet",color:"oklch(70% 0.11 300)"},{key:"purple",label:"Purple",color:"oklch(70% 0.12 320)"},{key:"magenta",label:"Magenta",color:"oklch(71% 0.12 340)"},{key:"rose",label:"Rose",color:"oklch(72% 0.11 5)"}];function To(e){return Sd.find(t=>t.key===e)?.color??null}function VS(e){return typeof e.accent=="string"?e.accent:null}const YS=8,sB=260;function XS(e){const{anchor:t,onClose:i}=e,[s,a]=L.useState(void 0);return L.useLayoutEffect(()=>{const d=Math.max(8,Math.min(t.left,window.innerWidth-208)),f=t.bottom+YS,c=f+sB>window.innerHeight;a(c?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-t.top+YS)}:{position:"fixed",left:d,top:Math.round(f)})},[t]),L.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]),js.createPortal(l.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:s?l.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:s,onPointerDown:d=>d.stopPropagation(),children:e.kind==="chip"?l.jsx(aB,{...e}):l.jsx(oB,{...e})}):null}),document.body)}function aB({operation:e,groups:t,accentKey:i,actions:s,onClose:a}){const[d,f]=L.useState(!1),[c,h]=L.useState(`Group ${t.length+1}`),p=L.useRef(!1),g=L.useRef(null);L.useEffect(()=>{d&&g.current?.select()},[d]);const m=()=>{const S=c.trim();S&&(s.onCreateGroup(S),a())};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(S=>{const w=To(S.color),T=e.groupId===S.id;return l.jsxs("button",{type:"button",className:`group-context-menu-item${T?" is-selected":""}`,role:"menuitemradio","aria-checked":T,onClick:()=>{s.onSetGroupId(T?null:S.id),a()},children:[l.jsx("span",{className:"group-context-menu-item__dot",style:w?{background:w}:void 0,"aria-hidden":"true"}),l.jsx("span",{className:"group-context-menu-item__name",children:S.name}),T?l.jsx(lB,{}):null]},S.id)}),d?l.jsx("input",{ref:g,className:"group-context-menu-new-input",type:"text",value:c,onChange:S=>h(S.target.value),onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:S=>{S.key==="Enter"&&!p.current&&(S.preventDefault(),m()),S.key==="Escape"&&(S.preventDefault(),f(!1))},onBlur:()=>f(!1),"aria-label":"New group name",placeholder:"Group name"}):l.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>f(!0),children:l.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),l.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),l.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),l.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>{s.onSetAccent(null),a()},children:[l.jsx("span",{}),"None"]}),l.jsx("div",{className:"group-context-menu-swatches",children:Sd.map(S=>l.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":S.label,"aria-pressed":i===S.key,onClick:()=>{s.onSetAccent(S.key),a()},children:l.jsx("span",{style:{background:S.color}})},S.key))})]})}function oB({group:e,actions:t,onClose:i}){const[s,a]=L.useState(e.name),[d,f]=L.useState(!1),c=L.useRef(!1),h=()=>{const p=s.trim();if(!p||p===e.name){i();return}t.onRename(p),i()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),l.jsx("div",{className:"group-context-menu-swatches",children:Sd.map(p=>l.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":p.label,"aria-pressed":e.color===p.key,onClick:()=>{t.onSetColor(p.key),i()},children:l.jsx("span",{style:{background:p.color}})},p.key))}),l.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),l.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),l.jsx("input",{className:"group-context-menu-new-input",type:"text",value:s,onChange:p=>a(p.target.value),onCompositionStart:()=>{c.current=!0},onCompositionEnd:()=>{c.current=!1},onKeyDown:p=>{p.key==="Enter"&&!c.current&&(p.preventDefault(),h()),p.key==="Escape"&&(p.preventDefault(),i())},onBlur:h,"aria-label":"Group name"}),l.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),l.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${d?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!d){f(!0);return}t.onUngroupAll(),i()},"aria-label":d?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:d?"Confirm ungroup all?":"Ungroup all"})]})}function lB(){return l.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:l.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const cB="fleet-console.canvas.",uB=400,Eg=640,kg=400,ZS=40,hB=320,dB=200,fB=8,pB=0,JS=96,mB=.25,gB=1,bm=.2,QS=.5,_B=.001,mo={x:0,y:0,zoom:1},wo={viewport:mo,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Tg=new Set,Ag=new Set,Rg=new Set,Cc=new Map,H_=new Map;let $n=null,Ns=null,Ve=wo,Fn=null,ga=!1,Rs=mo,da=null,td=0;function $_(e){return Tg.add(e),()=>{Tg.delete(e)}}function Ao(){return Ve}function Lg(){return Fn}function Mg(){return ga}function vB(){return $n}function sE(){return L.useSyncExternalStore($_,Ao,Ao)}function aE(){return L.useSyncExternalStore(TB,tx,tx)}function F_(){return L.useSyncExternalStore(kB,Mg,Mg)}function oE(){return L.useSyncExternalStore($_,nx,nx)}function Yn(e){Ve={viewport:e.viewport??Ve.viewport,operations:e.operations??Ve.operations,operationOrder:e.operationOrder??Ve.operationOrder,operationAccent:e.operationAccent??Ve.operationAccent,minimized:e.minimized??Ve.minimized,collapsedGroups:e.collapsedGroups??Ve.collapsedGroups},MB(),hE()}function bB(e){const t=Ve.collapsedGroups.includes(e)?Ve.collapsedGroups.filter(i=>i!==e):[...Ve.collapsedGroups,e];Yn({collapsedGroups:t})}function yB(){return L.useSyncExternalStore($_,ix,ix)}function Ng(e){G_();const t=q_(e);Rs=t,Yn({viewport:t})}function lE(e){const t=q_(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||LB()){Ng(t);return}Rs=t,da===null&&(da=window.requestAnimationFrame(fE))}function Og(e,t){const i=_a();Yn({operations:{...Ve.operations,[e]:{...K_(t,i),zIndex:i}}})}function SB(e,t,i=hB,s=dB,a=fB,d=pB){if(!Number.isFinite(t)||t<=0)return[];const f=Math.ceil(Math.sqrt(t)),c=Math.ceil(t/f),h=Math.max(0,e.width-d*2),p=Math.max(0,e.height-d*2),g=Math.max(0,p-a*(c-1)),m=g/c,S=Math.min(s,m),w=Math.min(Math.max(S,m),g);return Array.from({length:t},(T,C)=>{const _=Math.floor(C/f),b=C%f,v=_===c-1?t-(c-1)*f:f,y=Math.max(0,h-a*(v-1)),k=y/v,M=Math.min(i,k),R=Math.min(Math.max(M,k),y);return{x:e.x+d+b*(R+a),y:e.y+d+_*(w+a),width:R,height:w}})}function cE(e){Ve.minimized.includes(e)||(Fn===e&&Ds(),Yn({minimized:[...Ve.minimized,e]}))}function xB(e){const t=new Set,s=[...Ve.minimized.filter(a=>t.has(a)||!(a in Ve.operations)?!1:(t.add(a),!0)),...e.filter(a=>t.has(a)||!(a in Ve.operations)?!1:(t.add(a),!0))];dE(Ve.minimized,s)||(Fn&&s.includes(Fn)&&Ds(),Yn({minimized:s}))}function dh(e){if(!Ve.minimized.includes(e))return;Fn===e&&Ds();const t=Ve.minimized.filter(a=>a!==e),i=Ve.operations[e];if(!i){Yn({minimized:t});return}const s=_a();Yn({minimized:t,operations:{...Ve.operations,[e]:{...i,zIndex:s}}})}function ym(e){Yn({operationOrder:gE(e)})}function _a(){return td+=1,td}function wB(e){const t=Ve.operations[e];if(t)return t;const i=Object.keys(Ve.operations).length,s={x:i*ZS,y:i*ZS,width:Eg,height:kg,zIndex:_a()};return Yn({operations:{...Ve.operations,[e]:s}}),s}function CB(e){const t=new Set(e),i={};let s=!1;for(const[g,m]of Object.entries(Ve.operations))t.has(g)?i[g]=m:s=!0;const a=Ve.minimized.filter(g=>t.has(g)),d=a.length!==Ve.minimized.length,f=Ve.operationOrder.filter(g=>t.has(g)),c=f.length!==Ve.operationOrder.length,h=Object.fromEntries(Object.entries(Ve.operationAccent).filter(([g])=>t.has(g))),p=Object.keys(h).length!==Object.keys(Ve.operationAccent).length;Fn&&(!t.has(Fn)||a.includes(Fn))&&Ds(),(s||d||c||p)&&Yn({operations:i,minimized:a,operationOrder:f,operationAccent:h})}function EB(e){NB(),G_(),AB(),$n=e,Ve=e?DB(e):wo;const t=e?Cc.get(e)??null:null,i=Fn!==t;Fn=t;const s=e?H_.has(e):!1,a=ga!==s;ga=s,Rs=Ve.viewport,td=Math.max(td,_E(Ve.operations)),hE(),i&&W_(),a&&U_()}function ex(e,t){const i=Ve.operations[e];if(!i)return;const s=Math.max(mB,Math.min(gB,Math.min((t.width-JS)/i.width,(t.height-JS)/i.height))),a={x:t.width/2-(i.x+i.width/2)*s,y:t.height/2-(i.y+i.height/2)*s,zoom:s};G_(),Rs=a;const d=_a(),f=Ve.minimized.includes(e);Yn({viewport:a,operations:{...Ve.operations,[e]:{...K_(i,d),zIndex:d}},...f?{minimized:Ve.minimized.filter(c=>c!==e)}:{}})}function cc(e){uE(),$n&&Cc.set($n,e);const t=RB(e),i=!dE(Ve.minimized,t),s=Fn!==e;s&&(Fn=e),i&&Yn({minimized:t}),s&&W_()}function Ds(){$n&&Cc.delete($n),Fn!==null&&(Fn=null,W_())}function nd(e){if($n){if(ga){if(e?.restoreMinimized===!0&&Ve.minimized.length>0){Yn({minimized:[]});return}uE();return}e?.restoreMinimized===!0&&Yn({minimized:[]}),Ds(),H_.set($n,!0),ga=!0,U_()}}function uE(){$n&&H_.delete($n),ga&&(ga=!1,U_())}function kB(e){return Rg.add(e),()=>{Rg.delete(e)}}function hE(){for(const e of Tg)e()}function TB(e){return Ag.add(e),()=>{Ag.delete(e)}}function tx(){return Fn}function U_(){for(const e of Rg)e()}function nx(){return Ve.minimized}function ix(){return Ve.collapsedGroups}function W_(){for(const e of Ag)e()}function AB(){$n&&(Fn?Cc.set($n,Fn):Cc.delete($n))}function RB(e){return Object.keys(Ve.operations).filter(t=>t!==e)}function dE(e,t){return e.length===t.length&&e.every((i,s)=>i===t[s])}function fE(){const e=Ve.viewport,t=Rs.x-e.x,i=Rs.y-e.y,s=Rs.zoom-e.zoom;if(Math.abs(t)<QS&&Math.abs(i)<QS&&Math.abs(s)<_B){da=null,Yn({viewport:Rs});return}Yn({viewport:{x:e.x+t*bm,y:e.y+i*bm,zoom:e.zoom+s*bm}}),da=typeof window<"u"?window.requestAnimationFrame(fE):null}function G_(){da===null||typeof window>"u"||(window.cancelAnimationFrame(da),da=null)}function LB(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function MB(){!$n||typeof window>"u"||(OB(),Ns=window.setTimeout(()=>{Ns=null,pE($n,Ve)},uB))}function NB(){!Ns||!$n||typeof window>"u"||(window.clearTimeout(Ns),Ns=null,pE($n,Ve))}function OB(){!Ns||typeof window>"u"||(window.clearTimeout(Ns),Ns=null)}function DB(e){if(typeof window>"u")return wo;try{const t=window.localStorage.getItem(mE(e));if(!t)return wo;const i=JSON.parse(t);return jB(i)}catch{return wo}}function pE(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(mE(e),JSON.stringify(t))}catch{}}function mE(e){return`${cB}${e}`}function jB(e){if(!Ro(e))return wo;const t=PB(e.operations);return{viewport:q_(e.viewport),operations:t,operationOrder:gE(e.operationOrder),operationAccent:IB(e.operationAccent),minimized:BB(e.minimized,t),collapsedGroups:HB(e.collapsedGroups)}}function gE(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const s of e)typeof s!="string"||t.has(s)||(t.add(s),i.push(s));return i}function IB(e){if(!Ro(e))return{};const t={};for(const[i,s]of Object.entries(e))typeof s=="string"&&(t[i]=s);return t}function BB(e,t){if(!Array.isArray(e))return[];const i=new Set,s=[];for(const a of e)typeof a!="string"||i.has(a)||!(a in t)||(i.add(a),s.push(a));return s}function q_(e){if(!Ro(e))return mo;const t=uc(e.x,mo.x),i=uc(e.y,mo.y),s=Dg(e.zoom,mo.zoom);return{x:t,y:i,zoom:s}}function PB(e){if(!Ro(e))return{};const t={};for(const[i,s]of Object.entries(e))Ro(s)&&(t[i]=K_(s,zB(t)));return t}function K_(e,t){return Ro(e)?{x:uc(e.x,0),y:uc(e.y,0),width:Dg(e.width,Eg),height:Dg(e.height,kg),zIndex:uc(e.zIndex,t)}:{x:0,y:0,width:Eg,height:kg,zIndex:t}}function zB(e){return _E(e)+1}function _E(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function uc(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Dg(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Ro(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function HB(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const s of e)typeof s!="string"||t.has(s)||(t.add(s),i.push(s));return i}function $B(e,t,i,s){if(!i)return{groupId:null,index:0};for(const d of t){const f=d.groupId??"__ungrouped__",c=i.querySelector(`[data-drop-zone-group-id="${f}"]`);if(!c)continue;const h=c.getBoundingClientRect();if(e<h.top||e>h.bottom)continue;const p=c.querySelector(`[data-group-section-id="${f}"]`);if(!p||e<p.getBoundingClientRect().top)return{groupId:d.groupId,index:0};const g=Array.from(p.querySelectorAll("[data-side-bar-chip-id]"));for(const m of g){const S=m.dataset.sideBarChipId;if(!S||S===s)continue;const w=m.getBoundingClientRect();if(e<=w.top+w.height/2)return{groupId:d.groupId,index:Math.max(0,d.entryIds.indexOf(S))}}return{groupId:d.groupId,index:d.entryIds.length}}const a=t[t.length-1];return{groupId:a?.groupId??null,index:a?.entryIds.length??0}}function FB(e,t,i,s){if(!i)return 0;const a=Array.from(i.querySelectorAll("[data-drop-zone-group-id]"));for(const d of a){const f=d.dataset.dropZoneGroupId;if(!f||f==="__ungrouped__"||f===s)continue;const c=t.indexOf(f);if(c===-1)continue;const h=d.getBoundingClientRect();if(e<=h.top+h.height/2)return c}return t.length}function UB(e,t,i,s){const a=e.filter(g=>g!==t),d=new Set(s),f=a.filter(g=>d.has(g)),c=Math.max(0,Math.min(i,f.length));if(f.length===0)return[...a,t];if(c<f.length){const g=a.indexOf(f[c]),m=[...a];return m.splice(g,0,t),m}const h=a.indexOf(f[f.length-1]),p=[...a];return p.splice(h+1,0,t),p}function WB(e,t,i,s){const a=new Set(s),d=e.filter(m=>a.has(m)),f=d.indexOf(t),c=d.filter(m=>m!==t),h=i>f?i-1:i,p=Math.max(0,Math.min(h,c.length));c.splice(p,0,t);let g=0;return e.map(m=>a.has(m)?c[g++]??m:m)}function GB(e,t,i){if(i.length!==t.length)return[...e];const s=new Set(t);let a=0;return e.map(d=>s.has(d)?i[a++]??d:d)}function qB(e,t,i){const s=e.indexOf(t);if(s===-1)return[...e];const a=e.filter(c=>c!==t),d=i>s?i-1:i,f=Math.max(0,Math.min(d,a.length));return a.splice(f,0,t),a}function KB(e,t,i){if(e.indexOf(t)===-1)return[...e];const a=e.filter(f=>f!==t),d=Math.max(0,Math.min(i,a.length));return a.splice(d,0,t),a}function xd(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function VB(e){const t=xd(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function V_(e){const{currentTitle:t,onCommit:i,onBegin:s}=e,a=L.useRef(null),d=L.useRef(!1),f=L.useRef(!1),[c,h]=L.useState(!1),[p,g]=L.useState("");L.useEffect(()=>{c&&(a.current?.focus(),a.current?.select())},[c]);const m=()=>{s?.(),f.current=!1,g(t),h(!0)},S=()=>{f.current=!0,h(!1),g("")},w=()=>{if(!d.current){d.current=!0;try{i(p)}finally{d.current=!1,f.current=!0,h(!1)}}};return{renaming:c,draftTitle:p,inputRef:a,begin:m,cancel:S,commit:w,setDraftTitle:g,handleKeyDown:_=>{if(_.key==="Enter"){_.preventDefault(),w();return}_.key==="Escape"&&(_.preventDefault(),S())},handleBlur:()=>{if(f.current){f.current=!1;return}w()}}}function vE({entry:e,index:t,isCloseArmed:i,accentValue:s,dragging:a,dragOffsetY:d,dropTarget:f,preview:c=!1,onArmClose:h,onDisarmClose:p,onClose:g,onMinimize:m,onFocus:S,onKeyboardMove:w,onPointerDragStart:T,onOpenAccent:C,onRename:_}){const b=L.useRef(!1),{operation:v,active:y,minimized:k,notificationCount:M,status:R}=e,N=YB(v),A=V_({currentTitle:N,onCommit:P=>_(v.id,P),onBegin:p}),I=["side-bar-chip",y?"side-bar-chip--active":"",k?"side-bar-chip--minimized":"",a?"side-bar-chip--dragging":"",f?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),$=["side-bar-chip-close",i?"is-armed":""].filter(Boolean).join(" "),H={"--i":t,...s?{"--user-accent":s}:{},...a?{"--drag-dy":`${Math.round(d)}px`}:{}},q=()=>{if(p(),b.current){b.current=!1;return}S(v.id)},B=P=>{P.stopPropagation()},Y=P=>{if(P.stopPropagation(),!i){h(v.id);return}p(),g(v.id)},G=P=>{P.preventDefault(),p(),C(v.id,P.currentTarget.getBoundingClientRect())};return l.jsxs("li",{"data-side-bar-chip-id":v.id,className:I,role:"button",tabIndex:0,"aria-label":y?`${N} (focused)`:`Focus operation ${N}`,"aria-current":y?"true":void 0,title:c?"Click to open in its Theater":y?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:H,onClick:q,onContextMenu:c?void 0:G,onFocus:()=>{i||p()},onPointerDown:P=>T(P,v.id),onPointerUp:()=>{a&&(b.current=!0)},onKeyDown:P=>{if(P.target===P.currentTarget){if(!c&&P.altKey&&P.shiftKey&&(P.key==="ArrowUp"||P.key==="ArrowDown")){P.preventDefault(),w(v.id,P.key==="ArrowUp"?-1:1);return}(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),q())}},children:[l.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:l.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??l.jsx(QB,{})})}),A.renaming?l.jsx("input",{className:"side-bar-chip-rename-input",ref:A.inputRef,value:A.draftTitle,"aria-label":`Rename operation ${N}`,onChange:P=>A.setDraftTitle(P.target.value),onKeyDown:A.handleKeyDown,onBlur:A.handleBlur,onPointerDown:P=>P.stopPropagation(),onClick:P=>P.stopPropagation()}):l.jsx("span",{className:"side-bar-chip-name",onDoubleClick:c?void 0:A.begin,children:N}),M>0?l.jsx("span",{className:"side-bar-chip-count",children:M}):null,l.jsx("span",{className:`side-bar-chip-status ${XB(R)}`,role:"img","aria-label":rx(R),title:rx(R)}),!c&&!k?l.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:B,onClick:P=>{P.stopPropagation(),p(),m(v.id)},"aria-label":`Minimize operation ${N}`,title:"Minimize operation",children:l.jsx(JB,{})}):null,c?null:l.jsx("button",{type:"button",className:$,onPointerDown:B,onClick:Y,"aria-label":i?`Confirm close operation ${N}`:`Close operation ${N}`,title:i?"Confirm close":"Close operation",children:i?"Close?":l.jsx(ZB,{})})]})}function YB(e){return e.title}function XB(e){const t=xd(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function rx(e){return VB(e)}function ZB(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 JB(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function QB(){return l.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function e9({group:e,count:t,collapsed:i,dragging:s,dropTarget:a,dragOffsetY:d,onToggle:f,onContextMenu:c,onPointerDragStart:h}){const p=L.useRef(!1),g=To(e.color),m=["side-bar-group-header",s?"side-bar-group-header--dragging":"",a?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),S={...g?{"--grp-color":g}:{},...s?{"--drag-dy":`${Math.round(d)}px`}:{}},w=_=>{_.preventDefault(),c(e.id,_.currentTarget.getBoundingClientRect())},T=_=>{_.target instanceof Element&&_.target.closest("button")||h(_,e.id)},C=()=>{s&&(p.current=!0)};return l.jsxs("div",{className:m,style:S,onContextMenu:w,onPointerDown:T,onPointerUp:C,role:"group","aria-label":e.name,children:[l.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>f(e.id),"aria-expanded":!i,"aria-label":i?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:i?"Expand":"Collapse",children:l.jsx(t9,{collapsed:i})}),l.jsx("span",{className:"side-bar-group-header__name",children:e.name}),l.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function t9({collapsed:e}){return l.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:l.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const bE="fleet-console.operations.side-width",yE="fleet-console.operations.side-collapsed",SE="fleet-console.operations.theater-collapsed",wd=280,sx=wd,jg=new Set,Ig=new Set;let fa={width:s9(),collapsed:a9()},Th=o9();function xE(){return L.useSyncExternalStore(l9,Bg,Bg)}function n9(){return L.useSyncExternalStore(u9,ax,ax)}function i9(e){const t=Math.max(wd,Math.min(wE(),e));if(fa.width!==t){fa={...fa,width:t};try{typeof window<"u"&&localStorage.setItem(bE,String(t))}catch{}CE()}}function Y_(e){if(fa.collapsed!==e){fa={...fa,collapsed:e};try{typeof window<"u"&&localStorage.setItem(yE,e?"1":"0")}catch{}CE()}}function r9(e,t){const i=new Set(Th);t?i.add(e):i.delete(e);const s=Array.from(i);if(s.join("\0")!==Th.join("\0")){Th=s;try{typeof window<"u"&&localStorage.setItem(SE,JSON.stringify(s))}catch{}c9()}}function wE(){return typeof window<"u"?Math.max(wd,window.innerWidth-480):800}function s9(){try{if(typeof window>"u")return sx;const e=localStorage.getItem(bE);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(wd,Math.min(wE(),t))}}catch{}return sx}function a9(){try{return typeof window<"u"&&localStorage.getItem(yE)==="1"}catch{return!1}}function o9(){try{if(typeof window>"u")return[];const e=localStorage.getItem(SE),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{return[]}}function CE(){for(const e of jg)e()}function Bg(){return fa}function l9(e){return jg.add(e),()=>jg.delete(e)}function c9(){for(const e of Ig)e()}function ax(){return Th}function u9(e){return Ig.add(e),()=>Ig.delete(e)}function EE(e,t){const i=e.find(a=>a.id===t.pluginId)?.kinds.filter(a=>a.type===t.type)??[],s=t.payload.launchKindId;if(typeof s=="string"){const a=i.find(d=>d.id===s);if(a)return a}return i.length===1?i[0]:null}const h9=1500,d9=6,ox=34,lx=18,f9=4;function p9({theaters:e,activeTheaterId:t,operations:i,groups:s,minimized:a,activeOperationId:d,operationNotifications:f,catalog:c,canLaunch:h,addingTheater:p,theaterError:g,renderKindIcon:m,onLaunchKind:S,onResetView:w,onClose:T,onMinimize:C,onFocus:_,onSetAccent:b,onRename:v,onSetGroupId:y,onCreateGroup:k,onSetGroupColor:M,onRenameGroup:R,onReorderGroups:N,onUngroupAll:A,onSelectTheater:I,onAddTheater:$,onCancelAddTheater:H,onForgetTheater:q}){const B=L.useRef(null),Y=L.useRef(null),G=xE(),{width:P,collapsed:K}=G,V=L.useRef(K),O=sE(),z=F_(),j=L.useRef(null),[W,Z]=L.useState(null),[ne,te]=L.useState(null),he=L.useRef(null),J=L.useRef([]),F=L.useRef([]),ae=L.useRef([]),fe=L.useRef([]),Ce=L.useRef(y),pe=L.useRef(N),[xe,Le]=L.useState(null),[Pe,Ue]=L.useState(null),[Ae,ye]=L.useState(!1),[Oe,xt]=L.useState(!1),Wn=yB(),Gn=n9(),{operationStatus:en}=hr();L.useLayoutEffect(()=>{!V.current&&K&&iE(B.current,".command-band-sidebar-toggle"),V.current=K},[K]);const pt=i.filter(de=>de.theaterId===t),tn=s.filter(de=>de.theaterId===t),zt=new Set(a),Ut=new Set(Wn),wt=l_(pt,O.operationOrder).map(de=>{const ot=EE(c,de),jt=ot?m(de.pluginId,ot):null;return{operation:de,active:d===de.id,minimized:zt.has(de.id),notificationCount:f[de.id]?1:0,status:en[de.id],icon:jt}}),Ln=kE(wt,tn,O.operationOrder),xn=Ln.some(de=>de.group!==null),fn=Ln.flatMap(de=>de.groupId?[de.groupId]:[]),ft=Ln.flatMap(de=>Ut.has(de.groupId??"")?[]:de.entries),wn=wt.map(de=>de.operation.id),At=L.useCallback(()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null)},[]),Dt=L.useCallback(()=>{At(),Z(null)},[At]),Yt=L.useCallback(de=>{At(),Z(de),j.current=window.setTimeout(()=>{j.current=null,Z(null)},h9)},[At]);L.useEffect(()=>At,[At]),L.useEffect(()=>{W!==null&&(wt.some(de=>de.operation.id===W)||Dt())},[W,wt,Dt]);const Mn=xe?.kind==="chip"?wt.find(de=>de.operation.id===xe.operationId)?.operation??null:null,Zn=xe?.kind==="group"?s.find(de=>de.id===xe.groupId)??null:null,Ii=xe?.kind==="theater"?e.find(de=>de.id===xe.theaterId)??null:null,vi=(de,ot)=>{const jt=ft.findIndex(It=>It.operation.id===de);if(jt===-1)return;const Xe=Math.max(0,Math.min(ft.length-1,jt+ot));if(Xe===jt)return;const Ee=ft.map(It=>It.operation.id),Ke=KB(Ee,de,Xe);ym(GB(wn,Ee,Ke))},Bi=Ln.map(de=>({groupId:de.groupId,entryIds:de.entries.map(ot=>ot.operation.id)}));L.useEffect(()=>{J.current=wt,F.current=wn,ae.current=Bi,fe.current=fn,Ce.current=y,pe.current=N});const Nn=de=>{he.current=de,te(de)},Ht=ne?.pointerId??null;L.useEffect(()=>{if(Ht===null)return;const de=Xe=>{if(Xe.pointerId!==Ht)return;const Ee=he.current;if(!Ee)return;if(Xe.buttons===0){Nn(null);return}const Ke=Math.hypot(Xe.clientX-Ee.startX,Xe.clientY-Ee.startY);if(!Ee.dragging&&Ke<d9)return;if(Ee.dragging&&Xe.preventDefault(),y9(Xe.clientY,Y.current),Ee.kind==="chip"){const On=$B(Xe.clientY,ae.current,Y.current,Ee.sourceId);Nn({...Ee,currentY:Xe.clientY,dragging:!0,dropIndex:On.index,dropGroupId:On.groupId});return}const It=FB(Xe.clientY,fe.current,Y.current,Ee.sourceGroupId);Nn({...Ee,currentY:Xe.clientY,dragging:!0,dropIndex:It})},ot=Xe=>{if(Xe.pointerId!==Ht)return;const Ee=he.current;if(Nn(null),!Ee?.dragging)return;if(Ee.kind==="group"){const Te=qB(fe.current,Ee.sourceGroupId,Ee.dropIndex);if(Te.join("\0")===fe.current.join("\0"))return;pe.current(Te);return}const{sourceId:Ke,sourceGroupId:It,dropIndex:On,dropGroupId:bi}=Ee,Jn=ae.current,yi=F.current;if(bi!==It){const nt=Jn.find(Qe=>Qe.groupId===bi)?.entryIds??[];ym(UB(yi,Ke,On,nt)),Ce.current(Ke,bi);return}const De=Jn.find(Te=>Te.groupId===It)?.entryIds??[],X=De.indexOf(Ke);if(X===-1||On===X)return;const _e=WB(yi,Ke,On,De);ym(_e)},jt=Xe=>{Xe.pointerId===Ht&&Nn(null)};return window.addEventListener("pointermove",de),window.addEventListener("pointerup",ot),window.addEventListener("pointercancel",jt),()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",ot),window.removeEventListener("pointercancel",jt)}},[Ht]);const ee=(de,ot)=>{if(de.button!==0||de.target instanceof Element&&de.target.closest("button"))return;Le(null),Dt();const Xe=wt.find(Ee=>Ee.operation.id===ot)?.operation.groupId??null;Nn({kind:"chip",sourceId:ot,sourceGroupId:Xe,pointerId:de.pointerId,startX:de.clientX,startY:de.clientY,currentY:de.clientY,dragging:!1,dropIndex:wn.indexOf(ot),dropGroupId:Xe})},ge=(de,ot)=>{de.button===0&&(de.target instanceof Element&&de.target.closest("button")||fn.includes(ot)&&(Le(null),Dt(),Nn({kind:"group",sourceGroupId:ot,pointerId:de.pointerId,startX:de.clientX,startY:de.clientY,currentY:de.clientY,dragging:!1,dropIndex:fn.indexOf(ot)})))},we=L.useCallback(de=>{de.preventDefault();const ot=de.clientX,jt=G.width;xt(!0);const Xe=Ke=>{const It=Ke.clientX-ot;i9(jt+It)},Ee=()=>{xt(!1),document.removeEventListener("pointermove",Xe),document.removeEventListener("pointerup",Ee),document.removeEventListener("pointercancel",Ee)};document.addEventListener("pointermove",Xe),document.addEventListener("pointerup",Ee),document.addEventListener("pointercancel",Ee)},[G.width]),He=()=>{Y_(!K)},Ct=()=>{Ue(null),Le(null),ye(!0)},mt=()=>{ye(!1),H()},Me=de=>{ye(!1),$(de)},Re=de=>{de.defaultPrevented||(de.preventDefault(),Le(null),Ue({anchor:{x:de.clientX,y:de.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},$e=L.useCallback(()=>{const de=xe?.kind==="theater"?xe.returnFocus:null;Le(null),de?.focus()},[xe]),$t=(de,ot)=>{de.stopPropagation(),ot!==t&&I(ot),Le(null);const jt=de.currentTarget.getBoundingClientRect();Ue({anchor:{x:jt.right+8,y:jt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},it=de=>{r9(de,!Gn.includes(de))};return l.jsxs("aside",{className:`operations-side-bar ${K?"is-closed":"is-expanded"}`,ref:B,"data-sidebar-state":K?"closed":"expanded","data-resizing":Oe?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${P}px`},inert:K,onContextMenu:Re,children:[l.jsxs("div",{className:"side-bar-theater-add-row",children:[l.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:Ct,disabled:p,"aria-label":"Add Theater",title:p?"Adding Theater":"Add Theater",children:[l.jsx(X_,{}),l.jsx("span",{children:"Add Theater"})]}),l.jsxs("div",{className:"side-bar-formation-group",role:"group","aria-label":"Formation view",children:[l.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>nd(),disabled:t===null,"aria-pressed":z,"aria-label":"Formation view (open panels only)",title:"Formation view (Alt+F)",children:l.jsx(m9,{})}),l.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>nd({restoreMinimized:!0}),disabled:t===null,"aria-pressed":z&&zt.size===0,"aria-label":"Formation view including minimized panels",title:"Formation view incl. minimized (Alt+Shift+F)",children:l.jsx(g9,{})})]})]}),!K&&g?l.jsx("p",{className:"side-bar-theater-error",children:g}):null,l.jsx("ol",{className:"operations-side-bar-chips",ref:Y,"aria-label":"Operations",children:e.map(de=>{const ot=de.id===t,jt=i.filter(Ee=>Ee.theaterId===de.id).length,Xe=Gn.includes(de.id);if(!ot){const Ee=_9({theaterId:de.id,operations:i,operationOrder:O.operationOrder,minimizedSet:zt,activeOperationId:null,operationNotifications:f,operationStatus:en,catalog:c,renderKindIcon:m});return l.jsx(v9,{theater:de,entries:Xe?[]:Ee,groups:s.filter(Ke=>Ke.theaterId===de.id),operationCount:jt,collapsed:Xe,onSelectTheater:I,onFocus:_,onToggleCollapsed:it,onOpenActions:(Ke,It)=>{Ue(null),Le({kind:"theater",theaterId:de.id,anchor:Ke,returnFocus:It})},onOpenLaunch:$t,onContextMenu:Ke=>{Ue(null),Le({kind:"theater",theaterId:de.id,anchor:Ke})}},de.id)}return l.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":de.id,children:[l.jsx(TE,{theater:de,operationCount:jt,active:!0,collapsed:Xe,onSelectTheater:I,onToggleCollapsed:it,onOpenActions:(Ee,Ke)=>{Ue(null),Le({kind:"theater",theaterId:de.id,anchor:Ee,returnFocus:Ke})},onOpenLaunch:$t,onContextMenu:Ee=>{Ue(null),Le({kind:"theater",theaterId:de.id,anchor:Ee})}}),Xe?null:l.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${de.label} operations`,children:Ln.map(Ee=>{const Ke=Ee.groupId!==null&&Ut.has(Ee.groupId),It=Ee.group?To(Ee.group.color):null,On=It?{"--grp-color":It}:void 0,bi=Ee.groupId?fn.indexOf(Ee.groupId):-1,Jn=ne?.kind==="group"&&ne.sourceGroupId===Ee.groupId&&ne.dragging,yi=ne?.kind==="group"&&ne.dragging&&Ee.groupId!==null&&ne.sourceGroupId!==Ee.groupId&&ne.dropIndex===bi,Si=ne?.kind==="group"&&ne.dragging&&Ee.groupId!==null&&ne.sourceGroupId!==Ee.groupId&&bi===fn.length-1&&ne.dropIndex===fn.length,De=[Ee.groupId?"side-bar-group-section":"side-bar-ungrouped-section",yi?"side-bar-group-section--drop-before":"",Si?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return l.jsxs("li",{"data-drop-zone-group-id":Ee.groupId??"__ungrouped__",className:De,style:On,children:[Ee.group?l.jsx(e9,{group:Ee.group,count:Ee.entries.length,collapsed:Ke,dragging:Jn,dragOffsetY:Jn?ne.currentY-ne.startY:0,dropTarget:yi,onToggle:bB,onContextMenu:(X,_e)=>Le({kind:"group",groupId:X,anchor:_e}),onPointerDragStart:ge}):xn&&Ee.entries.length>0?l.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:l.jsx("span",{children:"Ungrouped"})}):null,Ke?null:l.jsx("ol",{className:["side-bar-group-chips",ne?.kind==="chip"&&ne.dragging&&ne.dropGroupId===Ee.groupId&&ne.dropGroupId!==ne.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":Ee.groupId??"__ungrouped__","aria-label":Ee.group?Ee.group.name:"Ungrouped",children:Ee.entries.map(X=>{const _e=wt.indexOf(X),Te=Ee.entries.indexOf(X),nt=O.operationAccent[X.operation.id]??VS(X.operation),Qe=nt?To(nt):null;return l.jsx(vE,{entry:X,index:_e,isCloseArmed:W===X.operation.id,accentValue:Qe,dragging:ne?.kind==="chip"&&ne.sourceId===X.operation.id&&ne.dragging,dragOffsetY:ne?.kind==="chip"&&ne.sourceId===X.operation.id&&ne.dragging?ne.currentY-ne.startY:0,dropTarget:ne?.kind==="chip"&&ne.dragging===!0&&ne.dropGroupId===Ee.groupId&&ne.dropGroupId===ne.sourceGroupId&&ne.dropIndex===Te&&ne.sourceId!==X.operation.id,onArmClose:Yt,onDisarmClose:Dt,onClose:T,onMinimize:C,onFocus:_,onKeyboardMove:vi,onPointerDragStart:ee,onOpenAccent:(Bt,Xt)=>Le({kind:"chip",operationId:Bt,anchor:Xt}),onRename:v},X.operation.id)})})]},Ee.groupId??"__ungrouped__")})})]},de.id)})}),l.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:we,onDoubleClick:He,"aria-hidden":"true"}),Pe?js.createPortal(l.jsx(nE,{anchor:Pe.anchor,viewportBounds:Pe.viewportBounds,placement:"cursor",mode:"launch",catalog:c,canLaunch:h,renderKindIcon:m,onLaunchKind:(de,ot)=>{Ue(null),S(de,ot)},onResetView:w,onClose:()=>Ue(null)},`${Pe.anchor.x}:${Pe.anchor.y}`),document.body):null,xe?.kind==="chip"&&Mn?l.jsx(XS,{kind:"chip",operation:Mn,groups:s.filter(de=>de.theaterId===Mn.theaterId),accentKey:O.operationAccent[Mn.id]??VS(Mn),anchor:xe.anchor,actions:{onSetAccent:de=>b(Mn.id,de),onSetGroupId:de=>y(Mn.id,de),onCreateGroup:de=>k(Mn.theaterId,de,Mn.id)},onClose:()=>Le(null)}):xe?.kind==="group"&&Zn?l.jsx(XS,{kind:"group-header",group:Zn,anchor:xe.anchor,actions:{onSetColor:de=>M(Zn.id,de),onRename:de=>R(Zn.id,de),onUngroupAll:()=>A(Zn.id)},onClose:()=>Le(null)}):xe?.kind==="theater"&&Ii?l.jsx(b9,{theater:Ii,groupCount:s.filter(de=>de.theaterId===Ii.id).length,anchor:xe.anchor,onCreateGroup:de=>{k(Ii.id,de),$e()},onForgetTheater:()=>{q(Ii.id),$e()},onClose:$e}):null,l.jsx(rE,{open:Ae,onCancel:mt,onConfirm:Me}),K?null:l.jsx(cL,{})]})}function m9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function g9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"currentColor"})})}function kE(e,t,i){const s=[...t].sort((c,h)=>c.order-h.order||c.createdAt-h.createdAt),a=s.map(c=>({groupId:c.id,group:c,entries:[]})),d={groupId:null,group:null,entries:[]},f=new Map(s.map(c=>[c.id,c]));for(const c of e){const h=c.operation.groupId??null;h!==null&&f.has(h)?a.find(g=>g.groupId===h)?.entries.push(c):d.entries.push(c)}return[...a,d]}function _9({theaterId:e,operations:t,operationOrder:i,minimizedSet:s,activeOperationId:a,operationNotifications:d,operationStatus:f,catalog:c,renderKindIcon:h}){return l_(t.filter(p=>p.theaterId===e),i).map(p=>{const g=EE(c,p),m=g?h(p.pluginId,g):null;return{operation:p,active:a===p.id,minimized:s.has(p.id),notificationCount:d[p.id]?1:0,status:f[p.id],icon:m}})}function TE({theater:e,operationCount:t,active:i,collapsed:s,onSelectTheater:a,onToggleCollapsed:d,onOpenActions:f,onOpenLaunch:c,onContextMenu:h}){const p=m=>{m.preventDefault(),h(m.currentTarget.getBoundingClientRect())},g=m=>{m.target===m.currentTarget&&(m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),a(e.id)))};return l.jsxs("div",{role:"button",tabIndex:0,className:`side-bar-theater-header${i?" is-active":""}`,onClick:()=>a(e.id),onKeyDown:g,onContextMenu:p,"aria-current":i?"true":void 0,"aria-expanded":!s,title:e.label,children:[l.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:AE(e.label)}),l.jsx("span",{className:"side-bar-theater-name",children:e.label}),l.jsx("span",{className:"side-bar-theater-count",children:t}),l.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[l.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":s?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!s,title:s?"Expand":"Collapse",onClick:m=>{m.stopPropagation(),d(e.id)},children:l.jsx(S9,{collapsed:s})}),l.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:m=>{m.stopPropagation(),f(m.currentTarget.getBoundingClientRect(),m.currentTarget)},children:l.jsx(x9,{})}),l.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:m=>c(m,e.id),children:l.jsx(X_,{})})]})]})}function v9({theater:e,entries:t,groups:i,operationCount:s,collapsed:a,onSelectTheater:d,onFocus:f,onToggleCollapsed:c,onOpenActions:h,onOpenLaunch:p,onContextMenu:g}){const m=kE(t,i);let S=f9,w=0;const T=[];for(const C of m){if(C.entries.length===0)continue;const _=C.entries.slice(0,Math.max(0,S));w+=C.entries.length-_.length,S-=_.length,_.length>0&&T.push({...C,entries:_})}return l.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--peek","data-theater-id":e.id,children:[l.jsx(TE,{theater:e,operationCount:s,active:!1,collapsed:a,onSelectTheater:d,onToggleCollapsed:c,onOpenActions:h,onOpenLaunch:p,onContextMenu:g}),T.length>0?l.jsxs("ol",{className:"side-bar-peek-chips","aria-label":`${e.label} preview operations`,children:[T.map(C=>{const _=C.group?To(C.group.color):null;return l.jsxs("li",{className:C.groupId?"side-bar-group-section side-bar-group-section--peek":"side-bar-ungrouped-section",style:_?{"--grp-color":_}:void 0,children:[C.group?l.jsxs("div",{className:"side-bar-peek-group-label","aria-label":`Group ${C.group.name}`,children:[l.jsx("span",{children:C.group.name}),l.jsx("span",{className:"side-bar-peek-group-count",children:C.entries.length})]}):null,l.jsx("ol",{className:"side-bar-group-chips","aria-label":C.group?C.group.name:"Ungrouped",children:C.entries.map((b,v)=>l.jsx(vE,{entry:b,index:v,isCloseArmed:!1,accentValue:null,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:f,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},b.operation.id))})]},C.groupId??"__ungrouped__")}),w>0?l.jsxs("li",{className:"side-bar-peek-more",children:["+",w," more"]}):null]}):null]})}function b9({theater:e,groupCount:t,anchor:i,onCreateGroup:s,onForgetTheater:a,onClose:d}){const[f,c]=L.useState(!1),[h,p]=L.useState(`Group ${t+1}`),g=L.useRef(!1),m=L.useRef(null),S=L.useRef(null),[w,T]=L.useState(i.bottom+6);L.useLayoutEffect(()=>{const _=S.current?.getBoundingClientRect().height??0,b=window.innerHeight-_-8;T(Math.max(8,Math.min(i.bottom+6,b)))},[i,f]),L.useEffect(()=>{f&&m.current?.select()},[f]),L.useEffect(()=>{const _=b=>{b.key==="Escape"&&(b.preventDefault(),d())};return window.addEventListener("keydown",_),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("keydown",_),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[d]);const C=()=>{const _=h.trim();_&&s(_)};return js.createPortal(l.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:d,children:l.jsxs("div",{ref:S,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:i.left,top:w},onPointerDown:_=>_.stopPropagation(),children:[f?l.jsx("input",{ref:m,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:h,onChange:_=>p(_.target.value),onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:_=>{_.key==="Enter"&&!g.current&&(_.preventDefault(),C()),_.key==="Escape"&&(_.preventDefault(),c(!1))},onBlur:()=>c(!1),"aria-label":"New group name",placeholder:"Group name"}):l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>c(!0),children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:l.jsx(X_,{})}),l.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),l.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:a,children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:l.jsx(C9,{})}),l.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function y9(e,t){if(!t)return;const i=t.getBoundingClientRect();e<i.top+ox?t.scrollTop-=lx:e>i.bottom-ox&&(t.scrollTop+=lx)}function S9({collapsed:e}){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?l.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):l.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function x9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),l.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function X_(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function AE(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(s=>w9(s)):RE(e).filter(s=>/[\p{L}\p{N}]/u.test(s))).slice(0,2).join("").toUpperCase()||"--"}function w9(e){return RE(e).slice(0,1)}function RE(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function C9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),l.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"})]})}function E9({operationsViewVisible:e}){const t=hr(),i=Io(),s=xE(),a=Uw(),d=k9(),f=`${d}${d==="⌘"?"":"+"}B`,c=`${d}${d==="⌘"?"⌥":"+Alt+"}B`,h=t.theaters.find($=>$.id===t.activeTheaterId)??null,p=t.operations.find($=>$.id===t.activeOperationId)??null,g=p?i.plugins.find($=>$.id===p.pluginId):null,m=typeof p?.payload.cliId=="string"?p.payload.cliId:null,S=typeof p?.payload.cliLabel=="string"?p.payload.cliLabel:m,w=p?g?.operationKinds?.find($=>$.type===p.type)??null:null,T=p&&g?.renderLaunchIcon?g.renderLaunchIcon({id:m??p.type,type:p.type,title:w?.title??p.type}):null,C=Ww(),_=L.useRef(null),b=L.useRef(null),v=L.useRef(null),[y,k]=L.useState(!1),M=V_({currentTitle:p?.title??"",onCommit:$=>{const H=Xy(v.current,t.activeOperationId);v.current=null,H&&cw(H,$).then(()=>_i(null)).then(Ni).catch(()=>{})}});L.useEffect(()=>{!M.renaming||Xy(v.current,t.activeOperationId)||(v.current=null,M.cancel())},[M,t.activeOperationId]),L.useEffect(()=>{if(!y)return;const $=H=>{const q=H.target;!(q instanceof Node)||_.current?.contains(q)||b.current?.contains(q)||k(!1)};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[y]),L.useEffect(()=>{t3(y,C.isPathContextDeckOpen)&&k(!1)},[y,C.isPathContextDeckOpen]);const R=()=>{k(!1),_.current?.focus()},N=()=>{const $=!y;k($),bh(n3($,C.isPathContextDeckOpen))},A=$=>{h&&$w(h.id,H=>Nw(h.id,$,H))},I=()=>{p&&(v.current=p.id,M.begin())};return l.jsxs("header",{className:`command-band${e?" is-operations":" is-utility"}`,style:{"--command-band-left-width":`${s.width}px`},children:[l.jsxs("div",{className:`command-band-left${e&&s.collapsed?" is-collapsed":""}`,children:[l.jsx(uL,{className:"command-band-brand"}),e?l.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>Y_(!s.collapsed),"aria-label":`${s.collapsed?"Expand sidebar":"Collapse sidebar"} (${f})`,title:`${s.collapsed?"Expand sidebar":"Collapse sidebar"} (${f})`,children:l.jsx(cx,{side:"left"})}):null,l.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:Cw,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:l.jsx(T9,{})})]}),l.jsxs("div",{className:"command-band-center",children:[e&&h?l.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${h.label}`,children:[l.jsxs("span",{className:"command-band-theater-segment",children:[l.jsx("span",{className:"command-band-theater-mark",children:AE(h.label)}),h.label]}),p?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),M.renaming?l.jsx("input",{ref:M.inputRef,className:"command-band-rename-input",value:M.draftTitle,"aria-label":`${p.title} 이름 변경`,onChange:$=>M.setDraftTitle($.target.value),onKeyDown:M.handleKeyDown,onBlur:M.handleBlur}):l.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:I,title:"Double-click to rename",children:p.title}),S?l.jsxs("span",{className:"command-band-operation-attribute",title:w?.title??S,children:[T?l.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:T}):null,S]}):null]}):null]}):null,e&&h&&C.pathContextHydrated&&C.pathContext?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"command-band-context-separator","aria-hidden":"true"}),l.jsxs("div",{className:"command-band-context",children:[l.jsxs("button",{ref:_,type:"button",className:"command-band-context-trigger",onClick:N,"aria-expanded":y,"aria-haspopup":"dialog",title:C.pathContextError??"Path context — shared with the Activity Rail",children:[l.jsx(A9,{}),C.pathContext.label,l.jsx("span",{"aria-hidden":"true",children:"⌄"})]}),y?l.jsx(Bw,{ref:b,className:"command-band-context-deck",theaterId:h.id,theaterLabel:h.label,context:C.pathContext,isMutating:C.pathContextMutationInProgress,onSelect:A,onClose:R}):null]})]}):null]}),l.jsx("div",{className:"command-band-right",children:e?l.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:zw,"aria-label":`${a?"Collapse Activity Rail":"Expand Activity Rail"} (${c})`,title:`${a?"Collapse Activity Rail":"Expand Activity Rail"} (${c})`,children:l.jsx(cx,{side:"right"})}):null})]})}function k9(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function T9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function cx({side:e}){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function A9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M2.5 4.5a1 1 0 0 1 1-1h3l1.5 1.7h4.5a1 1 0 0 1 1 1v6.3a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}const R9=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function L9({state:e}){const[t,i]=L.useState(!1),s=L.useRef(null),a=L.useRef(null),d=L.useRef(null),f=e.theaters.length>0;if(L.useEffect(()=>{if(e.onboardingOpen)return s.current=document.activeElement,a.current?.focus(),()=>{const g=s.current;s.current=null,g?.focus?.()}},[e.onboardingOpen]),L.useEffect(()=>{if(!e.onboardingOpen)return;const g=m=>{t||(m.key==="Escape"?(m.preventDefault(),Nl()):m.key==="Tab"&&M9(m,d.current),m.stopImmediatePropagation())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const c=()=>{i(!0)},h=()=>{i(!1)},p=async g=>{i(!1),Sw();try{const m=await lw(g),S=await ow(m);xw(S)}catch(m){qm(m instanceof Error?m.message:String(m))}};return l.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[l.jsx("button",{type:"button",className:"commissioning-scrim",onClick:Nl,"aria-label":"Close setup guide"}),l.jsxs("section",{className:"commissioning-card",ref:d,children:[l.jsxs("header",{className:"commissioning-header",children:[l.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),l.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),l.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),l.jsxs("ol",{className:"commissioning-steps",children:[l.jsxs("li",{className:`commissioning-step commissioning-step--primary ${f?"is-complete":"is-current"}`,children:[l.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:f?"✓":"01"}),l.jsxs("div",{className:"commissioning-step-body",children:[l.jsx("h3",{children:"Register a Theater"}),l.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),f?l.jsx(dc,{ref:g=>{a.current=g},className:"commissioning-primary-action",to:"/operations",onClick:Nl,children:"Go to Operations →"}):l.jsx("button",{ref:g=>{a.current=g},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:c,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?l.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),l.jsxs("li",{className:"commissioning-step",children:[l.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),l.jsxs("div",{className:"commissioning-step-body",children:[l.jsx("h3",{children:"Open an Operation"}),l.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."}),l.jsx(dc,{className:"commissioning-secondary-link",to:"/operations",onClick:Nl,children:"Go to Operations"})]})]}),l.jsxs("li",{className:"commissioning-step",children:[l.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),l.jsxs("div",{className:"commissioning-step-body",children:[l.jsx("h3",{children:"Monitor Carriers"}),l.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),l.jsxs("footer",{className:"commissioning-footer",children:[l.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),l.jsx("button",{type:"button",className:"commissioning-skip",onClick:Nl,children:"Skip for now"})]})]}),l.jsx(rE,{open:t,onCancel:h,onConfirm:p})]})}function M9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(R9)),s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}const N9="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",ux="operation-search-listbox",LE="__unassigned__";function O9({state:e}){const t=Lc(),[i,s]=L.useState(""),[a,d]=L.useState(0),f=L.useRef(null),c=L.useRef(null),h=L.useRef(null),p=L.useRef(new Map),g=L.useMemo(()=>U3(e),[e]),m=L.useMemo(()=>s3(g,i),[g,i]),S=L.useMemo(()=>a3(m),[m]),w=L.useMemo(()=>dw(i),[i]),T=hx(a,m.length),C=m[T]?dx(m[T].operationId):void 0;if(L.useEffect(()=>{if(!e.operationSearchOpen)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const v=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>f.current?.focus(),0),()=>{document.body.style.overflow=v,h.current?.focus()}},[e.operationSearchOpen]),L.useEffect(()=>{if(!e.operationSearchOpen){s(""),d(0);return}d(0)},[e.operationSearchOpen,i]),L.useEffect(()=>{if(!e.operationSearchOpen)return;const v=m[T];v&&p.current.get(v.operationId)?.scrollIntoView({block:"nearest"})},[T,m,e.operationSearchOpen]),!e.operationSearchOpen)return null;const _=v=>{mc(v),t("/operations"),zp()},b=v=>{if(v.key==="Escape"){v.preventDefault(),zp();return}if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault(),d(y=>hx(y+(v.key==="ArrowDown"?1:-1),m.length));return}if(v.key==="Enter"){const y=m[T];if(!y)return;v.preventDefault(),_(y.operationId);return}v.key==="Tab"&&B9(v,c.current)};return l.jsx("div",{className:"operation-search-overlay",onMouseDown:v=>{v.target===v.currentTarget&&zp()},children:l.jsxs("section",{ref:c,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:b,children:[l.jsxs("div",{className:"operation-search-field",children:[l.jsx(P9,{}),l.jsx("input",{ref:f,id:"operation-search-input",type:"search",value:i,onChange:v=>s(v.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":ux,"aria-activedescendant":C,"aria-autocomplete":"list",spellCheck:!1}),l.jsx("kbd",{children:"esc"})]}),l.jsx("div",{id:ux,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:S.length>0?S.map(v=>{const y=j9(v.theaterId);return l.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":y,children:[l.jsx("h2",{id:y,className:"operation-search-section-heading",children:Sm(v.theaterLabel,w)}),v.entries.map(k=>{const M=m.indexOf(k),R=M===T;return l.jsxs("button",{id:dx(k.operationId),ref:N=>{N?p.current.set(k.operationId,N):p.current.delete(k.operationId)},type:"button",className:`operation-search-result ${R?"is-active":""}`,role:"option","aria-selected":R,onMouseEnter:()=>d(M),onClick:()=>_(k.operationId),children:[l.jsxs("span",{className:"operation-search-result-text",children:[l.jsx("strong",{children:Sm(k.operationName,w)}),l.jsx("small",{children:D9(k)})]}),l.jsx("span",{className:"operation-search-theater",children:Sm(k.theaterLabel,w)})]},k.operationId)})]},v.theaterId??LE)}):l.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function hx(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function D9(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function j9(e){return`operation-search-heading-${ME(e??LE)}`}function dx(e){return`operation-search-option-${ME(e)}`}function ME(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Sm(e,t){if(t.length===0)return e;const i=[];let s=0;for(;s<e.length;){const a=I9(e,t,s);if(!a){i.push(e.slice(s));break}a.start>s&&i.push(e.slice(s,a.start)),i.push(l.jsx("mark",{children:e.slice(a.start,a.end)},`${a.start}-${a.end}`)),s=a.end}return i}function I9(e,t,i){const s=e.toLocaleLowerCase();let a=null;for(const d of t){const f=s.indexOf(d,i);f!==-1&&(!a||f<a.start)&&(a={start:f,end:f+d.length})}return a}function B9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(N9)).filter(d=>d.offsetParent!==null);if(i.length===0)return;const s=i[0],a=i[i.length-1];if(e.shiftKey&&document.activeElement===s){e.preventDefault(),a?.focus();return}!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s?.focus())}function P9(){return l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:l.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 z9({open:e,title:t,message:i,tone:s="info",onDismiss:a}){return e?l.jsx("div",{className:"app-toast-host",children:l.jsxs("div",{className:`app-toast app-toast--${s}`,role:"status","aria-live":"polite",children:[l.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),l.jsxs("div",{className:"app-toast-body",children:[l.jsx("p",{className:"app-toast-title",children:t}),i?l.jsx("p",{className:"app-toast-message",children:i}):null]}),a?l.jsx("button",{type:"button",className:"app-toast-close",onClick:a,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function NE(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await OE(t),DE(await t.json(),t.status)}async function H9(e,t){const i=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await OE(i);const s=await i.json();if(!s||typeof s!="object"||!("state"in s))throw new dt(i.status,"Invalid global settings mutation response");return{state:DE(s.state,i.status)}}async function OE(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new dt(e.status,t)}function DE(e,t){const i=e;if(!i||i.consolePortMode!=="dynamic"&&i.consolePortMode!=="static"||i.consoleStaticPort!==null&&!$9(i.consoleStaticPort)||i.theme!=="instrument"&&i.theme!=="maritime"&&i.theme!=="carbon"||!F9(i.language))throw new dt(t,"Invalid global settings state response");return{consolePortMode:i.consolePortMode,consoleStaticPort:i.consoleStaticPort,theme:i.theme,uiFont:m3(i.uiFont),language:i.language}}function $9(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function F9(e){return e==="auto"||e==="en"||e==="ko"}const Pg=new Set;let Ec={loading:!1,state:null,savingField:null,error:null};function Z_(){return L.useSyncExternalStore(W9,id,id)}function id(){return Ec}function U9(e){pa({loading:!1,state:e,error:null})}function W9(e){return Pg.add(e),()=>{Pg.delete(e)}}async function G9(e){pa({loading:!0,error:null});try{const t=await NE(e);pa({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;pa({loading:!1,error:jE(t)})}}async function Lo(e,t){if(Ec.savingField!==null)return!1;const i=Ec.state,s=i?{...i,[e]:t}:null;pa({state:s,savingField:e,error:null});try{const a=await H9({[e]:t});return pa({state:a.state,savingField:null,error:null}),!0}catch(a){return pa({state:i,savingField:null,error:jE(a)}),!1}}function pa(e){Ec={...Ec,...e};for(const t of Pg)t()}function jE(e){return e instanceof Error?e.message:String(e)}let Co=null,tc=0;function IE(e){Co?.abort();const t=new AbortController,i=++tc;return Co=t,x3(),PR({...e,signal:t.signal}).then(s=>{i===tc&&w3(s)}).catch(s=>{t.signal.aborted||i!==tc||C3(s instanceof Error?s.message:String(s))}).finally(()=>{i===tc&&(Co=null)})}function q9(){Co!==null&&(Co.abort(),Co=null,tc+=1)}function BE(e,t=K9()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function K9(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const PE=[{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"}],xm={id:"overview",label:"Overview"},V9={id:"all-updates",label:"All updates"},Y9={id:"other-updates",label:"Other updates"};function zE(e){const t=e.sections.some(s=>s.items.some(a=>a.product===void 0)),i=PE.filter(s=>e.sections.some(a=>a.items.some(d=>d.product===s.id)));return i.length===0?[xm,V9]:t?[xm,...i,Y9]:[xm,...i]}function X9(e,t){return t==="overview"?[]:e.sections.map(i=>({...i,items:i.items.filter(s=>t==="all-updates"||t==="other-updates"?s.product===void 0:s.product===t)})).filter(i=>i.items.length>0)}function Z9(e){const t=PE.flatMap(s=>{const a=e.sections.flatMap(d=>d.items.filter(f=>f.product===s.id));return a.length===0?[]:[{id:s.id,label:s.label,count:a.length,summary:a[0].text}]}),i=e.sections.flatMap(s=>s.items.filter(a=>a.product===void 0));return i.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:i.length,summary:i[0].text}]}function J9(e,t){return zE(e).some(i=>i.id===t)}const Q9=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Gl=10;function eP({state:e}){const t=L.useRef(null),i=L.useRef([]),s=L.useRef(null),a=L.useRef(null),d=L.useRef(new Map),[f,c]=L.useState("overview"),h=Z_(),p=BE(h.state?.language??"auto"),g=e.selectedReleaseNoteKey??ro(e.releaseNotes[0]?.version??"",0),m=e.releaseNotes.findIndex((A,I)=>ro(A.version,I)===g),S=e.releaseNotes[m]??e.releaseNotes[0],w=S?ro(S.version,m>=0?m:0):"",T=S?zE(S):[];L.useEffect(()=>{c("overview")},[w]),L.useEffect(()=>{S&&!J9(S,f)&&c("overview")},[f,S]),L.useEffect(()=>{const A=I=>{const $=I.target instanceof HTMLElement?I.target:null;if(!$||$.closest(".whatsnew-card"))return;const H=i.current.filter(q=>q!==$&&q.isConnected);i.current=[...H.slice(-4),$]};return document.addEventListener("focusin",A,!0),()=>document.removeEventListener("focusin",A,!0)},[]);const C=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!C&&t.current===null&&(t.current=document.activeElement),L.useEffect(()=>{if(!e.whatsNewOpen||C)return;const A=I=>{I.key==="Escape"?(I.preventDefault(),Ku()):rP(I,a.current,c)?I.preventDefault():I.key==="Tab"&&iP(I,a.current),I.stopImmediatePropagation()};return s.current?.focus(),window.addEventListener("keydown",A,!0),()=>{window.removeEventListener("keydown",A,!0);const I=t.current?.isConnected?t.current:[...i.current].reverse().find($=>$.isConnected);t.current=null,I?.focus?.()}},[e.whatsNewOpen,C]),!e.whatsNewOpen||C||S===void 0)return null;const _=()=>{IE({force:!0,locale:p})},b=async A=>{await Lo("language",A)},v=Math.max(1,Math.ceil(e.releaseNotes.length/Gl)),y=Math.min(v-1,Math.floor((m>=0?m:0)/Gl)),k=y*Gl,M=e.releaseNotes.slice(k,k+Gl),R=A=>{const I=y+A;if(I<0||I>=v)return;const $=I*Gl,H=e.releaseNotes[$];H&&Qy(ro(H.version,$))},N=A=>{c(A),requestAnimationFrame(()=>d.current.get(A)?.focus())};return l.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[l.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Ku,"aria-label":"Close What's new"}),l.jsxs("section",{className:"whatsnew-card",ref:a,children:[l.jsxs("header",{className:"whatsnew-header",children:[l.jsxs("div",{className:"whatsnew-heading-row",children:[l.jsx("h2",{id:"whatsnew-title",children:"What's new"}),l.jsxs("span",{className:"whatsnew-version-badge",children:["v",S.version]})]}),l.jsxs("div",{className:"whatsnew-meta-row",children:[S.date?l.jsxs("time",{className:"whatsnew-date",dateTime:S.date,children:["Released ",S.date]}):l.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?l.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),l.jsx("button",{ref:s,type:"button",className:"whatsnew-close",onClick:Ku,"aria-label":"Close What's new",children:"x"}),l.jsxs("div",{className:"whatsnew-body",children:[l.jsxs("div",{className:"whatsnew-version-selector",children:[l.jsx("select",{"aria-label":"Release version",value:w,onChange:A=>Qy(A.currentTarget.value),children:M.map((A,I)=>{const $=k+I;return l.jsxs("option",{value:ro(A.version,$),children:[A.version==="Unreleased"?"Unreleased":`v${A.version}`,A.date?` · ${A.date}`:""]},ro(A.version,$))})}),v>1?l.jsxs("div",{className:"whatsnew-pagination",children:[l.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>R(-1),disabled:y===0,"aria-label":"Newer versions",children:"‹"}),l.jsxs("span",{className:"whatsnew-page-status",children:[y+1," / ",v]}),l.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>R(1),disabled:y>=v-1,"aria-label":"Older versions",children:"›"})]}):null,l.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(A=>l.jsx("button",{type:"button",className:p===A?"is-active":"","aria-pressed":p===A,disabled:h.savingField==="language",onClick:()=>{b(A)},children:A==="en"?"EN":"한국어"},A))}),l.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:_,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),l.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:T.map(A=>l.jsx("button",{ref:I=>{I?d.current.set(A.id,I):d.current.delete(A.id)},id:`whatsnew-tab-${A.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":A.id,"aria-selected":f===A.id,"aria-controls":"whatsnew-tab-panel",tabIndex:f===A.id?0:-1,onClick:()=>c(A.id),children:A.label},A.id))}),e.releaseNotesError?l.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,l.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${f}`,children:f==="overview"?l.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:Z9(S).map(A=>l.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>N(A.id),children:[l.jsx("span",{className:"whatsnew-overview-label",children:A.label}),l.jsxs("span",{className:"whatsnew-overview-count",children:[A.count," ",A.count===1?"update":"updates"]}),l.jsx("span",{className:"whatsnew-overview-summary",children:A.summary})]},A.id))}):X9(S,f).map((A,I)=>l.jsx(tP,{section:A,index:I},A.heading))})]}),l.jsx("footer",{className:"whatsnew-footer",children:l.jsx("button",{type:"button",className:"whatsnew-done",onClick:Ku,children:"Close"})})]})]})}function tP({section:e,index:t}){const i=e.heading.toLowerCase().replaceAll(" ","-"),s={"--whatsnew-delay":`${t*55}ms`};return l.jsxs("section",{className:`whatsnew-section whatsnew-section--${i}`,style:s,children:[l.jsx("h3",{children:l.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),l.jsx("ul",{children:e.items.map((a,d)=>l.jsx("li",{children:l.jsx(nP,{item:a})},`${a.text}:${d}`))})]})}function nP({item:e}){return l.jsxs(l.Fragment,{children:[e.packageTags.map((t,i)=>l.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${i}`)),l.jsx("span",{children:e.text})]})}function ro(e,t){return`${e}:${t}`}function iP(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(Q9)),s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}function rP(e,t,i){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const s=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!s||!t)return!1;const a=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),d=a.indexOf(s);if(d<0||a.length===0)return!1;const f=e.key==="Home"?0:e.key==="End"?a.length-1:(d+(e.key==="ArrowRight"?1:-1)+a.length)%a.length,c=a[f],h=c.dataset.tabId;return h?(i(h),c.focus(),!0):!1}function Cd(e=()=>{}){return{...Hx(e),notifications:{emit:i=>D3(i),dismiss:i=>z3(i)},status:{set:(i,s)=>O3(i,s),clear:i=>yw(i)}}}const sP=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function HE(e){const t=await fetch("/api/v1/settings/carriers",{signal:e});return await Q_(t),$E(await t.json(),t.status)}async function aP(e){const t=await fetch("/api/v1/settings/carriers/options",{signal:e});return await Q_(t),cP(await t.json(),t.status)}async function wm(e,t,i){return J_(`/api/v1/settings/carriers/${encodeURIComponent(e)}`,"PATCH",t,i)}async function oP(e,t,i,s){return J_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",i,s)}async function lP(e,t,i){return J_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},i)}async function J_(e,t,i,s){const a=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:s});await Q_(a);const d=await a.json();if(!d||typeof d!="object"||!("state"in d))throw new dt(a.status,"Invalid carrier settings mutation response");return{state:$E(d.state,a.status)}}async function Q_(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new dt(e.status,t)}function $E(e,t){FE(e,t);const i=e;if(!i||typeof i.generation!="number"||!Array.isArray(i.carriers))throw new dt(t,"Invalid carrier settings state response");return{generation:i.generation,carriers:i.carriers.map(s=>uP(s,t))}}function cP(e,t){FE(e,t);const i=e;if(!i||!Array.isArray(i.cliTypes)||!i.taskForceConstraints||typeof i.taskForceConstraints.minBackends!="number")throw new dt(t,"Invalid carrier settings options response");return{cliTypes:i.cliTypes.map(s=>hP(s,t)),taskForceConstraints:{minBackends:i.taskForceConstraints.minBackends}}}function uP(e,t){const i=e;if(!i||typeof i.carrierId!="string"||typeof i.displayName!="string"||typeof i.sourceDisplayName!="string"||typeof i.role!="string"||typeof i.roleDescription!="string"||typeof i.slot!="number"||typeof i.cliType!="string"||typeof i.defaultCliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string"||typeof i.taskForceBackendCount!="number"||!i.taskforce||!Array.isArray(i.taskforce.backends))throw new dt(t,"Invalid carrier settings carrier response");return{carrierId:i.carrierId,displayName:i.displayName,sourceDisplayName:i.sourceDisplayName,role:i.role,roleDescription:i.roleDescription,...i.category?{category:i.category}:{},slot:i.slot,cliType:i.cliType,defaultCliType:i.defaultCliType,model:i.model,...i.effort?{effort:i.effort}:{},taskForceBackendCount:i.taskForceBackendCount,taskforce:{backends:i.taskforce.backends.map(s=>fP(s,t))}}}function hP(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.displayName!="string"||!Array.isArray(i.models)||typeof i.defaultModel!="string")throw new dt(t,"Invalid carrier settings CLI option");return{id:i.id,displayName:i.displayName,models:i.models.map(s=>dP(s,t)),defaultModel:i.defaultModel}}function dP(e,t){const i=e;if(!i||typeof i.modelId!="string"||typeof i.name!="string")throw new dt(t,"Invalid carrier settings model option");if(i.effort!==void 0&&(!Array.isArray(i.effort.levels)||typeof i.effort.default!="string"))throw new dt(t,"Invalid carrier settings effort option");return{modelId:i.modelId,name:i.name,...i.effort?{effort:{levels:i.effort.levels.filter(s=>typeof s=="string"),default:i.effort.default}}:{}}}function fP(e,t){const i=e;if(!i||typeof i.cliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string")throw new dt(t,"Invalid carrier settings Task Force backend");return{cliType:i.cliType,model:i.model,...i.effort?{effort:i.effort}:{}}}function FE(e,t){const i=[e];for(;i.length>0;){const s=i.pop();if(!(!s||typeof s!="object"))for(const[a,d]of Object.entries(s)){if(sP.has(a))throw new dt(t,"Carrier settings response leaked a restricted field");d&&typeof d=="object"&&i.push(d)}}}const pP={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},zg=new Set;let Un={loading:!1,state:null,options:null,activeCarrierId:null,draft:pP,savingActionId:null,error:null};function UE(){return L.useSyncExternalStore(mP,fx,fx)}function fx(){return Un}function mP(e){return zg.add(e),()=>{zg.delete(e)}}async function px(e){br({loading:!0,error:null});try{const[t,i]=await Promise.all([HE(e),aP(e)]);WE(t,i)}catch(t){if(e?.aborted)return;br({loading:!1,error:qE(t)})}}function gP(e){const t=Un.state?.carriers.find(i=>i.carrierId===e);br({activeCarrierId:e,draft:t?ev(t,Un.options):Un.draft,error:null})}function go(e){br({draft:{...Un.draft,...e},error:null})}function Hg(e,t){const i=Un.draft.taskforce[e]??{model:"",effort:""};br({draft:{...Un.draft,taskforce:{...Un.draft.taskforce,[e]:{...i,...t}}},error:null})}function _P(){const e=GE();e&&br({draft:ev(e,Un.options),error:null})}async function vP(e){const t=GE();return t?bP("save-all",async()=>{const i=Un.draft;let s=null;i.displayName!==t.displayName&&(s=(await wm(t.carrierId,{displayName:i.displayName})).state);const a=i.cliType!==t.cliType;return a&&(s=(await wm(t.carrierId,{cli:i.cliType})).state),(a||i.model!==t.model||(i.effort||"")!==(t.effort||""))&&(s=(await wm(t.carrierId,{model:SP(i)})).state),s=await xP(t,e,s),{state:s??await HE()}}):!1}function WE(e,t){const i=wP(e,Un.activeCarrierId),s=e.carriers.find(a=>a.carrierId===i)??null;br({loading:!1,state:e,options:t,activeCarrierId:i,draft:s?ev(s,t):Un.draft,error:null})}async function bP(e,t){br({savingActionId:e,error:null});try{const i=await t();return WE(i.state,Un.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),br({savingActionId:null}),!0}catch(i){return br({savingActionId:null,error:qE(i)}),!1}}function ev(e,t){const i=Object.fromEntries((t?.cliTypes??[]).map(s=>{const a=e.taskforce.backends.find(d=>d.cliType===s.id);return[s.id,{model:a?.model??s.defaultModel,effort:a?.effort??yP(s.id,a?.model??s.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:i}}function yP(e,t,i){return i?.cliTypes.find(d=>d.id===e)?.models.find(d=>d.modelId===t)?.effort?.default??null}function SP(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function GE(){return Un.state?.carriers.find(e=>e.carrierId===Un.activeCarrierId)??null}async function xP(e,t,i){const s=new Set(t.map(a=>a.cliType));for(const a of e.taskforce.backends)s.has(a.cliType)||(i=(await lP(e.carrierId,a.cliType)).state);for(const a of t){const d=e.taskforce.backends.find(f=>f.cliType===a.cliType);d&&d.model===a.model&&(d.effort||"")===(a.effort||"")||(i=(await oP(e.carrierId,a.cliType,{model:a.model,...a.effort?{effort:a.effort}:{}})).state)}return i}function wP(e,t){return t&&e.carriers.some(i=>i.carrierId===t)?t:e.carriers[0]?.carrierId??null}function br(e){Un={...Un,...e};for(const t of zg)t()}function qE(e){return e instanceof Error?e.message:String(e)}const CP=50,EP=2400,kP={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)"};function TP(){const e=UE(),t=e.state?.carriers.find(C=>C.carrierId===e.activeCarrierId)??null,i=e.options?.cliTypes.find(C=>C.id===e.draft.cliType)??null,s=i?.models.find(C=>C.modelId===e.draft.model)??null,[a,d]=L.useState(!1),[f,c]=L.useState([]),[h,p]=L.useState("idle"),g=e.savingActionId==="save-all",m=t?OP(t,e.draft,f):!1,S=t?.taskforce.backends.map(C=>`${C.cliType}:${C.model}:${C.effort??""}`).join("|")??"";L.useEffect(()=>{const C=new AbortController;return px(C.signal),()=>C.abort()},[]),L.useEffect(()=>{d(!1),c(t?.taskforce.backends.map(C=>C.cliType)??[]),p("idle")},[t?.carrierId,S]),L.useEffect(()=>{if(h!=="saved")return;const C=window.setTimeout(()=>p("idle"),EP);return()=>window.clearTimeout(C)},[h]);function w(){t&&(_P(),c(t.taskforce.backends.map(C=>C.cliType)),d(!1),p("idle"))}async function T(){if(!t)return;if(p("saving"),!await vP(jP(f,e.draft.taskforce))){p("idle");return}d(!1),p("saved")}return l.jsxs("main",{className:"carrier-settings-page",children:[l.jsxs("section",{className:"carrier-settings-hero","aria-labelledby":"carrier-settings-title",children:[l.jsxs("div",{children:[l.jsx("p",{className:"bridge-kicker",children:"Configure Carrier settings"}),l.jsx("h2",{id:"carrier-settings-title",children:"Carrier Settings"})]}),l.jsxs("div",{className:"carrier-settings-hero-actions",children:[l.jsx("div",{className:`carrier-settings-save-status ${h==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:h==="saving"||g?"Saving…":h==="saved"?"Saved ✓":""}),t?l.jsxs("div",{className:"carrier-settings-save-actions",children:[l.jsx("button",{type:"button",className:`carrier-settings-action-button ${m?"is-dirty":""}`,disabled:!m||g,onClick:()=>{T()},children:"Save"}),l.jsx("button",{type:"button",className:`carrier-settings-action-button ${m?"is-dirty":""}`,disabled:!m||g,onClick:w,children:"Discard"})]}):null,l.jsx("button",{type:"button",className:"carrier-settings-action-button carrier-settings-hero-refresh",disabled:e.loading,onClick:()=>{px()},children:"Refresh"})]})]}),e.error?l.jsx("p",{className:"carrier-settings-error",role:"alert",children:e.error}):null,l.jsxs("section",{className:"carrier-settings-grid",children:[l.jsxs("div",{className:"carrier-settings-list","aria-label":"Carrier list",children:[e.loading&&!e.state?l.jsx("p",{className:"carrier-settings-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?l.jsx("p",{className:"carrier-settings-empty",children:"No carriers registered."}):null,e.state?.carriers.map(C=>l.jsx(AP,{carrier:C,active:C.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>gP(C.carrierId)},C.carrierId))]}),t&&e.options&&i?l.jsxs("div",{className:"carrier-settings-detail",style:YE(t.carrierId),children:[l.jsxs("div",{className:"carrier-settings-detail-head",children:[l.jsxs("div",{className:"carrier-settings-detail-title-block",children:[l.jsxs("div",{className:"carrier-settings-captain-id",children:[l.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),l.jsx("div",{className:`carrier-settings-name-line ${a?"is-editing":""}`,children:a?l.jsxs(l.Fragment,{children:[l.jsx("input",{id:"carrier-display-name",className:"carrier-settings-input carrier-settings-name-input",value:e.draft.displayName,maxLength:CP,onChange:C=>go({displayName:C.target.value})}),l.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Save display name",disabled:g,onClick:()=>{d(!1)},children:l.jsx(BP,{})}),l.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Cancel display name edit",onClick:()=>{go({displayName:t.displayName}),d(!1)},children:l.jsx(PP,{})})]}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"carrier-settings-captain-name",children:t.displayName}),l.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Edit display name",onClick:()=>{go({displayName:t.displayName}),d(!0)},children:l.jsx(IP,{})})]})}),l.jsx("div",{className:"carrier-settings-captain-role",children:t.role})]}),l.jsxs("div",{className:"carrier-settings-cli-badge",children:[l.jsx("span",{className:"ind","aria-hidden":"true"}),t.cliType]})]}),l.jsxs("div",{className:"carrier-settings-body",children:[l.jsxs("div",{className:"carrier-settings-control-group",children:[l.jsx("div",{className:"carrier-settings-resp-title",children:"Identity"}),l.jsx("div",{className:"carrier-settings-mission",children:t.roleDescription})]}),l.jsxs("div",{className:"carrier-settings-control-group",children:[l.jsx("div",{className:"carrier-settings-resp-title",children:"Runtime"}),l.jsxs("div",{className:"carrier-settings-runtime",children:[l.jsx("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--cli",children:l.jsxs("div",{className:"carrier-settings-field carrier-settings-field--wide",children:[l.jsx("label",{className:"carrier-settings-label",htmlFor:"carrier-cli",children:"CLI"}),l.jsx("select",{id:"carrier-cli",className:"carrier-settings-select",value:e.draft.cliType,onChange:C=>LP(C.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(C=>l.jsx("option",{value:C.id,children:C.displayName},C.id))})]})}),l.jsxs("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--model",children:[l.jsx(KE,{id:"carrier-model",label:"Model",models:i.models,value:e.draft.model,onChange:C=>MP(i,C)}),l.jsx(VE,{id:"carrier-effort",model:s,value:e.draft.effort,onChange:C=>go({effort:C})})]})]})]}),l.jsx(RP,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:f,onRowsChange:c})]})]},t.carrierId):l.jsx("div",{className:"carrier-settings-detail",children:l.jsx("p",{className:"carrier-settings-empty",children:"Select a carrier."})})]})]})}function AP({carrier:e,active:t,minBackends:i,onSelect:s}){const a=e.taskForceBackendCount>=i;return l.jsxs("button",{type:"button",className:`carrier-settings-row ${t?"is-active":""}`,style:YE(e.carrierId),onClick:s,children:[l.jsx("span",{className:"carrier-settings-captain-dot","aria-hidden":"true"}),l.jsxs("span",{className:"carrier-settings-row-text",children:[l.jsx("span",{className:"carrier-settings-row-name",children:e.displayName}),l.jsx("span",{className:"carrier-settings-row-role",children:e.role})]}),l.jsx("span",{className:"carrier-settings-row-live","aria-hidden":"true",children:l.jsx("span",{className:`carrier-settings-live-dot ${a?"is-live":""}`})})]})}function KE({id:e,label:t,models:i,value:s,disabled:a=!1,onChange:d}){return l.jsxs("div",{className:"carrier-settings-field",children:[l.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:t}),l.jsx("select",{id:e,className:"carrier-settings-select",value:s,disabled:a,onChange:f=>d(f.target.value),children:i.map(f=>l.jsx("option",{value:f.modelId,children:f.name},f.modelId))})]})}function VE({id:e,model:t,value:i,disabled:s=!1,onChange:a}){return t?.effort?l.jsxs("div",{className:"carrier-settings-field",children:[l.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:"Effort"}),l.jsx("select",{id:e,className:"carrier-settings-select",value:i||t.effort.default,disabled:s,onChange:d=>a(d.target.value),children:t.effort.levels.map(d=>l.jsx("option",{value:d,children:d},d))})]}):l.jsxs("div",{className:"carrier-settings-field",children:[l.jsx("span",{className:"carrier-settings-label",children:"Effort"}),l.jsx("p",{className:"carrier-settings-help",children:"Not supported for this model."})]})}function RP({carrier:e,cliOptions:t,minBackends:i,savingActionId:s,rows:a,onRowsChange:d}){const f=UE(),c=e.taskforce.backends.length,[h,p]=L.useState(c>0),[g,m]=L.useState(!1),[S,w]=L.useState(""),T=e.taskForceBackendCount>=i,C=t.filter(b=>!a.includes(b.id)),_=S||C[0]?.id||"";return l.jsxs("div",{className:`carrier-settings-control-group carrier-settings-control-group--taskforce ${h?"is-expanded":""}`,children:[l.jsxs("div",{className:"carrier-settings-section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"carrier-settings-resp-title",children:"Task Force"}),l.jsx("p",{className:"carrier-settings-help",children:c>0?`${c} backend${c===1?"":"s"} configured${T?" · active":` · needs ${i}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${i} to activate.`})]}),l.jsx("div",{className:"carrier-settings-tf-head-actions",children:l.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":h,onClick:()=>p(b=>!b),children:h?"Hide":"Configure"})})]}),h?l.jsxs("div",{className:"carrier-settings-tf-list",children:[a.length===0?l.jsx("p",{className:"carrier-settings-tf-empty",children:"No Task Force backend drafted."}):null,a.map(b=>{const v=t.find(R=>R.id===b);if(!v)return null;const y=f.draft.taskforce[v.id]??{model:v.defaultModel,effort:""},k=v.models.find(R=>R.modelId===y.model)??v.models[0]??null,M=e.taskforce.backends.some(R=>R.cliType===v.id);return l.jsxs("div",{className:`carrier-settings-tf-item ${M?"is-active":""}`,children:[l.jsxs("div",{className:"carrier-settings-tf-title",children:[l.jsx("span",{className:`carrier-settings-live-dot ${M?"is-live":""}`,"aria-hidden":"true"}),l.jsx("strong",{children:v.displayName})]}),l.jsx(KE,{id:`tf-${v.id}-model`,label:"Model",models:v.models,value:y.model,onChange:R=>NP(v,R)}),l.jsx(VE,{id:`tf-${v.id}-effort`,model:k,value:y.effort,onChange:R=>Hg(v.id,{effort:R})}),l.jsx("div",{className:"carrier-settings-tf-actions",children:l.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:s==="save-all",onClick:()=>d(a.filter(R=>R!==v.id)),children:"Remove"})})]},v.id)}),l.jsxs("div",{className:"carrier-settings-tf-add-row",children:[g&&C.length>0?l.jsx("select",{className:"carrier-settings-select carrier-settings-tf-add-select",value:_,onChange:b=>w(b.target.value),"aria-label":"Task Force CLI to add",children:C.map(b=>l.jsx("option",{value:b.id,children:b.displayName},b.id))}):null,l.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:C.length===0||s==="save-all",onClick:()=>{if(!g){m(!0);return}const b=_,v=t.find(k=>k.id===b),y=v?.models.find(k=>k.modelId===v.defaultModel)??v?.models[0]??null;!v||!y||(Hg(v.id,{model:y.modelId,effort:y.effort?.default??""}),d(a.includes(v.id)?a:[...a,v.id]),w(""),m(!1))},children:"Add"})]})]}):null]})}function LP(e,t){const i=t.find(a=>a.id===e),s=i?.models.find(a=>a.modelId===i.defaultModel)??i?.models[0]??null;go({cliType:e,model:s?.modelId??"",effort:s?.effort?.default??""})}function MP(e,t){const i=e.models.find(s=>s.modelId===t);go({model:t,effort:i?.effort?.default??""})}function NP(e,t){const i=e.models.find(s=>s.modelId===t);Hg(e.id,{model:t,effort:i?.effort?.default??""})}function OP(e,t,i){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:DP(e,i,t.taskforce)}function DP(e,t,i){if(t.length!==e.taskforce.backends.length)return!0;const s=new Set(t);for(const a of e.taskforce.backends){if(!s.has(a.cliType))return!0;const d=i[a.cliType];if(!d||d.model!==a.model||(d.effort||"")!==(a.effort||""))return!0}return!1}function jP(e,t){return e.map(i=>{const s=t[i];return s?{cliType:i,model:s.model,...s.effort?{effort:s.effort}:{}}:null}).filter(i=>i!==null)}function YE(e){return{"--cap-color":kP[e]??"var(--brass)"}}function IP(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.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"}),l.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function BP(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function PP(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),l.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}async function zP(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await HP(t),$P(await t.json(),t.status).routes}async function HP(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new dt(e.status,t)}function $P(e,t){const i=e;if(!i||typeof i!="object"||!("version"in i)||!Array.isArray(i.routes))throw new dt(t,"Invalid backend API catalog response");return{routes:i.routes.map(s=>FP(s,t))}}function FP(e,t){const i=e;if(!i||typeof i!="object"||typeof i.method!="string"||typeof i.path!="string"||typeof i.summary!="string"||typeof i.category!="string"||typeof i.gate!="string")throw new dt(t,"Invalid backend API catalog entry");return{method:i.method,path:i.path,summary:i.summary,category:i.category,gate:i.gate}}const $g=new Set;let Fg={loading:!1,state:null,error:null};function UP(){return L.useSyncExternalStore(WP,mx,mx)}function mx(){return Fg}function WP(e){return $g.add(e),()=>{$g.delete(e)}}async function GP(e){Cm({loading:!0,error:null});try{const t=await zP(e);Cm({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Cm({loading:!1,error:qP(t)})}}function Cm(e){Fg={...Fg,...e};for(const t of $g)t()}function qP(e){return e instanceof Error?e.message:String(e)}function KP(){const e=UP(),[t,i]=L.useState(!0),s=L.useMemo(()=>XP(e.state??[]),[e.state]),a=e.state?.length??0,d=s.length;return L.useEffect(()=>{const f=new AbortController;return GP(f.signal),()=>f.abort()},[]),l.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[l.jsx("div",{className:`backend-api-control carrier-settings-control-group--taskforce ${t?"is-expanded":""}`,children:l.jsxs("div",{className:"carrier-settings-section-head",children:[l.jsxs("div",{className:"backend-api-head",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),l.jsx("p",{className:"global-settings-help",children:a>0?`${a} loopback route${a===1?"":"s"} across ${d} categor${d===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),l.jsx("div",{className:"carrier-settings-tf-head-actions",children:l.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":t,onClick:()=>i(f=>!f),children:t?"Hide":"Show"})})]})}),e.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?l.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?l.jsxs("div",{className:"backend-api-groups",children:[s.length>0?s.map(f=>l.jsx(VP,{group:f},f.category)):null,e.state&&s.length===0?l.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,l.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 VP({group:e}){return l.jsxs("div",{className:"backend-api-group",children:[l.jsxs("div",{className:"backend-api-group-head",children:[l.jsx("span",{children:e.category}),l.jsx("span",{children:e.entries.length})]}),l.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>l.jsx(YP,{entry:t},`${t.method}:${t.path}`))})]})}function YP({entry:e}){return l.jsxs("div",{className:"backend-api-row",children:[l.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),l.jsx("code",{className:"backend-api-path",children:e.path}),l.jsx("span",{className:"backend-api-summary",children:e.summary}),l.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function XP(e){const t=new Map;for(const i of e){const s=i.category.trim()||"Uncategorized",a=t.get(s);a?a.push(i):t.set(s,[i])}return Array.from(t.entries()).map(([i,s])=>({category:i,entries:s}))}const ZP=[{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)"]}],JP=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],QP=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],ez=1024,tz=65535,nz=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function iz(){const e=Z_(),t=e.state,i=e.savingField!==null,[s,a]=L.useState("general"),d=Io(),f=sz(d.plugins),c=az(f);return L.useEffect(()=>{const h=new AbortController;return G9(h.signal),()=>h.abort()},[]),l.jsxs("main",{className:"global-settings-page",children:[l.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[l.jsxs("div",{children:[l.jsx("p",{className:"bridge-kicker",children:"Console"}),l.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),l.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:i?"Saving…":""})]}),e.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,l.jsxs("section",{className:"global-settings-grid",children:[l.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[l.jsx("p",{className:"global-settings-nav-group",children:"Console"}),nz.map(h=>l.jsxs("button",{type:"button",className:`global-settings-nav-item ${h.id===s?"is-active":""}`,"aria-pressed":h.id===s,onClick:()=>a(h.id),children:[l.jsx("span",{className:"global-settings-nav-label",children:h.label}),l.jsx("span",{className:"global-settings-nav-eyebrow",children:h.eyebrow})]},h.id)),f.length>0?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),c.map(h=>l.jsxs("div",{className:"global-settings-plugin-group",children:[l.jsx("p",{className:"global-settings-plugin-heading",children:h.pluginLabel}),h.sections.map(p=>l.jsxs("button",{type:"button",className:`global-settings-nav-item ${p.id===s?"is-active":""}`,"aria-pressed":p.id===s,onClick:()=>a(p.id),children:[l.jsx("span",{className:"global-settings-nav-label",children:p.sectionTitle}),l.jsx("span",{className:"global-settings-nav-eyebrow",children:p.pluginLabel})]},p.id))]},h.pluginId))]}):null]}),l.jsx("div",{className:"global-settings-detail",children:rz(s,t,i,f)},s)]})]})}function rz(e,t,i,s){if(e.includes(":")){const a=s.find(d=>d.id===e);return a?.render?l.jsx(Jg,{fallback:l.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:a.render()}):l.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return l.jsxs(l.Fragment,{children:[l.jsx(lz,{state:t,saving:i}),l.jsx(cz,{state:t,saving:i}),l.jsx(uz,{state:t,saving:i})]});case"backend-api":return l.jsx(KP,{})}}function sz(e){return e.flatMap(t=>(t.settingsSections??[]).map(i=>({id:`${t.id}:${i.id}`,pluginId:t.id,pluginLabel:oz(t.id),sectionTitle:i.title,render:i.render})))}function az(e){const t=[];for(const i of e){const s=t.at(-1);if(s?.pluginId===i.pluginId){t[t.length-1]={...s,sections:[...s.sections,i]};continue}t.push({pluginId:i.pluginId,pluginLabel:i.pluginLabel,sections:[i]})}return t}function oz(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function lz({state:e,saving:t}){const i=e?.theme??"instrument",s=a=>{if(id().savingField!==null)return;const d=i;Bh(a),Lo("theme",a).then(f=>{f||Bh(d)})};return l.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),l.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),l.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:ZP.map(a=>{const d=a.id===i;return l.jsxs("button",{type:"button","aria-pressed":d,className:`theme-card ${d?"is-active":""}`,disabled:t,onClick:()=>s(a.id),children:[l.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:a.swatch.map(f=>l.jsx("i",{style:{background:f}},f))}),l.jsx("span",{className:"theme-card-label",children:a.label}),l.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:d?l.jsx(fz,{}):null})]},a.id)})})]}),l.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function cz({state:e,saving:t}){const i=e?.uiFont??ic,[s,a]=L.useState([]),[d,f]=L.useState(!0),[c,h]=L.useState(null);L.useEffect(()=>{const m=new AbortController;return Yw({signal:m.signal}).then(S=>{a(S.fonts.filter(w=>w.uiSuitable).map(({family:w,monospace:T})=>({family:w,monospace:T}))),h(null)}).catch(S=>{m.signal.aborted||(a([]),h(S instanceof Error?S.message:"Installed fonts could not be loaded."))}).finally(()=>{m.signal.aborted||f(!1)}),()=>m.abort()},[]);const p=m=>{if(id().savingField!==null)return;const S=i;Gm(m),Lo("uiFont",m).then(w=>{w||Gm(S)})},g=m=>{const S=m.source==="builtin"?{source:"builtin",id:m.id,size:i.size}:{source:"system",familyName:m.familyName,size:i.size};p(S)};return l.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),l.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),l.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||i.source==="builtin"&&i.id==="manrope"&&i.size===_o.defaultValue,onClick:()=>p(ic),children:"Reset to Fleet default"})]}),l.jsx(Kw,{builtIns:Ih.map(({id:m,label:S,family:w,aliases:T,description:C})=>({id:m,label:S,family:w,aliases:T,description:C})),installedFonts:s,selected:i.source==="builtin"?{source:"builtin",id:i.id}:{source:"system",familyName:i.familyName},selectedSystemFont:i.source==="system"?i.familyName:null,fallbackStack:pw(ic),previewText:"Fleet typography keeps operations readable.",size:i.size,sizeRange:_o,loading:d,error:c,disabled:!e||t,onSelectionChange:g,onSizeCommit:m=>p({...i,size:m})}),l.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function uz({state:e,saving:t}){const i=hr();return l.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?l.jsxs(l.Fragment,{children:[l.jsx(dz,{state:e,saving:t,consoleState:i}),l.jsx(hz,{state:e,saving:t})]}):l.jsx("p",{className:"global-settings-help",children:"Loading settings."}),l.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function hz({state:e,saving:t}){return l.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),l.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),l.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:QP.map(i=>{const s=e.language===i.id;return l.jsx("button",{type:"button","aria-pressed":s,className:`segmented-option ${s?"is-active":""}`,disabled:t,onClick:()=>{Lo("language",i.id)},children:i.label},i.id)})}),l.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function dz({state:e,saving:t,consoleState:i}){const[s,a]=L.useState(e.consoleStaticPort?.toString()??""),d=i.effectivePort,f=i.portMode==="static"&&!i.portHonored,c=i.requestedPort,h=e.consolePortMode==="static"&&e.consoleStaticPort!==null,p=s.trim(),g=Number(p),m=p.length>0,S=m&&gx(g),w=e.consolePortMode==="static"&&m&&!S;return L.useEffect(()=>{a(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),l.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",l.jsx("span",{className:"new-badge",children:"New"})]}),l.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."})]}),l.jsxs("div",{className:"console-port-control",children:[l.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:JP.map(T=>{const C=e.consolePortMode===T.id;return l.jsx("button",{type:"button","aria-pressed":C,className:`segmented-option ${C?"is-active":""}`,disabled:t,onClick:()=>{Lo("consolePortMode",T.id)},children:T.label},T.id)})}),l.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:l.jsxs("div",{className:"console-port-reveal-inner",children:[l.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),l.jsx("input",{id:"console-static-port-input",className:`console-port-input ${w?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:s,disabled:t,"aria-invalid":w,"aria-describedby":"console-static-port-hint",onChange:T=>{const C=T.target.value;a(C);const _=Number(C.trim());gx(_)&&Lo("consoleStaticPort",_)}}),l.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${w?"is-invalid":""}`,children:"1024–65535"})]})}),l.jsxs("div",{className:`console-port-effective ${f?"is-fallback":""}`,"aria-live":"polite",children:[l.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),l.jsxs("div",{children:[l.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),l.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",l.jsx("span",{children:d||"..."}),f?" · Dynamic":""]})]})]}),f&&c?l.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",l.jsx("strong",{children:c})," was unavailable — the console fell back to a ",l.jsx("strong",{children:"Dynamic"})," port and is running on ",l.jsxs("strong",{children:["127.0.0.1:",d||"..."]}),"."," ",h?l.jsxs(l.Fragment,{children:["Next restart will try ",l.jsx("strong",{children:e.consoleStaticPort}),"."]}):l.jsx(l.Fragment,{children:"Next restart will use a dynamic port."})]}):null,l.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function gx(e){return Number.isInteger(e)&&e>=ez&&e<=tz}function fz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 pz(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function kc(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function mz(e,t){return{...pz(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const _x=256,vx=176,Em=12,fh=220;function gz({operations:e,pluginOperations:t,viewport:i,canvasSize:s,onJump:a}){const d=L.useRef(null),f=L.useRef(!1);if(s.width<=0||s.height<=0||i.zoom<=0)return null;const c=[...Object.entries(e).map(([$,H])=>({id:$,x:H.x,y:H.y,width:H.width,height:H.height})),...Object.entries(t).map(([$,H])=>({id:$,x:H.geometry.x,y:H.geometry.y,width:H.geometry.width,height:H.geometry.height}))];if(c.length===0)return null;const h=_x-Em*2,p=vx-Em*2,g={x:-i.x/i.zoom,y:-i.y/i.zoom,width:s.width/i.zoom,height:s.height/i.zoom};let m=Math.min(g.x,...c.map($=>$.x)),S=Math.min(g.y,...c.map($=>$.y)),w=Math.max(g.x+g.width,...c.map($=>$.x+$.width)),T=Math.max(g.y+g.height,...c.map($=>$.y+$.height));m-=fh,S-=fh,w+=fh,T+=fh;const C=w-m,_=T-S,b=Math.min(h/C,p/_),v=(h-C*b)/2,y=(p-_*b)/2,k=$=>v+($-m)*b,M=$=>y+($-S)*b,R=$=>{const H=d.current?.getBoundingClientRect();if(!H)return;const q=$.clientX-H.left,B=$.clientY-H.top;a({x:m+(q-v)/b,y:S+(B-y)/b})},N=$=>{$.stopPropagation(),f.current=!0,$.currentTarget.setPointerCapture($.pointerId),R($)},A=$=>{f.current&&($.stopPropagation(),R($))},I=$=>{f.current=!1;try{$.currentTarget.releasePointerCapture($.pointerId)}catch{}};return l.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:_x,height:vx},children:[l.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),l.jsxs("div",{ref:d,className:"canvas-minimap-inner",style:{inset:Em},onPointerDown:N,onPointerMove:A,onPointerUp:I,onPointerCancel:I,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[c.map($=>l.jsx("div",{className:"canvas-minimap-operation",style:{left:k($.x),top:M($.y),width:Math.max(2,$.width*b),height:Math.max(2,$.height*b)}},$.id)),l.jsx("div",{className:"canvas-minimap-view",style:{left:k(g.x),top:M(g.y),width:g.width*b,height:g.height*b}})]})]})}function _z({viewport:e}){return l.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[l.jsx("div",{className:"operations-canvas-sea"}),l.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 bx=8,vz=120;function bz({anchor:e,accentKey:t,onSelect:i,onClose:s}){const[a,d]=L.useState(void 0);L.useLayoutEffect(()=>{const c=Math.max(8,Math.min(e.left,window.innerWidth-8)),h=e.bottom+bx,p=h+vz>window.innerHeight;d(p?{position:"fixed",left:c,top:"auto",bottom:Math.round(window.innerHeight-e.top+bx)}:{position:"fixed",left:c,top:Math.round(h)})},[e]),L.useEffect(()=>{const c=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return window.addEventListener("keydown",c),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("keydown",c),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[s]);const f=c=>{i(c),s()};return js.createPortal(l.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:s,children:a?l.jsxs("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:a,onPointerDown:c=>c.stopPropagation(),children:[l.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":t===null,onClick:()=>f(null),children:[l.jsx("span",{}),"None"]}),Sd.map(c=>l.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":c.label,"aria-pressed":t===c.key,onClick:()=>f(c.key),children:l.jsx("span",{style:{background:c.color}})},c.key))]}):null}),document.body)}const yz=["n","ne","e","se","s","sw","w","nw"],km=320,Tm=200,Sz=1500;function xz({operation:e,active:t,geometry:i,zoom:s,status:a,minimized:d=!1,maximized:f=!1,interactionDisabled:c=!1,accentKey:h=null,children:p,onActivate:g,onClose:m,onMinimize:S,onMaximize:w,onRename:T,onSetAccent:C,onGeometryChange:_,onGeometryCommit:b}){const v=L.useRef(null),y=L.useRef(null),k=L.useRef(null),M=L.useRef(null),R=L.useRef(null),N=L.useRef(!1),[A,I]=L.useState(null),[$,H]=L.useState(!1),q=e.title,B=V_({currentTitle:e.title,onBegin:()=>{K()},onCommit:ye=>{T(ye),N.current=!0}}),Y=h?To(h):null,G=["canvas-operation",t?"is-active":"",d?"is-minimized":"",f?"is-maximized":"",Cz(a)].filter(Boolean).join(" ");L.useEffect(()=>()=>{R.current!==null&&window.clearTimeout(R.current)},[]),L.useEffect(()=>{if(B.renaming||!N.current)return;N.current=!1;const ye=window.requestAnimationFrame(()=>y.current?.focus());return()=>window.cancelAnimationFrame(ye)},[B.renaming]);const P=()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null)},K=()=>{P(),H(!1)},V=()=>{P(),H(!0),R.current=window.setTimeout(()=>{R.current=null,H(!1)},Sz)},O=ye=>{K(),!(f||c)&&ye.button===0&&(ye.preventDefault(),ye.stopPropagation(),g(),k.current={pointerId:ye.pointerId,startX:ye.clientX,startY:ye.clientY,geometry:i,latest:i},ye.currentTarget.setPointerCapture(ye.pointerId))},z=ye=>{if(f||c)return;const Oe=k.current;if(!Oe||Oe.pointerId!==ye.pointerId)return;ye.preventDefault(),ye.stopPropagation();const xt={...Oe.geometry,x:Oe.geometry.x+(ye.clientX-Oe.startX)/s,y:Oe.geometry.y+(ye.clientY-Oe.startY)/s};Oe.latest=xt,_(xt)},j=ye=>{if(f||c){k.current=null;return}const Oe=k.current;!Oe||Oe.pointerId!==ye.pointerId||(ye.preventDefault(),ye.stopPropagation(),k.current=null,ye.currentTarget.releasePointerCapture(ye.pointerId),b(Oe.latest))},W=(ye,Oe)=>{f||c||(Oe.preventDefault(),Oe.stopPropagation(),g(),M.current={direction:ye,pointerId:Oe.pointerId,startX:Oe.clientX,startY:Oe.clientY,geometry:i,latest:i},Oe.currentTarget.setPointerCapture(Oe.pointerId))},Z=ye=>{if(f||c)return;const Oe=M.current;if(!Oe||Oe.pointerId!==ye.pointerId)return;ye.preventDefault(),ye.stopPropagation();const xt=wz(Oe.geometry,Oe.direction,(ye.clientX-Oe.startX)/s,(ye.clientY-Oe.startY)/s);Oe.latest=xt,_(xt)},ne=ye=>{if(f||c){M.current=null;return}const Oe=M.current;!Oe||Oe.pointerId!==ye.pointerId||(ye.preventDefault(),ye.stopPropagation(),M.current=null,ye.currentTarget.releasePointerCapture(ye.pointerId),b(Oe.latest))},te=ye=>{ye.stopPropagation()},he=ye=>{ye.stopPropagation(),K()},J=ye=>{ye.stopPropagation(),g()},F=ye=>{ye.stopPropagation()},ae=()=>{K();const ye=typeof document<"u"?document.activeElement:null;ye instanceof HTMLElement&&v.current?.contains(ye)&&ye.blur(),S()},fe=()=>{K(),w?.()},Ce=ye=>{K(),g(),I(ye)},pe=ye=>{ye.stopPropagation(),K(),g()},xe=()=>{if(!$){V();return}K(),m()},Le=ye=>{ye.stopPropagation(),B.begin()},Pe=ye=>{ye.key!=="Enter"&&ye.key!=="F2"||(ye.preventDefault(),ye.stopPropagation(),B.begin())},Ue=ye=>{ye.key==="Escape"&&(N.current=!0),B.handleKeyDown(ye)},Ae={left:Math.round(i.x),top:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),zIndex:i.zIndex,...Y?{"--user-accent":Y}:{}};return l.jsxs("article",{ref:v,className:G,style:Ae,onPointerDown:g,"data-canvas-operation":!0,"aria-label":`Operation ${q}`,inert:d?!0:void 0,children:[!f&&!c?l.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:O,onPointerMove:z,onPointerUp:j,onPointerCancel:j,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,l.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:O,onPointerMove:z,onPointerUp:j,onPointerCancel:j,"data-canvas-blocker":!0,children:[!t&&B.renaming?l.jsx("input",{ref:B.inputRef,className:"canvas-operation-identity-input",value:B.draftTitle,"aria-label":`Rename operation ${q}`,onChange:ye=>B.setDraftTitle(ye.target.value),onKeyDown:Ue,onBlur:B.handleBlur,onPointerDown:he}):t?null:l.jsx("button",{ref:y,type:"button",className:"canvas-operation-identity-name",onPointerDown:he,onDoubleClick:Le,onKeyDown:Pe,"aria-label":`Rename operation ${q}`,title:`${q} — Double-click, Enter, or F2 to rename`,children:q}),C?l.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:te,onClick:ye=>Ce(ye.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${q}`,"aria-haspopup":"menu",title:"Set accent",children:l.jsx("span",{className:yx(a),"aria-hidden":"true"})}):l.jsx("span",{className:yx(a),onPointerDown:pe,"aria-hidden":"true"}),l.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:te,onClick:ae,"aria-label":`Minimize operation ${q}`,title:"Minimize operation",children:l.jsx(Ez,{})}),w?l.jsx("button",{type:"button",className:`canvas-operation-icon-button ${f?"is-active":""}`,onPointerDown:te,onClick:fe,"aria-label":f?`Restore operation ${q}`:`Maximize operation ${q}`,"aria-pressed":f,title:f?"Restore operation":"Maximize operation",children:f?l.jsx(Tz,{}):l.jsx(kz,{})}):null,l.jsx("button",{type:"button",className:`canvas-operation-icon-button ${$?"is-armed-close":""}`,onPointerDown:te,onClick:xe,"aria-label":$?`Confirm close operation ${q}`:`Close operation ${q}`,title:$?"Confirm close":"Close operation",children:$?"Close?":l.jsx(Az,{})})]}),l.jsx("div",{className:"canvas-operation-terminal",onPointerDown:J,onWheel:F,"data-canvas-blocker":!0,children:p}),!f&&!c&&yz.map(ye=>l.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${ye}`,onPointerDown:Oe=>W(ye,Oe),onPointerMove:Z,onPointerUp:ne,onPointerCancel:ne,"data-canvas-blocker":!0,"aria-hidden":"true"},ye)),A&&C?l.jsx(bz,{anchor:A,accentKey:h,onSelect:C,onClose:()=>I(null)}):null]})}function wz(e,t,i,s){let{x:a,y:d,width:f,height:c}=e;return t.includes("e")&&(f+=i),t.includes("s")&&(c+=s),t.includes("w")&&(a+=i,f-=i),t.includes("n")&&(d+=s,c-=s),f<km&&(t.includes("w")&&(a-=km-f),f=km),c<Tm&&(t.includes("n")&&(d-=Tm-c),c=Tm),{...e,x:a,y:d,width:f,height:c}}function Cz(e){const t=xd(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function yx(e){const t=xd(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 Ez(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function kz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Tz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Az(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Rz({rect:e,viewport:t}){const i=mz(e,t);return l.jsx("div",{className:"canvas-rubber-band",style:{left:i.x,top:i.y,width:i.width,height:i.height},"aria-hidden":"true"})}const Lz=.25,Mz=2,Nz=200,Oz=150,Sx=5,Dz=.0018;function jz({viewport:e,disabled:t=!1,consumePointerDown:i=!1,onViewportChange:s,onZoom:a,onCreate:d,onConsumePointerDown:f,onClick:c}){const h=L.useRef(null),p=L.useRef(e),[g,m]=L.useState(null),[S,w]=L.useState(!1),[T,C]=L.useState(!1);L.useEffect(()=>{p.current=e},[e]),L.useEffect(()=>{const R=A=>{A.key==="Shift"&&C(!0),!Iz(A.target)&&A.code==="Space"&&(A.preventDefault(),w(!0))},N=A=>{A.key==="Shift"&&C(!1),A.code==="Space"&&w(!1)};return window.addEventListener("keydown",R),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",R),window.removeEventListener("keyup",N)}},[]);const _=R=>{if(t||xx(R.target)||R.button!==0&&R.button!==1)return;if(R.preventDefault(),i){f?.();return}const N=Rm(R),A=R.shiftKey&&R.button===0&&!S?"create":"pan";h.current={pointerId:R.pointerId,mode:A,startScreen:N,currentScreen:N,startViewport:p.current},R.currentTarget.setPointerCapture(R.pointerId),A==="create"&&m(Am(N,N,p.current))},b=R=>{const N=h.current;if(!N||N.pointerId!==R.pointerId)return;R.preventDefault();const A=Rm(R);if(h.current={...N,currentScreen:A},N.mode==="pan"){s({...N.startViewport,x:N.startViewport.x+A.x-N.startScreen.x,y:N.startViewport.y+A.y-N.startScreen.y});return}m(Am(N.startScreen,A,p.current))},v=R=>{M(R,!0)},y=R=>{M(R,!1)},k=R=>{if(t||xx(R.target))return;R.preventDefault();const N=Rm(R),A=p.current,I=Bz(A.zoom*Math.exp(-R.deltaY*Dz),Lz,Mz),$=kc(N,A);a({x:N.x-$.x*I,y:N.y-$.y*I,zoom:I})},M=(R,N)=>{const A=h.current;if(!A||A.pointerId!==R.pointerId||(h.current=null,R.currentTarget.releasePointerCapture(R.pointerId),m(null),!N))return;const I=Math.abs(A.currentScreen.x-A.startScreen.x),$=Math.abs(A.currentScreen.y-A.startScreen.y);if(I<Sx&&$<Sx){c?.();return}if(A.mode!=="create")return;const H=Am(A.startScreen,A.currentScreen,p.current),q={x:H.x,y:H.y,width:Math.max(H.width,Nz),height:Math.max(H.height,Oz)};d(q,A.currentScreen)};return{rubberBand:g,spaceActive:S,shiftActive:T,onPointerDown:_,onPointerMove:b,onPointerUp:v,onPointerCancel:y,onWheel:k}}function Am(e,t,i){const s=kc(e,i),a=kc(t,i),d=Math.min(s.x,a.x),f=Math.min(s.y,a.y);return{x:d,y:f,width:Math.abs(s.x-a.x),height:Math.abs(s.y-a.y)}}function Rm(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function xx(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function Iz(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function Bz(e,t,i){return Math.min(i,Math.max(t,e))}const Pz="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",zz=560,Hz=360;function $z({state:e,catalog:t,canLaunch:i,renderKindIcon:s,onLaunchKind:a,onLaunchAtGeometry:d,onResetView:f,onToggleFormation:c,onClose:h,onFocus:p,onRename:g,onSetAccent:m}){const S=L.useRef(null),w=sE(),T=F_(),C=aE(),_=oE(),b=e.activeOperationId,[v,y]=L.useState(null),k=Io(),[M,R]=L.useState({width:0,height:0}),N=!e.activeTheaterId||e.addingTheater;L.useEffect(()=>{const te=S.current;if(!te||typeof ResizeObserver>"u")return;const he=()=>R({width:te.clientWidth,height:te.clientHeight});he();const J=new ResizeObserver(he);return J.observe(te),()=>J.disconnect()},[]);const A=jz({viewport:w.viewport,disabled:N||T,onViewportChange:Ng,onZoom:lE,onCreate:te=>{if(y(null),e.activeTheaterId&&i){const he=Kz(t);if(!he)return;const J={...Wz(te),zIndex:_a()};d(he.pluginId,he.kind,J)}},consumePointerDown:v!==null,onConsumePointerDown:()=>{y(null)},onClick:Uz}),I=(te,he)=>{const J=v?.canvasPoint;y(null),J&&a(te,he,J)},$=()=>{y(null),f()},H=te=>{if(te.target instanceof Element&&te.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;te.preventDefault();const he=S.current?.getBoundingClientRect();if(!he)return;const J={x:te.clientX-he.left,y:te.clientY-he.top};y({anchor:J,canvasPoint:kc(J,w.viewport)})},q=new Set(_);L.useEffect(()=>{e.activeOperationId&&q.has(e.activeOperationId)&&gi(null)},[_,e.activeOperationId]);const B=Object.fromEntries(Object.entries(w.operations).filter(([te])=>!q.has(te))),Y=(e.operations??[]).filter(te=>te.theaterId===e.activeTheaterId),G=Y,P=Y.length>0,K=k.operationKinds,O=C!==null&&Y.some(te=>te.id===C&&!q.has(te.id))?C:null,z=ww(Y,e.groups.filter(te=>te.theaterId===e.activeTheaterId),w.operationOrder,[]).filter(te=>!q.has(te.id)).map(te=>te.id),j=T?SB({x:0,y:0,width:M.width,height:M.height},z.length):[],W=new Map(z.map((te,he)=>[te,j[he]])),Z=O||T?1:w.viewport.zoom,ne=qz(w.operations)+1;return l.jsxs("main",{className:`operations-canvas ${A.spaceActive?"is-panning":""} ${A.shiftActive?"is-creating":""} ${O?"is-panel-maximized":""} ${T?"is-formation-view":""}`,onPointerDown:A.onPointerDown,onPointerMove:A.onPointerMove,onPointerUp:A.onPointerUp,onPointerCancel:A.onPointerCancel,onWheel:A.onWheel,onContextMenu:H,ref:S,children:[l.jsx(_z,{viewport:w.viewport}),l.jsx("div",{style:{transform:O||T?"none":`translate(${Math.round(w.viewport.x)}px, ${Math.round(w.viewport.y)}px) scale(${w.viewport.zoom})`},className:"operations-canvas-world",children:G.map(te=>{const he=w.operations[te.id]??te.geometry??Lm(te),J=O===te.id,F=W.get(te.id),ae=J?Gz(M,ne):F?{...he,...F}:he;return Yz(te,{active:b===te.id,geometry:ae,operationKindRegistry:K,status:e.operationStatus[te.id],theme:e.activeTheme,viewportZoom:Z,minimized:q.has(te.id),maximized:J,formation:T,accentKey:w.operationAccent[te.id]??Vz(te),onActivate:()=>{gi(te.id),!J&&!T&&Og(te.id,w.operations[te.id]??te.geometry??Lm(te))},onClose:()=>{e.activeOperationId===te.id&&gi(null),O===te.id&&Ds(),h(te.id)},onMinimize:()=>{e.activeOperationId===te.id&&gi(null),cE(te.id)},onMaximize:()=>{J?Ds():(gi(te.id),cc(te.id))},onRename:fe=>{g(te.id,fe)},onSetAccent:fe=>{m(te.id,fe)},onGeometryChange:fe=>{!J&&!T&&Og(te.id,fe)},onGeometryCommit:fe=>{!J&&!T&&Zz(te.id,Ao().operations[te.id]??fe)}})})}),P?null:l.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[l.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),l.jsx("p",{children:e.activeTheaterId?Pz:"Add a Theater from the top bar to start operations."})]}),A.rubberBand?l.jsx(Rz,{rect:A.rubberBand,viewport:w.viewport}):null,v?l.jsx(nE,{anchor:v.anchor,viewportBounds:Fz(S.current),placement:"cursor",catalog:t,canLaunch:i&&!T,renderKindIcon:s,onLaunchKind:I,onResetView:$,formationView:T,onToggleFormation:()=>{c(),y(null)},onClose:()=>y(null)},`${v.anchor.x}:${v.anchor.y}`):null,!T&&!O?l.jsx(gz,{operations:B,pluginOperations:Object.fromEntries(Y.filter(te=>!q.has(te.id)).map(te=>[te.id,{theaterId:te.theaterId,geometry:w.operations[te.id]??te.geometry??Lm(te)}])),viewport:w.viewport,canvasSize:M,onJump:te=>Ng({x:M.width/2-te.x*w.viewport.zoom,y:M.height/2-te.y*w.viewport.zoom,zoom:w.viewport.zoom})}):null]})}function Fz(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Uz(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}gi(null)}function Wz(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Lm(e){return e.geometry??{x:0,y:0,width:zz,height:Hz,zIndex:0}}function Gz(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function qz(e){return Object.values(e).reduce((t,i)=>Math.max(t,i.zIndex),0)}function Kz(e){const t=e.flatMap(i=>i.kinds.filter(s=>s.disabled!==!0).map(s=>({pluginId:i.id,kind:s})));return t.find(({kind:i})=>i.type==="shell")??t[0]??null}function Vz(e){return typeof e.accent=="string"?e.accent:null}function Yz(e,t){const i=t.operationKindRegistry.find(d=>d.pluginId===e.pluginId&&d.type===e.type),s=t.geometry;if(!i?.render)return null;const a=Cd(()=>{_i(null).then(Ni).catch(()=>{})});return l.jsx(xz,{operation:e,active:t.active,geometry:s,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,interactionDisabled:t.formation,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,children:l.jsx(Jg,{fallback:l.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:l.jsx(Xz,{active:t.active,capabilities:a,descriptor:i,geometry:s,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange})})},e.id)}function Xz({active:e,capabilities:t,descriptor:i,geometry:s,operation:a,theme:d,viewportZoom:f,onActivate:c,onClose:h,onGeometryChange:p}){return i.render?i.render({operationId:a.id,theaterId:a.theaterId,pluginId:a.pluginId,type:a.type,operation:a,geometry:s,active:e,zoom:f,theme:d,api:t.api,lifecycle:t.lifecycle,terminal:t.terminal,notifications:t.notifications,operations:t.operations,preferences:t.preferences,settings:t.settings,status:t.status,onActivate:c,onClose:h,onGeometryChange:p}):null}async function Zz(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function XE(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(i=>i.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function ZE(e,t){const i=new Set(t.map(s=>s.id));return e.filter(s=>i.has(s.operationId))}function JE(e,t){const i=[],s=[];for(const a of e)t.has(a.operationId)?s.push(a):i.push(a);return{hidden:i,visible:s}}function Ug(e){const t=new Map;for(const i of[...e].sort((s,a)=>a.lastRaisedSeq-s.lastRaisedSeq)){const s=i.theaterId??"__unknown__",a=t.get(s)??{theaterId:i.theaterId,theaterLabel:i.theaterLabel,notifications:[]};a.notifications.push(i),t.set(s,a)}return[...t.values()].sort((i,s)=>{const a=i.notifications[0]?.lastRaisedSeq??0;return(s.notifications[0]?.lastRaisedSeq??0)-a})}function QE(e,t){return t.globalMute||t.dnd?[]:e.filter(i=>!i.theaterId||t.mutedTheaterIds[i.theaterId]!==!0)}const Jz={ended:"Ended","input-waiting":"Waiting for input"},Qz={id:"alerts",title:"Alerts",icon:()=>l.jsx(tH,{}),render:()=>l.jsx(eH,{})};function eH(){const e=hr(),t=Lc(),[i,s]=L.useState(!1),a=L.useMemo(()=>ZE(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),d=XE(e),f=JE(a,d).hidden,c=QE(f,e.notificationPreferences),h=Ug(c),p=Ug(f),g=Wg(h,"input-waiting"),m=Wg(h,"ended"),S=h.length===0,w=L.useCallback(T=>{mc(T.operationId),t("/operations")},[t]);return l.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[l.jsxs("div",{className:"alerts-panel-toolbar",children:[l.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[g>0?l.jsx("span",{className:"notification-tally is-input-waiting",children:g}):null,m>0?l.jsx("span",{className:"notification-tally is-ended",children:m}):null,S?l.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),l.jsx("button",{type:"button",className:`alerts-panel-settings-btn${i?" is-active":""}`,onClick:()=>s(T=>!T),"aria-expanded":i,"aria-label":"Notification settings",title:"Notification settings",children:l.jsx(sH,{})})]}),i?l.jsx(nH,{groups:p}):null,S?l.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):l.jsx("div",{className:"notification-dock-deck",children:h.map(T=>l.jsxs("section",{className:"notification-cluster-group",children:[l.jsxs("header",{className:"notification-cluster-group-head",children:[l.jsx("span",{className:"notification-cluster-theater",children:T.theaterLabel}),l.jsx("span",{className:"notification-cluster-group-count",children:T.notifications.length})]}),l.jsx("ul",{className:"notification-cluster-roster",children:T.notifications.map(C=>l.jsxs("li",{className:`notification-row is-${C.kind}`,children:[l.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),l.jsxs("span",{className:"notification-row-body",children:[l.jsx("span",{className:"notification-row-op",children:C.operationLabel}),l.jsx("span",{className:"notification-row-state",children:Jz[C.kind]})]}),l.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>w(C),"aria-label":`Open ${T.theaterLabel} ${C.operationLabel}`,children:"Open"})]},C.operationId))})]},T.theaterId??"__unknown__"))})]})}function tH(){const e=hr();Fw();const t=L.useMemo(()=>ZE(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),i=XE(e),s=JE(t,i).hidden,a=QE(s,e.notificationPreferences),d=Ug(a),f=d.reduce((p,g)=>p+g.notifications.length,0),c=Wg(d,"input-waiting"),h=f===0?"muted":c>0?"awaiting":"ended";return l.jsxs("span",{className:`alerts-icon is-${h}`,"aria-hidden":"true",children:[l.jsx(rH,{}),f>0?l.jsx("span",{className:"alerts-icon-badge",children:f}):null]})}function nH({groups:e}){const t=hr(),i=iH(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return l.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[l.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),l.jsxs("label",{className:"notification-cluster-setting",children:[l.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:s=>H3(s.currentTarget.checked)}),l.jsx("span",{children:"Mute all"})]}),l.jsxs("label",{className:"notification-cluster-setting",children:[l.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:s=>$3(s.currentTarget.checked)}),l.jsx("span",{children:"Do not disturb"})]}),i.length>0?l.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,i.map(s=>l.jsxs("label",{className:"notification-cluster-setting",children:[l.jsx("input",{type:"checkbox",checked:s.theaterId?t.notificationPreferences.mutedTheaterIds[s.theaterId]===!0:!1,onChange:()=>{s.theaterId&&F3(s.theaterId)}}),l.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function iH(e,t,i){const s=new Map;for(const a of e)a.theaterId&&s.set(a.theaterId,a);for(const a of Object.keys(t))s.has(a)||s.set(a,{theaterId:a,theaterLabel:i.find(d=>d.id===a)?.label??a,notifications:[]});return[...s.values()]}function Wg(e,t){let i=0;for(const s of e)for(const a of s.notifications)a.kind===t&&(i+=1);return i}function rH(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[l.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"}),l.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function sH(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[l.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"}),l.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"})]})}async function aH(e,t){const s=new URLSearchParams().toString();return Bo(ba(e,`/search${s?`?${s}`:""}`))}async function oH(e,t,i){return Bo(ba(e,`/entry/${encodeURIComponent(t)}`))}async function e5(e,t="pending"){return Bo(ba(e,`/drydock?status=${encodeURIComponent(t)}`))}async function lH(e,t){return Bo(ba(e,`/drydock/${encodeURIComponent(t)}`))}async function cH(e,t,i,s){const a={action:i};return s!==void 0&&(a.reason=s),dH(ba(e,`/drydock/${encodeURIComponent(t)}/decision`),a)}async function uH(e){return Bo(ba(e,"/conflicts"))}async function hH(e,t){return Bo(ba(e,`/conflicts/${encodeURIComponent(t)}`))}function ba(e,t){const i=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${i}`:`/console/codex/api${i}`}async function Bo(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await t5(e,t));return t.json()}async function dH(e,t){const i=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(await t5(e,i));return i.json()}async function t5(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const Gg=new Set,rd={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function nc(){return rd}function n5(e){return Gg.add(e),()=>Gg.delete(e)}function wx(e){Ah({currentWorkspaceId:e})}async function sd(){Ah({loading:!0,error:null});try{const e=rd.currentWorkspaceId,[t,i]=await Promise.all([aH(e),e5(e,"pending").catch(()=>null)]);Ah({index:t.entries,pendingPatchCount:i?.pendingCount??0,loading:!1})}catch(e){Ah({loading:!1,error:fH(e)})}}function Ah(e){Object.assign(rd,e);for(const t of Gg)t(rd)}function fH(e){return e instanceof Error?e.message:String(e)}const pH=120;function sr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function mH(e,t){if(!t)return sr(e);const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?sr(e):sr(e.slice(0,i))+`<mark>${sr(e.slice(i,i+t.length))}</mark>`+sr(e.slice(i+t.length))}function gH(e){return`<span class="codex-nav-tag">${sr(e)}</span>`}function _H(e,t,i){const s=t?e.tags.some(c=>c.toLowerCase().includes(t.toLowerCase())):!1,a=e.tags.slice(0,3).map(gH).join(""),d=sr(e.status??"current"),f=sr(e.updated??"");return`<button
215
+ class="codex-nav-entry${i?" is-current":""}"
216
+ data-entry-id="${sr(e.id)}"
217
+ type="button"
218
+ ${i?'aria-current="page"':""}
219
+ title="${sr(e.title)}"
220
+ >
221
+ <span class="t">${mH(e.title,s?"":t)}</span>
222
+ ${a?`<span class="tg">${a}</span>`:""}
223
+ <span class="meta">${d} · ${f}</span>
224
+ </button>`}function vH(e,t){if(!t)return e;const i=t.toLowerCase();return e.filter(s=>s.title.toLowerCase().includes(i)||s.tags.some(a=>a.toLowerCase().includes(i)))}function bH(e,t){let i="",s=null,a=null;e.innerHTML=`
225
+ <div class="codex-navigator">
226
+ <div class="codex-nav-search">
227
+ <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>
228
+ <input
229
+ class="codex-nav-search-input"
230
+ type="search"
231
+ placeholder="Search entries"
232
+ autocomplete="off"
233
+ spellcheck="false"
234
+ aria-label="Search Codex entries"
235
+ />
236
+ </div>
237
+ <div class="codex-nav-quick-row">
238
+ <button class="codex-nav-quick" data-action="drydock" type="button">
239
+ Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
240
+ </button>
241
+ <button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
242
+ </div>
243
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
244
+ <div class="codex-navigator-scroll">
245
+ <div class="codex-nav-list" id="codex-nav-list"></div>
246
+ </div>
247
+ </div>
248
+ `;const d=e.querySelector(".codex-nav-search-input"),f=e.querySelector("#codex-nav-list"),c=e.querySelector("#codex-nav-eyebrow"),h=e.querySelector("#codex-nav-drydock-badge");function p(w){const T=vH(w.index,i);if(c.textContent=`Entries · ${T.length}`,h.textContent=String(w.pendingPatchCount),h.hidden=w.pendingPatchCount===0,w.loading&&w.index.length===0){f.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(w.error){f.innerHTML=`<div class="codex-nav-error" role="alert">${sr(w.error)}</div>`;return}if(T.length===0){f.innerHTML=`<div class="codex-nav-empty">${i?"No entries match.":"No entries."}</div>`;return}f.innerHTML=T.map(C=>_H(C,i,C.id===s)).join("")}function g(w){const T=w.target;if(!(T instanceof Element))return;const C=T.closest("[data-entry-id]");if(C?.dataset.entryId){s=C.dataset.entryId,p(nc()),t.onRequest({kind:"entry",id:s});return}const _=T.closest("[data-action]");if(_?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(_?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function m(){a!==null&&clearTimeout(a),a=setTimeout(()=>{i=d.value,p(nc())},pH)}e.addEventListener("click",g),d.addEventListener("input",m);const S=n5(w=>p(w));return p(nc()),{destroy(){S(),e.removeEventListener("click",g),d.removeEventListener("input",m),a!==null&&clearTimeout(a),e.innerHTML=""},setTheater(w){i="",s=null,d&&(d.value=""),p(nc())}}}function yH(e,t){t.initialTheaterId&&wx(t.initialTheaterId);const i=bH(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),s=n5(()=>{});sd();const a=i.destroy.bind(i);return{destroy(){s(),a()},setTheater(d){wx(d),sd(),i.setTheater(d)}}}function Ot(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Mo(e){return Ot(e).replace(/"/g,"&quot;")}function SH(e){const t=e.tags.map(s=>`<span class="chip chip-tag">${Ot(s)}</span>`).join(""),i=wH(e);return`
249
+ <div class="meta-chips">
250
+ ${t}
251
+ ${i}
252
+ <span class="chip">Updated ${Ot(xH(e.updated))}</span>
253
+ </div>
254
+ `}function i5(e){return e.map(t=>`<span class="chip chip-muted">${Ot(t)}</span>`).join("")}function xH(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function wH(e){const t=CH(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Mo(t.title)}">${Ot(t.label)}</span>`:""}function CH(e,t=new Date){const i=e.status,s=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return i==="deprecated"||i==="superseded"?{label:i,tone:"deprecated",title:s?`${i} · stale`:i}:s?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:i==="current"||i==="draft"?{label:i,tone:"neutral",title:i}:null}const EH="active";function Cx(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Mo(t.id)}" data-toc-id="${Mo(t.id)}">${Ot(t.text)}</a>`).join("")}function Ex(e,t,i){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const s=[...i.querySelectorAll("[data-toc-id]")],a=new Set(t.map(p=>p.id)),d=[...e.querySelectorAll("h2[id], h3[id]")].filter(p=>a.has(p.id));if(s.length===0||d.length===0)return()=>{};const f=e.closest(".codex-reading-sheet-read"),c=new Set,h=new IntersectionObserver(p=>{for(const m of p){const S=m.target instanceof HTMLElement?m.target.id:"";S&&(m.isIntersecting?c.add(S):c.delete(S))}const g=kH(d,c)??TH(d,f)??d[0]?.id??null;kx(s,g)},{root:f,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const p of d)h.observe(p);return kx(s,d[0]?.id??null),()=>h.disconnect()}function kH(e,t){for(const i of e)if(t.has(i.id))return i.id;return null}function TH(e,t){const i=t?t.getBoundingClientRect().top:0;let s=null;for(const a of e)if(a.getBoundingClientRect().top-i<=80)s=a.id;else break;return s}function kx(e,t){for(const i of e){const s=!!(t&&i.dataset.tocId===t);i.classList.toggle(EH,s),s?i.setAttribute("aria-current","location"):i.removeAttribute("aria-current")}}function Tx(e){return`/entry/${encodeURIComponent(e)}`}const r5={create_wiki:"+",update_wiki:"↻"},s5={create_wiki:"Create",update_wiki:"Update"};function AH(e,t){let i=!1,s=null,a=t,d="idle",f=null,c=null,h=null;O_(e);function p(b){const v=b.target;if(!(v instanceof Element))return;const y=v.closest("[data-patch-id]");if(y){b.preventDefault();const R=y.dataset.patchId||void 0;a.onPatchOpen?.(R);return}const k=v.closest("[data-entry-id]");if(k?.dataset.entryId){b.preventDefault(),a.onRelatedClick(k.dataset.entryId);return}const M=v.closest("[data-drydock-action]");if(M){b.preventDefault(),g(M.dataset.drydockAction);return}}function g(b){if(b){if(b==="back"){a.onPatchOpen?.(void 0);return}if(b==="approve"){d="approving",f=null,S();return}if(b==="approve-confirm"){m("approve",void 0);return}if(b==="reject"){d="rejecting",f=null,S();return}if(b==="reject-submit"){const v=e.querySelector("#queue-reject-reason")?.value.trim();if(!v){f="Rejection reason is required.",S();return}m("reject",v);return}if(b==="cancel"){d="idle",f=null,S();return}}}async function m(b,v){if(h){d="submitting",f=null,S();try{await cH(a.theaterId,h,b,v),a.onDecided?.()}catch(y){d=b==="approve"?"approving":"rejecting",f=y instanceof Error?y.message:String(y),S()}}}function S(){const b=e.querySelector("[data-decision-bar-wrap]");b&&(b.innerHTML=a5(d,f))}e.addEventListener("click",p);function w(){s?.(),s=null}async function T(b){if(!i){Mm(e,t.tocContainer),w();try{const v=await oH(a.theaterId,b);if(i)return;const{index:y}=nc(),{html:k,toc:M}=xc(v.body,{omitDuplicateTitle:v.frontmatter.title,resolveWikiLink:N=>Tx(N)});e.innerHTML=`
255
+ <article class="document">
256
+ <header class="document-header">
257
+ ${RH(v.frontmatter.title)}
258
+ <h1>${Ot(v.frontmatter.title)}</h1>
259
+ ${SH(v.frontmatter)}
260
+ </header>
261
+ <div class="markdown-body" id="codex-reader-body">
262
+ ${k}
263
+ </div>
264
+ ${LH(v.frontmatter.id,v.frontmatter.tags,y)}
265
+ </article>
266
+ `,t.tocContainer.innerHTML=Cx(M);const R=e.querySelector("article");R&&M.length>0&&(s=Ex(R,M,t.tocContainer))}catch(v){i||Nm(e,t.tocContainer,v)}}}async function C(b){if(!i){Mm(e,t.tocContainer),w(),c=null,h=null,d="idle",f=null;try{if(b){const v=await lH(a.theaterId,b);if(i)return;c=v.meta,h=b;const{html:y,toc:k}=xc(v.wikiEntry.body,{omitDuplicateTitle:v.wikiEntry.title,resolveWikiLink:R=>Tx(R)});e.innerHTML=OH(v,y),t.tocContainer.innerHTML=Cx(k);const M=e.querySelector("article");M&&k.length>0&&(s=Ex(M,k,t.tocContainer))}else{const v=await e5(a.theaterId,"pending");if(i)return;t.tocContainer.innerHTML="",e.innerHTML=MH(v.items,"Review queue — Pending patches")}}catch(v){i||Nm(e,t.tocContainer,v)}}}async function _(b){if(!i){Mm(e,t.tocContainer),w();try{if(b){const v=await hH(a.theaterId,b);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=IH(v)}else{const v=await uH(a.theaterId);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=BH(v)}}catch(v){i||Nm(e,t.tocContainer,v)}}}return t.kind==="entry"&&t.initialEntryId?T(t.initialEntryId):t.kind==="drydock"?C(t.subId):t.kind==="conflicts"&&_(t.subId),{destroy(){i=!0,e.removeEventListener("click",p),w()},async setEntry(b){await T(b)},async navigateSub(b){t.kind==="drydock"?await C(b):t.kind==="conflicts"&&await _(b)},refreshCallbacks(b){a={...a,...b}}}}function Mm(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function Nm(e,t,i){const s=i instanceof Error?i.message:String(i);e.innerHTML=`<div class="codex-reader-error" role="alert">${Ot(s)}</div>`,t.innerHTML=""}function RH(e){return`
267
+ <nav class="breadcrumb" aria-label="Entry location">
268
+ <ol>
269
+ <li><span>Codex</span></li>
270
+ <li><span aria-current="page">${Ot(e)}</span></li>
271
+ </ol>
272
+ </nav>
273
+ `}function LH(e,t,i){const s=new Set(t),a=i.filter(d=>d.id!==e).map(d=>({entry:d,matchingTags:d.tags.filter(f=>s.has(f))})).filter(d=>d.matchingTags.length>0).sort((d,f)=>f.matchingTags.length-d.matchingTags.length||d.entry.title.localeCompare(f.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return a.length===0?"":`
274
+ <section class="related-list">
275
+ <h2>Related entries</h2>
276
+ <div class="related-items">
277
+ ${a.map(d=>`<button class="related-card" type="button" data-entry-id="${Mo(d.entry.id)}">
278
+ <strong>${Ot(d.entry.title)}</strong>
279
+ <span>${i5(d.matchingTags)}</span>
280
+ </button>`).join("")}
281
+ </div>
282
+ </section>
283
+ `}function MH(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
284
+ <article class="document">
285
+ <header class="document-header">
286
+ <nav class="breadcrumb" aria-label="Entry location">
287
+ <ol>
288
+ <li><span>Codex</span></li>
289
+ <li><span aria-current="page">Review queue</span></li>
290
+ </ol>
291
+ </nav>
292
+ <h1>${Ot(t)}</h1>
293
+ </header>
294
+ <div class="queue-row-list">
295
+ ${e.map(NH).join("")}
296
+ </div>
297
+ </article>
298
+ `}function NH(e){const t=e.op??"create_wiki",i=r5[t]??"?",s=s5[t]??"Patch",a=e.target??e.id,f=[PH(e.meta.createdAt)].filter(Boolean);return`
299
+ <button class="queue-row" type="button" data-patch-id="${Mo(e.id)}" aria-label="${Mo(s+": "+a)}">
300
+ <span class="queue-row-badge" aria-hidden="true">
301
+ <span class="op-badge">${i}</span>
302
+ </span>
303
+ <span class="queue-row-body">
304
+ <span class="queue-row-target">${Ot(a)}</span>
305
+ ${e.summary?`<span class="queue-row-summary">${Ot(e.summary)}</span>`:""}
306
+ ${f.length>0?`<span class="queue-row-meta">${f.map(Ot).join(" · ")}</span>`:""}
307
+ </span>
308
+ </button>
309
+ `}function OH(e,t){const{patch:i,meta:s,wikiEntry:a,targetExists:d}=e,f=i.frontmatter.op,c=r5[f]??"?",h=s5[f]??"Patch",p=d?"기존 문서 대체":"신규 문서 생성",g=s.status==="pending";return`
310
+ <article class="document">
311
+ <header class="document-header">
312
+ <nav class="breadcrumb" aria-label="Entry location">
313
+ <ol>
314
+ <li><span>Codex</span></li>
315
+ <li><span>Review queue</span></li>
316
+ <li><span aria-current="page">${Ot(h)}</span></li>
317
+ </ol>
318
+ </nav>
319
+ <button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
320
+ <h1><span class="op-badge">${c}</span> ${Ot(a.title)}</h1>
321
+ <p class="eyebrow">${Ot(i.frontmatter.target)} · v${a.version} · ${Ot(p)}</p>
322
+ ${DH(i.frontmatter.proposer,a.tags)}
323
+ </header>
324
+ <div class="markdown-body" id="codex-reader-body">
325
+ ${t}
326
+ </div>
327
+ <div class="queue-decision-section" data-decision-bar-wrap>
328
+ ${g?a5("idle",null):jH(s)}
329
+ </div>
330
+ </article>
331
+ `}function DH(e,t){const i=[];return e&&i.push(`<span class="meta-chip">${Ot(e)}</span>`),t.length>0&&i.push(i5(t)),i.length===0?"":`<div class="meta-chips">${i.join("")}</div>`}function a5(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
332
+ <p class="queue-decision-confirm">Apply this patch to the wiki?</p>
333
+ <div class="queue-action-buttons">
334
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
335
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
336
+ </div>
337
+ ${t?`<p class="queue-action-error">${Ot(t)}</p>`:""}
338
+ `:e==="rejecting"?`
339
+ <div class="queue-reject-form">
340
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
341
+ <div class="queue-action-buttons">
342
+ <button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
343
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
344
+ </div>
345
+ ${t?`<p class="queue-action-error">${Ot(t)}</p>`:""}
346
+ </div>
347
+ `:`
348
+ <div class="queue-action-buttons">
349
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
350
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
351
+ </div>
352
+ `}function jH(e){const t=e.status==="accepted",i=t?"✓ Approved":"✕ Rejected",s=t?"queue-decision-decided--approve":"queue-decision-decided--reject",a=e.reason?` · ${Ot(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${i}${a}</p>`}function IH(e){return`
353
+ <article class="document">
354
+ <header class="document-header">
355
+ <nav class="breadcrumb" aria-label="Entry location">
356
+ <ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
357
+ </nav>
358
+ <h1>${Ot(e.id)}</h1>
359
+ <p class="eyebrow">Conflict · ${Ot(e.meta?.status??"open")}</p>
360
+ </header>
361
+ <div class="markdown-body">
362
+ ${e.current?`<h2>Current</h2><pre><code>${Ot(e.current)}</code></pre>`:""}
363
+ ${e.proposed?`<h2>Proposed</h2><pre><code>${Ot(e.proposed)}</code></pre>`:""}
364
+ </div>
365
+ </article>
366
+ `}function BH(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
367
+ <article class="document">
368
+ <header class="document-header">
369
+ <h1>Conflicts</h1>
370
+ </header>
371
+ <div class="markdown-body">
372
+ <ul class="queue-list">
373
+ ${e.map(t=>`<li class="queue-item">
374
+ <strong>${Ot(t.title||t.id)}</strong>
375
+ <span class="eyebrow">${Ot(t.status)}</span>
376
+ </li>`).join("")}
377
+ </ul>
378
+ </div>
379
+ </article>
380
+ `}function PH(e){try{const i=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(i<1)return"< 1h ago";if(i<24)return`${Math.floor(i)}h ago`;const s=i/24;return s<7?`${Math.floor(s)}d ago`:s<30?`${Math.floor(s/7)}w ago`:`${Math.floor(s/30)}mo ago`}catch{return""}}let aa=null,Tc=null,o5=null,Ls=null,oa=null,As=null,Rh=null,Om=null,Lh,qg=0;function Ax(e){o5=e}function zH(e,t){const i=FH();i.parentElement!==e&&e.appendChild(i),Tc||(Tc=yH(i,{initialTheaterId:t,onRequest:s=>o5?.(s)}))}function HH(e){Tc?.setTheater(e)}function l5(e,t,i){const s=UH(),a=WH(),d=s.parentElement,f=i.kind==="entry"&&Rh==="entry"&&i.initialEntryId===Om;d&&d!==e&&(qg=d.scrollTop),s.parentElement!==e&&e.appendChild(s),a.parentElement!==t&&t.appendChild(a),!As||Rh!==i.kind?(As?.destroy(),As=AH(s,{...i,tocContainer:a}),Rh=i.kind,Lh=i.subId):i.kind==="entry"&&i.initialEntryId&&i.initialEntryId!==Om?As.setEntry(i.initialEntryId):(i.kind==="drydock"||i.kind==="conflicts")&&i.subId!==Lh&&(Lh=i.subId,As.navigateSub(i.subId)),Om=i.kind==="entry"?i.initialEntryId??null:null,As.refreshCallbacks({onPatchOpen:i.onPatchOpen,onDecided:i.onDecided,onRelatedClick:i.onRelatedClick,onClose:i.onClose,theaterId:i.theaterId});const c=f?qg:0;requestAnimationFrame(()=>{e.scrollTop=c})}function $H(){const e=Ls?.parentElement;e&&(qg=e.scrollTop)}function c5(){As?.destroy(),As=null,Rh=null,Lh=void 0,Ls?.parentElement&&Ls.parentElement.removeChild(Ls),oa?.parentElement&&oa.parentElement.removeChild(oa)}function Rx(){c5(),Tc?.destroy(),Tc=null,aa?.parentElement&&aa.parentElement.removeChild(aa)}function FH(){return aa||(aa=document.createElement("div"),aa.className="codex-host"),aa}function UH(){return Ls||(Ls=document.createElement("div"),Ls.className="codex-reader-host"),Ls}function WH(){return oa||(oa=document.createElement("div"),oa.className="codex-toc-host"),oa}const GH={id:"codex",title:"Codex",icon:()=>l.jsx(XH,{}),pathAware:!0,render:e=>l.jsx(qH,{theaterId:e.theaterId,pathContext:e.pathContext})};function qH({theaterId:e,pathContext:t}){const i=hr(),s=L.useRef(null),a=L.useRef(null),d=L.useRef(null),f=L.useRef(""),[c,h]=L.useState(null),p=i.codexReader,g=p!==null,m=i.codexReaderExpanded,S=i.theaters.find(v=>v.id===i.activeTheaterId)??null,w=i.theaters.length>0,T=`${e??""}\0${t.relPath??""}`,C=c?.contextKey===T&&c.hasWiki?c.id:null,_=C!==null,b=p?`${p.kind}:${p.kind==="entry"?p.entryId:p.kind==="drydock"?p.patchId??"":p.id??""}`:null;return L.useEffect(()=>{if(f.current=T,Hp(),!e){h({contextKey:T,hasWiki:!1,id:null});return}VH(e,t.relPath).then(v=>{f.current===T&&h({contextKey:T,...v})}).catch(()=>{f.current===T&&h({contextKey:T,hasWiki:!1,id:null})})},[T,t.relPath,e]),L.useEffect(()=>{c?.contextKey===T&&!c.hasWiki&&Rx()},[T,c]),L.useEffect(()=>()=>Rx(),[]),L.useEffect(()=>{if(!_||!C)return;const v=s.current;if(v)return zH(v,C),Ax(y=>{y.kind==="entry"?Gr({kind:"entry",entryId:y.id}):y.kind==="drydock"?Gr({kind:"drydock",patchId:y.patchId}):y.kind==="conflicts"&&Gr({kind:"conflicts",id:y.id})}),()=>{Ax(null)}},[_,C,g]),L.useEffect(()=>{_&&C&&HH(C)},[_,C]),L.useEffect(()=>{if(!_||!C||!g||m||!a.current||!d.current||!p)return;const v=p.kind,y=v==="drydock"?p.patchId:v==="conflicts"?p.id:void 0;l5(a.current,d.current,{initialEntryId:v==="entry"?p.entryId:"",kind:v,subId:y,theaterId:C,onRelatedClick:k=>Gr({kind:"entry",entryId:k}),onClose:()=>Hp(),onPatchOpen:k=>Gr({kind:"drydock",patchId:k}),onDecided:()=>{sd(),Gr({kind:"drydock",patchId:void 0})}})},[_,C,g,m,b]),L.useEffect(()=>{g||c5()},[g]),_?g?l.jsxs("div",{className:"codex-rail-host is-split",children:[l.jsxs("div",{className:"codex-doc-pane",children:[l.jsxs("div",{className:"codex-doc-pane-head",children:[l.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:vh,children:"⤢ Expand"}),l.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:Hp,children:"✕"})]}),l.jsx("div",{ref:a,className:"codex-doc-scroll"}),l.jsx("div",{ref:d,className:"codex-doc-toc-inline"})]}),l.jsx("div",{ref:s,className:"codex-nav-pane"})]}):l.jsx("div",{ref:s,className:"codex-rail-host"}):l.jsx(KH,{activeTheater:S,contextLabel:t.label,hasTheaters:w})}function KH({activeTheater:e,contextLabel:t,hasTheaters:i}){return i?l.jsxs("section",{className:"codex-empty-state",children:[l.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),l.jsx("h1",{children:t||e?.label||"This context"}),l.jsx("p",{children:"This selected context does not have Fleet Wiki data mounted."})]}):l.jsxs("section",{className:"codex-empty-state",children:[l.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),l.jsx("h1",{children:"Add a Theater"}),l.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function VH(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t})});if(!i.ok)throw new Error("codex_workspace_unavailable");return YH(await i.json())}function YH(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 XH(){return l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),l.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),l.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function u5(e,t=Date.now()){const i=Date.parse(e);if(!Number.isFinite(i))return"Unknown";const s=Math.max(0,Math.floor((t-i)/1e3));if(s<60)return"just now";const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const d=Math.floor(a/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function ZH(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 JH(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function QH(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function e$(e,t,i){return i.tasksTotal<=0?"none":i.tasksDone>=i.tasksTotal?"complete":e.slice(0,t).every(QH)?"ready":"blocked"}const t$=360,n$={id:"plans",title:"Plans",icon:l$,pathAware:!0,render:e=>l.jsx(i$,{...e})};function i$(e){const t=JSON.stringify([e.theaterId,e.pathContext.relPath]);return l.jsx(r$,{...e},t)}function r$(e){const{pathContext:t,requestExtraWidth:i,theaterId:s}=e,a=t.relPath,[d,f]=L.useState({kind:"no-theater"}),[c,h]=L.useState({kind:"loading"}),[p,g]=L.useState(null),[m,S]=L.useState(0),[w,T]=L.useState(0),C=p?.theaterId===s&&p.relPath===a?p.name:null;L.useEffect(()=>{let k=!1;return g(null),h({kind:"loading"}),s?(f({kind:"loading"}),$R(s,a).then(M=>{k||f({kind:"ready",plans:M.plans})}).catch(()=>{k||f({kind:"error"})}),()=>{k=!0}):(f({kind:"no-theater"}),()=>{k=!0})},[a,s,m]),L.useEffect(()=>{let k=!1;return!s||!C?()=>{k=!0}:(h({kind:"loading"}),FR(s,a,C).then(M=>{k||h({kind:"ready",plan:M})}).catch(()=>{k||h({kind:"error"})}),()=>{k=!0})},[w,a,C,s]),L.useLayoutEffect(()=>(i?.(C?t$:null),()=>i?.(null)),[i,C]);const _=L.useCallback(k=>{s&&g({theaterId:s,relPath:a,name:k})},[a,s]),b=L.useCallback(()=>g(null),[]),v=L.useCallback(()=>S(k=>k+1),[]),y=L.useCallback(()=>T(k=>k+1),[]);return l.jsx("div",{className:"plans-panel-shell",children:l.jsxs("div",{className:`plans-root${C?" is-reader-open":""}`,children:[C&&l.jsx(a$,{state:c,onClose:b,onRetry:y}),C&&l.jsx("div",{className:"plans-divider","aria-hidden":"true"}),l.jsx(s$,{selectedName:C,state:d,onRetry:v,onSelect:_})]})})}function s$({selectedName:e,state:t,onRetry:i,onSelect:s}){return t.kind==="no-theater"?l.jsx("div",{className:"plans-list-pane",children:l.jsx(Lx,{children:"Select a Theater to browse plans."})}):t.kind==="loading"?l.jsx("div",{className:"plans-list-pane",children:l.jsx("div",{className:"plans-loading",children:"Loading plans…"})}):t.kind==="error"?l.jsx("div",{className:"plans-list-pane",children:l.jsx(h5,{message:"Unable to load plans.",onRetry:i})}):t.plans.length===0?l.jsx("div",{className:"plans-list-pane",children:l.jsx(Lx,{detail:"Execution plans in .fleet/plans/ appear here.",children:"No plans yet."})}):l.jsx("div",{className:"plans-list-pane",children:l.jsx("div",{className:"plans-list","aria-label":"Plans",children:t.plans.map(a=>{const d=ZH(a.tasksDone,a.tasksTotal),f=d===100;return l.jsxs("button",{type:"button",className:`plans-row${e===a.name?" is-selected":""}`,onClick:()=>s(a.name),children:[l.jsx("span",{className:"plans-row-name",children:a.name}),l.jsxs("span",{className:"plans-row-meta",children:[a.waveCount," waves · ",a.tasksDone,"/",a.tasksTotal," tasks · ",u5(a.updatedAt),a.executionMode==="parallel"?" · parallel":""]}),d!==null&&l.jsx("span",{className:"plans-progress-track","aria-label":`${d}% complete`,children:l.jsx("span",{className:`plans-progress-fill${f?" is-complete":""}`,style:{width:`${d}%`}})})]},a.name)})})})}function a$({state:e,onClose:t,onRetry:i}){return e.kind==="loading"?l.jsxs("div",{className:"plans-reader-pane",children:[l.jsxs("div",{className:"plans-reader-head",children:[l.jsx("span",{className:"plans-reader-title",children:"Plan"}),l.jsx(Kg,{onClose:t})]}),l.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?l.jsxs("div",{className:"plans-reader-pane",children:[l.jsxs("div",{className:"plans-reader-head",children:[l.jsx("span",{className:"plans-reader-title",children:"Plan"}),l.jsx(Kg,{onClose:t})]}),l.jsx(h5,{message:"Unable to load plan.",onRetry:i})]}):l.jsx(o$,{plan:e.plan,onClose:t})}function o$({plan:e,onClose:t}){const i=L.useMemo(()=>{const d=new DOMParser().parseFromString(xc(e.content).html,"text/html");return Dm(d.body),d.body.innerHTML},[e.content]),s=L.useRef(null),a=L.useCallback(d=>{const f=d.target.closest('[data-action="copy-code"]');if(!f)return;const c=f.closest("pre")?.getAttribute("data-code");if(!c)return;navigator.clipboard?.writeText(c);const h=f.textContent;f.textContent="Copied",window.setTimeout(()=>{f.textContent=h},1200)},[]);return L.useEffect(()=>{const d=s.current;if(!d)return;O_(d),Dm(d);const f=new MutationObserver(()=>Dm(d));return f.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>f.disconnect()},[i]),l.jsxs("div",{className:"plans-reader-pane",children:[l.jsxs("div",{className:"plans-reader-head",children:[l.jsxs("div",{className:"plans-reader-heading",children:[l.jsx("h2",{className:"plans-reader-title",children:e.title}),l.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&l.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",u5(e.updatedAt)]})]}),l.jsx(Kg,{onClose:t})]}),l.jsxs("div",{className:"plans-reader-body",children:[l.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((d,f)=>{const c=JH(d.tasksDone,d.tasksTotal);return l.jsxs("span",{className:`plans-wave is-${c}`,children:[l.jsx("span",{className:"plans-wave-heading",children:d.heading}),d.tasksTotal>0&&l.jsxs("span",{className:"plans-wave-count",children:[d.tasksDone,"/",d.tasksTotal]}),d.lanes.length>0&&l.jsx("span",{className:"plans-lane-list",children:d.lanes.map((h,p)=>{const g=e$(e.waves,f,h);return l.jsxs("span",{className:`plans-lane is-${g}`,children:[l.jsx("span",{className:"plans-lane-id",children:h.id??h.heading}),h.tasksTotal>0&&l.jsxs("span",{className:"plans-lane-count",children:[h.tasksDone,"/",h.tasksTotal]}),g==="ready"&&l.jsx("span",{className:"plans-lane-ready",children:"READY"})]},h.id??`${d.index}-${p}`)})})]},d.index)})}),l.jsx("div",{ref:s,className:"plans-markdown markdown-body",onClick:a,dangerouslySetInnerHTML:{__html:i}})]})]})}function Kg({onClose:e}){return l.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Lx({children:e,detail:t}){return l.jsxs("div",{className:"plans-empty",children:[l.jsx("span",{children:e}),t&&l.jsx("span",{className:"plans-empty-detail",children:t})]})}function h5({message:e,onRetry:t}){return l.jsxs("div",{className:"plans-error-state",children:[l.jsx("span",{children:e}),l.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Dm(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(i)||(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 i=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),s=t.tagName==="IMG"?"Image":"Media",a=t.ownerDocument.createElement("span");a.className="plans-md-blocked-image",a.textContent=i?`${s} blocked: ${i}`:`${s} blocked`,t.replaceWith(a)}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 i=t.getAttribute("href")??t.getAttribute("xlink:href")??"";i!==""&&!i.startsWith("#")&&t.remove()}}function l$(){return l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),l.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 c$=[Qz,GH,n$];function u$(e="right"){const{railPanels:t}=Io();return e==="right"?t.filter(i=>(i.side??"right")==="right"):t}const h$=360;function d$(e){const{codexReader:t}=hr();return e==="codex"&&t!==null?h$:0}const d5=240,f$=312,f5="fleet-console.rail.panelWidth",p$={kind:"root",relPath:null,label:"Theater-wide"};function m$(){try{const e=localStorage.getItem(f5);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=d5)return t}}catch{}return f$}function g$({theaterId:e,api:t}){const i=L.useRef(null),s=Fw(),a=Uw(),d=L.useRef(a),f=u$(),c=c$,p=[...c,...f].find(B=>B.id===s)??null,g=p!==null,{pathContextTheaterId:m,pathContext:S,pathContextHydrated:w,pathContextLoading:T,pathContextMutationInProgress:C,pathContextError:_,isPathContextDeckOpen:b}=Ww(),v=e!==null&&m===e&&w&&S!==null,y=d$(s)+(p?.preferredExtraWidth??0)+UL(),k=L.useRef(y);k.current=y;const[M,R]=L.useState(m$),N=L.useRef(M),[A,I]=L.useState(!1);L.useLayoutEffect(()=>{d.current&&!a&&iE(i.current,".command-band-rail-toggle"),d.current=a},[a]),L.useEffect(()=>{Hw(e),e&&FL(e,B=>ML(e,B))},[e]);const $=L.useCallback(B=>{B.preventDefault();const Y=B.clientX,G=N.current;I(!0);const P=V=>{const O=Y-V.clientX,z=window.innerWidth-148-k.current,j=Math.max(d5,Math.min(z,G+O));N.current=j,R(j)},K=()=>{document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",K),I(!1);try{localStorage.setItem(f5,String(N.current))}catch{}};document.addEventListener("pointermove",P),document.addEventListener("pointerup",K)},[]),H=L.useMemo(()=>({theaterId:e,pathContext:S??p$,api:t,requestExtraWidth:B=>{s!==null&&$L(s,B)}}),[e,S,t,s]),q=L.useCallback(B=>{e&&$w(e,Y=>Nw(e,B,Y))},[e]);return l.jsxs("div",{ref:i,className:`right-rail${g?" is-open":""}${a?" is-expanded":" is-closed"}${A?" is-dragging":""}${b?" is-context-deck-open":""}`,"data-rail-chrome":a?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!a,style:{"--right-rail-panel-width":`${g?M+y:0}px`},children:[l.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:M+y}:void 0,children:[g&&l.jsx("div",{className:"right-rail-resize-handle",onPointerDown:$,"aria-hidden":"true"}),p&&l.jsx(_$,{activePanel:p,activeId:s,ctx:H,theaterId:e,hasHydratedPathContext:v,isPathContextDeckOpen:b,pathContextLoading:T,pathContextMutationInProgress:C,pathContextError:_,onSelectPathContext:q})]}),l.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:l.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[c.map(B=>l.jsx(Mx,{panel:B,isActive:s===B.id},B.id)),c.length>0&&f.length>0?l.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,f.map(B=>l.jsx(Mx,{panel:B,isActive:s===B.id},B.id))]})})]})}const _$=L.memo(function({activePanel:t,activeId:i,ctx:s,theaterId:a,hasHydratedPathContext:d,isPathContextDeckOpen:f,pathContextLoading:c,pathContextMutationInProgress:h,pathContextError:p,onSelectPathContext:g}){const m=L.useRef(null),S=L.useRef(null),w=L.useRef(!1),T=t.pathAware===!0,C=L.useSyncExternalStore(bw,()=>pc().theaters.find(y=>y.id===a)?.label??"Theater"),_=BL(T,a,d);L.useEffect(()=>{if(w.current&&!f){const y=requestAnimationFrame(()=>m.current?.focus());return w.current=f,()=>cancelAnimationFrame(y)}w.current=f},[f]),L.useEffect(()=>{if(!f)return;const y=k=>{const M=k.target;!(M instanceof Node)||m.current?.contains(M)||S.current?.contains(M)||bh(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[f]);const b=L.useCallback(()=>bh(!1),[]),v=L.useCallback(y=>{g(y)},[g]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"right-rail-panel-head",children:[T?l.jsxs("button",{ref:m,className:`rail-context-title-trigger${f?" is-open":""}`,type:"button",disabled:!d||c||h,"aria-expanded":f,"aria-haspopup":"dialog",title:p??t.title,onClick:()=>bh(!f),children:[l.jsx("span",{className:"rail-context-title-text",children:t.title}),l.jsx("span",{className:"rail-context-label",title:a===null?"Theater-wide":d?s.pathContext.label:"Loading…",children:a===null?"Theater-wide":d?s.pathContext.label:"Loading…"}),l.jsx("span",{className:"rail-context-title-caret","aria-hidden":"true",children:"⌄"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"right-rail-panel-title",children:t.title}),l.jsx("span",{className:"rail-context-label",children:"Theater-wide"})]}),l.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:zL,children:"✕"}),T&&d&&f&&a?l.jsx(Bw,{ref:S,theaterId:a,theaterLabel:C,context:s.pathContext,isMutating:h,onSelect:v,onClose:b}):null]}),l.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:_?t.render(s):l.jsx("div",{className:"rail-context-tree-status",children:"Loading path context…"})})]})});function Mx({panel:e,isActive:t}){const i=L.useCallback(()=>PL(e.id),[e.id]),s=typeof e.icon=="function"?e.icon():e.icon;return l.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:i,children:s})}const v$='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function b$(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:i}=hr(),s=L.useRef(null),a=L.useRef(null),d=L.useRef(null),f=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.id??""}`:null,c=e!==null&&t,h=L.useCallback(()=>{$H(),P3()},[]);return L.useEffect(()=>{if(!c)return;const p=e;document.body.setAttribute("data-codex-reading","true");const g=document.querySelector(".operations-canvas"),m=document.querySelector(".operations-side-bar");g?.setAttribute("inert",""),m?.setAttribute("inert","");const S=w=>{if(w.key==="Escape"){w.preventDefault(),w.stopPropagation(),h();return}w.key==="Tab"&&y$(s.current,w)};return window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0),document.body.removeAttribute("data-codex-reading"),g?.removeAttribute("inert"),m?.removeAttribute("inert");const w=p?.kind==="entry"?p.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(w?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${w}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[c]),L.useEffect(()=>{if(!c||!a.current||!d.current||!e)return;const p=e.kind,g=p==="drydock"?e.patchId:p==="conflicts"?e.id:void 0;l5(a.current,d.current,{initialEntryId:p==="entry"?e.entryId:"",kind:p,subId:g,theaterId:i,onRelatedClick:m=>{Gr({kind:"entry",entryId:m}),vh()},onClose:h,onPatchOpen:m=>{Gr({kind:"drydock",patchId:m}),vh()},onDecided:()=>{sd(),Gr({kind:"drydock",patchId:void 0}),vh()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[c,f]),c?js.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"codex-reading-scrim",onClick:h,"aria-hidden":"true"}),l.jsxs("div",{ref:s,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[l.jsxs("div",{className:"codex-reading-sheet-head",children:[l.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),l.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:h,children:"✕"})]}),l.jsxs("div",{className:"codex-reading-sheet-body",children:[l.jsx("div",{ref:a,className:"codex-reading-sheet-read"}),l.jsx("aside",{ref:d,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function y$(e,t){if(!e)return;const i=[...e.querySelectorAll(v$)].filter(d=>!d.closest("[inert]"));if(i.length===0)return;const s=i[0],a=i[i.length-1];t.shiftKey?document.activeElement===s&&(t.preventDefault(),a.focus()):document.activeElement===a&&(t.preventDefault(),s.focus())}const S$=Cd().api,Vg=560,Yg=360,jm=new Set;function x$({state:e,claimBootPanelMinimization:t}){const i=L.useRef(null),s=aE(),a=F_(),d=oE(),f=Io(),[c,h]=L.useState([]),p=L.useMemo(()=>w$(e).map(G=>G.id),[e.operations,e.activeTheaterId]),g=L.useRef(e);g.current=e;const m=L.useCallback(()=>{nd()},[]);L.useEffect(()=>{EB(e.activeTheaterId)},[e.activeTheaterId]),L.useEffect(()=>{if(!e.activeTheaterId){h([]);return}Bx().then(h).catch(()=>{})},[e.activeTheaterId]),L.useEffect(()=>{const G={current:s},P={current:a},K=V=>{if(!nL()||!V.altKey||V.metaKey||V.ctrlKey)return;const O=document.activeElement;if(O instanceof HTMLElement&&O.matches("input, textarea, [contenteditable='true']")&&!O.closest(".xterm"))return;if(V.code==="KeyF"){V.preventDefault(),V.stopImmediatePropagation(),nd({restoreMinimized:V.shiftKey});return}if(V.shiftKey||V.key!=="ArrowLeft"&&V.key!=="ArrowRight")return;const z=g.current,j=Ao(),W=ww(z.operations.filter(te=>te.theaterId===z.activeTheaterId),z.groups.filter(te=>te.theaterId===z.activeTheaterId),j.operationOrder,j.collapsedGroups).map(te=>te.id);if(W.length===0)return;V.preventDefault(),V.stopImmediatePropagation();const Z=G.current??g.current.activeOperationId,ne=I3(W,Z,V.key==="ArrowRight"?1:-1);if(ne){if(P.current){dh(ne),gi(ne);return}if(G.current){gi(ne),cc(ne);return}mc(ne)}};return window.addEventListener("keydown",K,!0),()=>window.removeEventListener("keydown",K,!0)},[a,m,s]),L.useEffect(()=>{for(const K of p)wB(K);if(!e.operationsHydrated||(CB(p),!e.activeTheaterId))return;const G=t(e.activeTheaterId);if(G===null)return;const P=g.current.pendingOperationFocus;xB(P?G.filter(K=>K!==P):G)},[t,p,e.activeTheaterId,e.operationsHydrated]),L.useEffect(()=>{const G=e.pendingOperationFocus;if(G===null)return;if(a){dh(G),gi(G),Pp();return}if(Lg()!==null){cc(G),Pp();return}Ds();const P=Nx(i.current);P&&ex(G,P),Pp()},[a,e.pendingOperationFocus]);const S=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(G=>G.theaterId===e.activeTheaterId);const w=L.useCallback((G,P)=>f.plugins.find(V=>V.id===G)?.renderLaunchIcon?.(P)??null,[f.plugins]),T=L.useCallback((G,P,K)=>{if(!g.current.activeTheaterId)return;const V={...Ox(K),zIndex:_a()};Im(G,P,V,g.current.activeTheaterId,f.plugins)},[f.plugins]),C=L.useCallback((G,P)=>{if(!g.current.activeTheaterId)return;const K=E$(i.current),V={...Ox(K),zIndex:_a()};Im(G,P,V,g.current.activeTheaterId,f.plugins)},[f.plugins]),_=L.useCallback((G,P,K)=>{g.current.activeTheaterId&&Im(G,P,K,g.current.activeTheaterId,f.plugins)},[f.plugins]),b=L.useCallback(()=>{lE({x:0,y:0,zoom:1})},[]),v=L.useCallback(G=>{const P=g.current.operations.find(j=>j.id===G);if(!P)return;if(P.theaterId!==g.current.activeTheaterId){mc(G);return}if(Mg()){dh(G),gi(G);return}const K=Lg();if(K!==null&&K!==G){gi(G),cc(G);return}const V=Ao(),O=V.operations[G]??P.geometry??C$(P);V.operations[G]||Og(G,O),dh(G),gi(G);const z=Nx(i.current);z&&ex(G,z)},[]),y=L.useCallback(G=>{g.current.activeOperationId===G&&gi(null),cE(G)},[]),k=L.useCallback((G,P)=>{_h(G,{accent:P}).then(()=>_i(null)).then(Ni).catch(()=>{})},[]),M=L.useCallback((G,P)=>{cw(G,P).then(()=>_i(null)).then(Ni).catch(()=>{})},[]),R=L.useCallback((G,P)=>{_h(G,{groupId:P}).then(()=>_i(null)).then(Ni).catch(()=>{})},[]),N=L.useCallback((G,P,K)=>{WR({theaterId:G,name:P,color:"blue"}).then(V=>K?_h(K,{groupId:V.id}).then(()=>{}):void 0).then(()=>Promise.all([_i(null).then(Ni),ia().then(ra)])).catch(()=>{})},[]),A=L.useCallback((G,P)=>{P&&Bp(G,{color:P}).then(()=>ia()).then(ra).catch(()=>{})},[]),I=L.useCallback((G,P)=>{Bp(G,{name:P}).then(()=>ia()).then(ra).catch(()=>{})},[]),$=L.useCallback(G=>{const P=new Map(g.current.groups.map(V=>[V.id,V])),K=G.flatMap((V,O)=>{const z=P.get(V);return!z||z.order===O?[]:[Bp(V,{order:O})]});K.length!==0&&Promise.allSettled(K).then(()=>ia()).then(ra).catch(()=>{})},[]),H=L.useCallback(G=>{GR(G).then(()=>Promise.all([_i(null).then(Ni),ia().then(ra)])).catch(()=>{})},[]),q=L.useCallback(G=>{if(jm.has(G))return;jm.add(G);const P=g.current.operations.find(V=>V.id===G)?.pluginId,K=(P?f.plugins.find(V=>V.id===P):null)??null;k$(G,K).finally(()=>jm.delete(G))},[f.plugins]),B=L.useCallback(async G=>{Sw();try{const P=await lw(G),K=await ow(P);xw(K)}catch(P){qm(P instanceof Error?P.message:String(P))}},[]),Y=L.useCallback(async G=>{const P=()=>Promise.all([_i(null).then(Ni),ia().then(ra)]).then(()=>{}).catch(()=>{});try{await UR(G),t1(G),await P()}catch(K){if(K instanceof dt&&K.status===404){t1(G),await P();return}qm(K instanceof Error?K.message:String(K))}},[]);return l.jsxs("div",{className:"console-body is-canvas",children:[l.jsx(p9,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:d,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:c,canLaunch:S,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:w,onLaunchKind:C,onResetView:b,onClose:q,onMinimize:y,onFocus:v,onSetAccent:k,onRename:M,onSetGroupId:R,onCreateGroup:N,onSetGroupColor:A,onRenameGroup:I,onReorderGroups:$,onUngroupAll:H,onSelectTheater:N3,onAddTheater:B,onCancelAddTheater:j3,onForgetTheater:Y}),l.jsx("div",{className:"operations-center-stage",ref:i,children:l.jsx($z,{state:e,catalog:c,canLaunch:S,renderKindIcon:w,onLaunchKind:T,onLaunchAtGeometry:_,onResetView:b,onToggleFormation:m,onClose:q,onFocus:v,onRename:M,onSetAccent:k})}),l.jsx(g$,{theaterId:e.activeTheaterId,api:S$}),l.jsx(b$,{})]})}function w$(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(Km)}function Nx(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function C$(e){return e.geometry??{x:0,y:0,width:Vg,height:Yg,zIndex:0}}function E$(e){const t=Ao(),i=e?.clientWidth??800,s=e?.clientHeight??600;return kc({x:i/2,y:s/2},t.viewport)}function Ox(e){return{x:e.x-Vg/2,y:e.y-Yg/2,width:Vg,height:Yg}}async function Im(e,t,i,s,a){const d=a.find(m=>m.id===e),c=Cd(()=>{_i(null).then(Ni).catch(()=>{})});let h=null;if(d?.launch?h=(await d.launch({theaterId:s,kind:t,geometry:i,operations:c.operations})).id:h=(await c.operations.create({theaterId:s,type:t.type,pluginId:e,title:t.title,geometry:i})).id,await _i(null).then(Ni).catch(()=>{}),!h)return;const p=vB()===s,g=pc().operations.some(m=>m.id===h);p&&g&&Lg()!==null?(gi(h),cc(h)):mc(h)}async function k$(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await _i(null).then(Ni).catch(()=>{})}const T$=3e4;let ph=1e3,ql=null,Bm=null,Pm=!1;function p5(){ql!==null&&(clearTimeout(ql),ql=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const i=t;try{const s=JSON.parse(i.data);A$(s.operation)&&M3(s.operation)}catch{}}),e.addEventListener("update:available",()=>{Ac()}),e.onopen=()=>{ph=1e3,Ac()},e.onerror=()=>{e.close(),ql=setTimeout(()=>{ql=null,ph=Math.min(ph*2,T$),_i().then(Ni).catch(()=>{}).finally(p5)},ph)}}function Ac(){if(Bm){Pm=!0;return}Bm=BR(pc().activeTheaterId).then(S3).catch(()=>{}).finally(()=>{Bm=null,Pm&&(Pm=!1,Ac())})}function A$(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const R$=6e3;function Dx(){return document.querySelector('[aria-modal="true"]:not([hidden])')!==null}function L$(){const e=hr(),t=L.useRef(new Set),i=L.useRef(null),s=ur(),a=Io(),d=Z_(),f=BE(d.state?.language??"auto"),h=s.pathname.startsWith("/operations"),p=L.useCallback(g=>i.current===null||t.current.has(g)?null:(t.current.add(g),i.current),[]);return L.useEffect(()=>{const g=Cd(()=>{_i().then(Ni).catch(()=>{})}),m=a.plugins.map(S=>S.install?.(g)).filter(S=>typeof S=="function");return()=>{for(const S of m)S()}},[a.plugins]),L.useEffect(()=>{y3(h)},[h]),L.useEffect(()=>{const g=new AbortController;IR(g.signal).then(w=>{R3(w),e1()}).catch(w=>{g.signal.aborted||(rt({theaterError:w instanceof Error?w.message:String(w)}),e1())});const m=Date.now();_i(null,g.signal).then(w=>{i.current=w.filter(T=>T.ts.createdAt<m).map(T=>T.id),L3(w)}).catch(()=>{}),ia(null,g.signal).then(ra).catch(()=>{}),Ac();const S=window.setTimeout(Ac,R$);return()=>{window.clearTimeout(S),g.abort()}},[]),L.useEffect(()=>(IE({locale:f}),q9),[f]),L.useEffect(()=>{const g=m=>{if(!Lw()){if((m.metaKey||m.ctrlKey)&&m.key.toLowerCase()==="k"){m.preventDefault(),m.stopImmediatePropagation(),Cw();return}if((m.metaKey||m.ctrlKey)&&m.code==="KeyB"&&m.altKey&&!m.shiftKey&&(m.metaKey||m.key.toLowerCase()==="b")&&!Dx()){m.preventDefault(),m.stopImmediatePropagation(),zw();return}(m.metaKey||m.ctrlKey)&&m.code==="KeyB"&&!m.altKey&&!m.shiftKey&&!Dx()&&(m.preventDefault(),m.stopImmediatePropagation(),Y_(!Bg().collapsed))}};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[]),l.jsxs("div",{className:"console-shell",children:[l.jsx(E9,{operationsViewVisible:h}),l.jsx("main",{className:"console-route-content",children:l.jsxs(tR,{children:[l.jsx(so,{path:"/",element:l.jsx(Vy,{to:"/operations",replace:!0})}),l.jsx(so,{path:"/operations",element:l.jsx(x$,{state:e,claimBootPanelMinimization:p})}),l.jsx(so,{path:"/carrier-settings",element:l.jsx(TP,{})}),l.jsx(so,{path:"/settings",element:l.jsx(iz,{})}),l.jsx(so,{path:"*",element:l.jsx(Vy,{to:"/operations",replace:!0})})]})}),l.jsx(O9,{state:e}),l.jsx(eP,{state:e}),l.jsx(L9,{state:e}),l.jsx(z9,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Mh,"react/jsx-runtime":yT,"@fleet-console/sdk/plugin/browser":HT,"@fleet-console/sdk/settings/browser":KT,"@fleet-console/sdk/operations/browser":AT,"@fleet-console/sdk/notifications/browser":YT,"@fleet-console/sdk/react/browser":ZT};Bh("instrument");k3();try{const e=await NE();Bh(e.theme),Gm(e.uiFont),U9(e)}catch{}const M$=await BI();p5();const jx=document.querySelector("#app");jx&&iA.createRoot(jx).render(l.jsx(L.StrictMode,{children:l.jsx(ER,{basename:"/console",children:l.jsx(II,{value:M$,children:l.jsx(L$,{})})})}));export{Qj as _,N$ as a,Xg as g,Nt as k,oc as p};