@dotobokuri/fleet-console 1.32.0 → 1.33.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 (62) hide show
  1. package/dist/cli.mjs +25 -18
  2. package/dist/client/assets/{_baseUniq-BcB5wmG1.js → _baseUniq-DGGrBWAb.js} +1 -1
  3. package/dist/client/assets/{arc-DdDM-o2K.js → arc-BNCMUJG_.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-Q4EWVU46-CIF7NLBh.js → architectureDiagram-Q4EWVU46-C7qQq1FU.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-DXYQGD6D-uTDIsi9C.js → blockDiagram-DXYQGD6D-Cd8j3SNd.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AHTNJAMY-B-L5_peH.js → c4Diagram-AHTNJAMY-fFAORcJP.js} +1 -1
  7. package/dist/client/assets/channel-BDofRchL.js +1 -0
  8. package/dist/client/assets/{chunk-4BX2VUAB-R3NuBeMM.js → chunk-4BX2VUAB-peomhKWw.js} +1 -1
  9. package/dist/client/assets/{chunk-4TB4RGXK-GqEsM9Hl.js → chunk-4TB4RGXK-TEb8s6Dl.js} +1 -1
  10. package/dist/client/assets/{chunk-55IACEB6-D4a7-QMt.js → chunk-55IACEB6-11aKxGwZ.js} +1 -1
  11. package/dist/client/assets/{chunk-EDXVE4YY-CFnwIApt.js → chunk-EDXVE4YY-CPeOY-w0.js} +1 -1
  12. package/dist/client/assets/{chunk-FMBD7UC4-Bx6k_N10.js → chunk-FMBD7UC4-DpbKBDUG.js} +1 -1
  13. package/dist/client/assets/{chunk-OYMX7WX6-2QjCvEfI.js → chunk-OYMX7WX6-DQiIenR8.js} +1 -1
  14. package/dist/client/assets/{chunk-QZHKN3VN-SRIQm3h2.js → chunk-QZHKN3VN-ByEBhAst.js} +1 -1
  15. package/dist/client/assets/{chunk-YZCP3GAM-D3j-Ehhn.js → chunk-YZCP3GAM-Ca8uNdzu.js} +1 -1
  16. package/dist/client/assets/classDiagram-6PBFFD2Q-BrRbVOSf.js +1 -0
  17. package/dist/client/assets/classDiagram-v2-HSJHXN6E-BrRbVOSf.js +1 -0
  18. package/dist/client/assets/clone-CEWs7Jhj.js +1 -0
  19. package/dist/client/assets/{cose-bilkent-S5V4N54A-BDRpmFTS.js → cose-bilkent-S5V4N54A-B9r4jGi9.js} +1 -1
  20. package/dist/client/assets/{dagre-KV5264BT-CNnBa0oO.js → dagre-KV5264BT-Csnn3Aws.js} +1 -1
  21. package/dist/client/assets/{diagram-5BDNPKRD-DmLR5VLJ.js → diagram-5BDNPKRD-xgvBmNve.js} +1 -1
  22. package/dist/client/assets/{diagram-G4DWMVQ6-D9-S4gAC.js → diagram-G4DWMVQ6-eDo2cgdI.js} +1 -1
  23. package/dist/client/assets/{diagram-MMDJMWI5-BgkkFSRH.js → diagram-MMDJMWI5-C3GDlrcv.js} +1 -1
  24. package/dist/client/assets/{diagram-TYMM5635-CRwM_tDY.js → diagram-TYMM5635-BDyVzMHP.js} +1 -1
  25. package/dist/client/assets/{erDiagram-SMLLAGMA-DU-pow1m.js → erDiagram-SMLLAGMA-YegVvYsw.js} +1 -1
  26. package/dist/client/assets/{flowDiagram-DWJPFMVM-B91EFbjc.js → flowDiagram-DWJPFMVM-zcVenDmh.js} +1 -1
  27. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-B-gUVWSs.js → ganttDiagram-T4ZO3ILL-CkMabQtg.js} +1 -1
  28. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-TBkviHit.js → gitGraphDiagram-UUTBAWPF-CuD1D5LQ.js} +1 -1
  29. package/dist/client/assets/{graph-Da2r3MMt.js → graph-DvVj819O.js} +1 -1
  30. package/dist/client/assets/index-DeA0aGZd.css +1 -0
  31. package/dist/client/assets/index-Dk_jqw8o.js +451 -0
  32. package/dist/client/assets/{infoDiagram-42DDH7IO-CAdIgU9C.js → infoDiagram-42DDH7IO-DPoWXM0E.js} +1 -1
  33. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DKMRplux.js → ishikawaDiagram-UXIWVN3A-BBoXoRxo.js} +1 -1
  34. package/dist/client/assets/{journeyDiagram-VCZTEJTY-CPR33z10.js → journeyDiagram-VCZTEJTY-B-IoiUw0.js} +1 -1
  35. package/dist/client/assets/{kanban-definition-6JOO6SKY-CDsviLfH.js → kanban-definition-6JOO6SKY-BcjjEa8G.js} +1 -1
  36. package/dist/client/assets/{layout-CkN1-8C9.js → layout-BjaFRuOv.js} +1 -1
  37. package/dist/client/assets/{linear-BxLFCpuS.js → linear-DLVG-hZ_.js} +1 -1
  38. package/dist/client/assets/{mermaid.core-DA-WJY50.js → mermaid.core-6fYEjApv.js} +4 -4
  39. package/dist/client/assets/{min-BsISxNaF.js → min-BfgBrJLR.js} +1 -1
  40. package/dist/client/assets/{mindmap-definition-QFDTVHPH-B-IUTdhh.js → mindmap-definition-QFDTVHPH-BjelYLWH.js} +1 -1
  41. package/dist/client/assets/{pieDiagram-DEJITSTG-hwSroJDA.js → pieDiagram-DEJITSTG-BznY8oUt.js} +1 -1
  42. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-DDt9AzF7.js → quadrantDiagram-34T5L4WZ-jEnKUROj.js} +1 -1
  43. package/dist/client/assets/{requirementDiagram-MS252O5E-C5Xj9gqW.js → requirementDiagram-MS252O5E-BuQqQSjX.js} +1 -1
  44. package/dist/client/assets/{sankeyDiagram-XADWPNL6-ZwBDrthi.js → sankeyDiagram-XADWPNL6-B9g8trZW.js} +1 -1
  45. package/dist/client/assets/{sequenceDiagram-FGHM5R23-DmyMDdrv.js → sequenceDiagram-FGHM5R23-V6Zwufo5.js} +1 -1
  46. package/dist/client/assets/{stateDiagram-FHFEXIEX-VD5zvoai.js → stateDiagram-FHFEXIEX-8E2cIHyh.js} +1 -1
  47. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-0HROefWC.js +1 -0
  48. package/dist/client/assets/{timeline-definition-GMOUNBTQ-DP8udMAZ.js → timeline-definition-GMOUNBTQ-DpiM_Ig9.js} +1 -1
  49. package/dist/client/assets/{vennDiagram-DHZGUBPP-CiBN7TbR.js → vennDiagram-DHZGUBPP-D975VPJg.js} +1 -1
  50. package/dist/client/assets/{wardley-RL74JXVD-BtqeTzop.js → wardley-RL74JXVD-BiM6uI8Z.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-DaRdj2RP.js → wardleyDiagram-NUSXRM2D-IoXxaljw.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-5P7HB3ND-jlgNCyFB.js → xychartDiagram-5P7HB3ND-BqNE-iqW.js} +1 -1
  53. package/dist/client/index.html +2 -2
  54. package/dist/fleet-plugins/terminal/routes.mjs +120 -136
  55. package/package.json +1 -1
  56. package/dist/client/assets/channel-BamKwHPs.js +0 -1
  57. package/dist/client/assets/classDiagram-6PBFFD2Q-sEh9Glhk.js +0 -1
  58. package/dist/client/assets/classDiagram-v2-HSJHXN6E-sEh9Glhk.js +0 -1
  59. package/dist/client/assets/clone-iMU-qXwc.js +0 -1
  60. package/dist/client/assets/index-5-y-ZMI6.js +0 -451
  61. package/dist/client/assets/index-BBOlVlPk.css +0 -1
  62. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CFTLlJ0p.js +0 -1
@@ -0,0 +1,451 @@
1
+ function J5(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function g0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function One(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var x_={exports:{}},wu={};var LC;function A4(){if(LC)return wu;LC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var u=null;if(o!==void 0&&(u=""+o),r.key!==void 0&&(u=""+r.key),"key"in r){o={};for(var h in r)h!=="key"&&(o[h]=r[h])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:u,ref:r!==void 0?r:null,props:o}}return wu.Fragment=t,wu.jsx=n,wu.jsxs=n,wu}var MC;function R4(){return MC||(MC=1,x_.exports=A4()),x_.exports}var c=R4();const N4=g0(c),L4=J5({__proto__:null,default:N4},[c]);var C_={exports:{}},mt={};var jC;function M4(){if(jC)return mt;jC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),b=Symbol.iterator;function S(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function D(L,q,H){this.props=L,this.context=q,this.refs=C,this.updater=H||w}D.prototype.isReactComponent={},D.prototype.setState=function(L,q){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,q,"setState")},D.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function z(){}z.prototype=D.prototype;function F(L,q,H){this.props=L,this.context=q,this.refs=C,this.updater=H||w}var N=F.prototype=new z;N.constructor=F,x(N,D.prototype),N.isPureReactComponent=!0;var I=Array.isArray;function j(){}var U={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function W(L,q,H){var ne=H.ref;return{$$typeof:e,type:L,key:q,ref:ne!==void 0?ne:null,props:H}}function Z(L,q){return W(L.type,q,L.props)}function V(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function O(L){var q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(H){return q[H]})}var A=/\/+/g;function B(L,q){return typeof L=="object"&&L!==null&&L.key!=null?O(""+L.key):q.toString(36)}function M(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(j,j):(L.status="pending",L.then(function(q){L.status==="pending"&&(L.status="fulfilled",L.value=q)},function(q){L.status==="pending"&&(L.status="rejected",L.reason=q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function k(L,q,H,ne,oe){var Se=typeof L;(Se==="undefined"||Se==="boolean")&&(L=null);var xe=!1;if(L===null)xe=!0;else switch(Se){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(L.$$typeof){case e:case t:xe=!0;break;case m:return xe=L._init,k(xe(L._payload),q,H,ne,oe)}}if(xe)return oe=oe(L),xe=ne===""?"."+B(L,0):ne,I(oe)?(H="",xe!=null&&(H=xe.replace(A,"$&/")+"/"),k(oe,q,H,"",function(rt){return rt})):oe!=null&&(V(oe)&&(oe=Z(oe,H+(oe.key==null||L&&L.key===oe.key?"":(""+oe.key).replace(A,"$&/")+"/")+xe)),q.push(oe)),1;xe=0;var fe=ne===""?".":ne+":";if(I(L))for(var De=0;De<L.length;De++)ne=L[De],Se=fe+B(ne,De),xe+=k(ne,q,H,Se,oe);else if(De=S(L),typeof De=="function")for(L=De.call(L),De=0;!(ne=L.next()).done;)ne=ne.value,Se=fe+B(ne,De++),xe+=k(ne,q,H,Se,oe);else if(Se==="object"){if(typeof L.then=="function")return k(M(L),q,H,ne,oe);throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return xe}function T(L,q,H){if(L==null)return L;var ne=[],oe=0;return k(L,ne,"","",function(Se){return q.call(H,Se,oe++)}),ne}function R(L){if(L._status===-1){var q=L._result;q=q(),q.then(function(H){(L._status===0||L._status===-1)&&(L._status=1,L._result=H)},function(H){(L._status===0||L._status===-1)&&(L._status=2,L._result=H)}),L._status===-1&&(L._status=0,L._result=q)}if(L._status===1)return L._result.default;throw L._result}var $=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},K={map:T,forEach:function(L,q,H){T(L,function(){q.apply(this,arguments)},H)},count:function(L){var q=0;return T(L,function(){q++}),q},toArray:function(L){return T(L,function(q){return q})||[]},only:function(L){if(!V(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return mt.Activity=_,mt.Children=K,mt.Component=D,mt.Fragment=n,mt.Profiler=r,mt.PureComponent=F,mt.StrictMode=i,mt.Suspense=p,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,mt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return U.H.useMemoCache(L)}},mt.cache=function(L){return function(){return L.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(L,q,H){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ne=x({},L.props),oe=L.key;if(q!=null)for(Se in q.key!==void 0&&(oe=""+q.key),q)!G.call(q,Se)||Se==="key"||Se==="__self"||Se==="__source"||Se==="ref"&&q.ref===void 0||(ne[Se]=q[Se]);var Se=arguments.length-2;if(Se===1)ne.children=H;else if(1<Se){for(var xe=Array(Se),fe=0;fe<Se;fe++)xe[fe]=arguments[fe+2];ne.children=xe}return W(L.type,oe,ne)},mt.createContext=function(L){return L={$$typeof:u,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:o,_context:L},L},mt.createElement=function(L,q,H){var ne,oe={},Se=null;if(q!=null)for(ne in q.key!==void 0&&(Se=""+q.key),q)G.call(q,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(oe[ne]=q[ne]);var xe=arguments.length-2;if(xe===1)oe.children=H;else if(1<xe){for(var fe=Array(xe),De=0;De<xe;De++)fe[De]=arguments[De+2];oe.children=fe}if(L&&L.defaultProps)for(ne in xe=L.defaultProps,xe)oe[ne]===void 0&&(oe[ne]=xe[ne]);return W(L,Se,oe)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(L){return{$$typeof:h,render:L}},mt.isValidElement=V,mt.lazy=function(L){return{$$typeof:m,_payload:{_status:-1,_result:L},_init:R}},mt.memo=function(L,q){return{$$typeof:f,type:L,compare:q===void 0?null:q}},mt.startTransition=function(L){var q=U.T,H={};U.T=H;try{var ne=L(),oe=U.S;oe!==null&&oe(H,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(j,$)}catch(Se){$(Se)}finally{q!==null&&H.types!==null&&(q.types=H.types),U.T=q}},mt.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},mt.use=function(L){return U.H.use(L)},mt.useActionState=function(L,q,H){return U.H.useActionState(L,q,H)},mt.useCallback=function(L,q){return U.H.useCallback(L,q)},mt.useContext=function(L){return U.H.useContext(L)},mt.useDebugValue=function(){},mt.useDeferredValue=function(L,q){return U.H.useDeferredValue(L,q)},mt.useEffect=function(L,q){return U.H.useEffect(L,q)},mt.useEffectEvent=function(L){return U.H.useEffectEvent(L)},mt.useId=function(){return U.H.useId()},mt.useImperativeHandle=function(L,q,H){return U.H.useImperativeHandle(L,q,H)},mt.useInsertionEffect=function(L,q){return U.H.useInsertionEffect(L,q)},mt.useLayoutEffect=function(L,q){return U.H.useLayoutEffect(L,q)},mt.useMemo=function(L,q){return U.H.useMemo(L,q)},mt.useOptimistic=function(L,q){return U.H.useOptimistic(L,q)},mt.useReducer=function(L,q,H){return U.H.useReducer(L,q,H)},mt.useRef=function(L){return U.H.useRef(L)},mt.useState=function(L){return U.H.useState(L)},mt.useSyncExternalStore=function(L,q,H){return U.H.useSyncExternalStore(L,q,H)},mt.useTransition=function(){return U.H.useTransition()},mt.version="19.2.7",mt}var OC;function _0(){return OC||(OC=1,C_.exports=M4()),C_.exports}var v=_0();const j4=g0(v),ap=J5({__proto__:null,default:j4},[v]),O4="fc-operation-body";let Ai=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function Q5(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Ai(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(I4).filter(i=>i!==null):[]}function op(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)||eT(t))throw new Ai(500,"Invalid operation response");return t}function eT(e){return sy(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function D4({children:e,className:t}){return c.jsx("div",{className:P4(O4,t),children:e})}function I4(e){if(!tT(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(B4).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function B4(e){return!tT(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 tT(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sy(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>sy(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||sy(i,t))}function P4(...e){return e.filter(t=>!!t).join(" ")}const $4=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Ai,OperationBody:D4,assertOperationNode:op,fetchOperationCatalog:Q5,hasForbiddenBrowserPayloadKey:eT},Symbol.toStringTag,{value:"Module"}));function z4(e){return e}function H4(e){return e}function nT(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(k_(n,i),r).then(K4),subscribe:(n,i,r)=>{const o=new EventSource(k_(n,i));o.onmessage=r;const u=()=>o.close();return t.add(u),()=>{u(),t.delete(u)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,r,o)=>{const u=await fetch(k_(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!u.ok)throw new Ai(u.status,`Terminal ticket request failed: ${u.status}`);const h=await u.json();if(typeof h.ticket!="string"||typeof h.ttlMs!="number")throw new Ai(u.status,"Invalid terminal ticket response");return{ticket:h.ticket,ttlMs:h.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async n=>{const i=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Ai(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return op(r.operation)},rename:async(n,i)=>{const r=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!r.ok)throw new Ai(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return op(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Ai(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>Y4(n,i),write:(n,i)=>X4(n,i)},settings:{read:async n=>{const i=await fetch(DC(n));if(!i.ok)throw new Ai(i.status,`Plugin settings read failed: ${i.status}`);const o=(await i.json()).value;return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null},write:async(n,i)=>{const r=await fetch(DC(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Ai(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function iT(e,t){return v.useSyncExternalStore(e,t,t)}function F4(){const[e,t]=v.useState([]),n=v.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new Ai(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(op):[])},[]);return v.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function U4(e,t){return v.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function W4(e,t){return v.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function q4(e,t,n){const[i,r]=v.useState(()=>e.read(t,n)),o=v.useCallback(u=>{r(u),e.write(t,u)},[e,t]);return[i,o]}function G4(e,t){return v.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function K4(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Ai(e.status,`Plugin request failed: ${e.status}`,t)}return e}function k_(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Ai(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Ai(400,"Invalid plugin path");return`/plugins/${e}${n}`}const V4=/^[a-z0-9][a-z0-9._-]*$/;function DC(e){if(!V4.test(e))throw new Ai(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function Y4(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(`fleet-plugin.${e}`);return n===null?t:JSON.parse(n)}catch{return t}}function X4(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const Z4=Object.freeze(Object.defineProperty({__proto__:null,React:ap,createClientCapabilities:nT,defineOperationKind:H4,definePlugin:z4,useOperationStatus:G4,useOperations:F4,usePluginApi:U4,usePluginSettings:W4,usePluginStorage:q4,useStoreSnapshot:iT},Symbol.toStringTag,{value:"Module"}));var E_={exports:{}},Ei={};var IC;function J4(){if(IC)return Ei;IC=1;var e=_0();function t(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)f+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(p,f,m){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:_==null?null:""+_,children:p,containerInfo:f,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Ei.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ei.createPortal=function(p,f){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(p,f,null,m)},Ei.flushSync=function(p){var f=u.T,m=i.p;try{if(u.T=null,i.p=2,p)return p()}finally{u.T=f,i.p=m,i.d.f()}},Ei.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(p,f))},Ei.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},Ei.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var m=f.as,_=h(m,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;m==="style"?i.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:_,integrity:b,fetchPriority:S}):m==="script"&&i.d.X(p,{crossOrigin:_,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Ei.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var m=h(f.as,f.crossOrigin);i.d.M(p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(p)},Ei.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var m=f.as,_=h(m,f.crossOrigin);i.d.L(p,m,{crossOrigin:_,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Ei.preloadModule=function(p,f){if(typeof p=="string")if(f){var m=h(f.as,f.crossOrigin);i.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(p)},Ei.requestFormReset=function(p){i.d.r(p)},Ei.unstable_batchedUpdates=function(p,f){return p(f)},Ei.useFormState=function(p,f,m){return u.H.useFormState(p,f,m)},Ei.useFormStatus=function(){return u.H.useHostTransitionStatus()},Ei.version="19.2.7",Ei}var BC;function sT(){if(BC)return E_.exports;BC=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(),E_.exports=J4(),E_.exports}var aa=sT();const lp=6,Q4=232,ej=160,tj=8,nj=500;function ij(e,t,n){return Math.min(Math.max(e,t),n)}function sj(e){const t=[];for(let n=0;n<e.length;n+=1)e[n]?.disabled||t.push(n);return t}function rj(e,t,n){const i=Math.max(0,tj),r=Math.max(0,window.innerWidth),o=Math.max(0,window.innerHeight),u=Math.max(0,r-2*i),h=Math.max(0,e.width),p=Math.min(n?Math.max(ej,h):h,u),f=n?e.right-p:e.left,m=ij(f,i,Math.max(i,r-p-i));return t==="down"?{position:"fixed",left:m,width:p,top:Math.max(0,e.bottom+lp)}:{position:"fixed",left:m,width:p,bottom:Math.max(0,o-e.top+lp)}}function aj(e){const t=window.innerHeight-e.bottom-lp,n=e.top-lp;return t<Q4&&n>t?"up":"down"}function rT({value:e,options:t,onChange:n,disabled:i=!1,id:r,compact:o=!1}){const u=v.useId(),h=r??`fc-select-${u.replace(/:/g,"")}`,p=v.useMemo(()=>t.map((T,R)=>`${h}-option-${R}-${T.value}`),[h,t]),f=v.useRef(null),m=v.useRef(null),_=v.useRef(null),[b,S]=v.useState(!1),[w,x]=v.useState(-1),[C,D]=v.useState("down"),[z,F]=v.useState({}),N=v.useRef(""),I=v.useRef(void 0),j=v.useMemo(()=>sj(t),[t]),U=v.useCallback(()=>{N.current="",I.current!==void 0&&(clearTimeout(I.current),I.current=void 0)},[]),G=v.useCallback(()=>{S(!1),x(-1),U()},[U]),W=v.useCallback(T=>{n(T),G(),m.current?.focus()},[G,n]),Z=v.useCallback(()=>{const T=m.current;if(!T)return;const R=T.getBoundingClientRect(),$=aj(R);D($),F(rj(R,$,o))},[o]),V=v.useCallback((T=!0)=>{if(i||b)return;S(!0);const R=t.findIndex($=>$.value===e&&!$.disabled);T&&R>=0?x(R):x(j[0]??-1)},[i,j,b,t,e]),O=v.useCallback(T=>{if(!j.length)return;const R=j.indexOf(w),$=R>=0?R:T>0?-1:0,K=j[($+T+j.length)%j.length];K!==void 0&&x(K)},[w,j]);v.useLayoutEffect(()=>{if(b)return Z(),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0),()=>{window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}},[b,Z]),v.useEffect(()=>{if(!b)return;const T=$=>{const K=$.target;f.current?.contains(K)||_.current?.contains(K)||G()},R=$=>{if($.key==="Escape"){$.stopPropagation(),G(),m.current?.focus();return}if($.key==="Tab"){G();return}if($.key==="ArrowDown"){$.preventDefault(),O(1);return}if($.key==="ArrowUp"){$.preventDefault(),O(-1);return}if($.key==="Home"){$.preventDefault();const K=j[0];K!==void 0&&x(K);return}if($.key==="End"){$.preventDefault();const K=j.at(-1);K!==void 0&&x(K);return}if($.key==="Enter"||$.key===" "){$.preventDefault(),$.stopPropagation();const K=t[w];K&&!K.disabled&&W(K.value);return}if($.key.length===1&&/\S/u.test($.key)){N.current+=$.key.toLowerCase(),clearTimeout(I.current),I.current=setTimeout(()=>{N.current=""},nj);const K=N.current,L=j.map(q=>t[q]).find(q=>q?.label.toLowerCase().startsWith(K));if(L){const q=t.indexOf(L);q>=0&&x(q)}}};return document.addEventListener("pointerdown",T,!0),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",T,!0),document.removeEventListener("keydown",R,!0)}},[w,G,W,j,b,O,t]),v.useEffect(()=>()=>U(),[U]),v.useEffect(()=>{if(!b||w<0)return;const T=p[w];if(!T)return;document.getElementById(T)?.scrollIntoView?.({block:"nearest"})},[w,b,p]);const A=b&&w>=0?p[w]:void 0,B=v.useCallback(T=>{b||["ArrowDown","ArrowUp","Enter"," "].includes(T.key)&&(T.preventDefault(),V(T.key!=="ArrowDown"),T.key==="ArrowDown"&&O(1))},[b,O,V]),M=v.useCallback(()=>{i||(b?G():V(!0))},[G,i,b,V]),k=v.useCallback(T=>{const R=t[T];return{id:p[T]??`${h}-option-${T}`,role:"option",className:"fc-select__option","data-active":w===T?"true":"false","aria-selected":R?.value===e,"aria-disabled":R?.disabled?!0:void 0,onPointerEnter:()=>x(T),onClick:()=>{R&&!R.disabled&&W(R.value)}}},[w,W,h,p,t,e]);return{isOpen:b,activeOptionId:A,placement:C,rootRef:f,triggerRef:m,popupRef:_,listboxId:h,rootProps:{ref:f,className:"fc-select"},triggerProps:{ref:m,type:"button",role:"combobox",className:"fc-select__trigger",disabled:i,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":h,"aria-activedescendant":A,onClick:M,onKeyDown:B},listboxProps:{ref:_,id:h,role:"listbox",className:o?"fc-select__popup fc-select__popup--compact":"fc-select__popup","data-open":b?"true":"false","data-placement":C,style:z},getOptionProps:k}}function Ni({value:e,options:t,onChange:n,disabled:i=!1,compact:r=!1,className:o,id:u,label:h,"aria-labelledby":p}){const f=rT({value:e,options:t,onChange:n,disabled:i,id:u,compact:r}),m=t.find(S=>S.value===e),_=[f.rootProps.className,r?"fc-select--compact":"",o??""].filter(Boolean).join(" "),b=p?{"aria-labelledby":p}:h?{"aria-label":h}:{};return c.jsxs("div",{ref:f.rootRef,className:_,children:[c.jsxs("button",{...f.triggerProps,...b,children:[c.jsx("span",{className:"fc-select__value",children:m?.label??""}),c.jsx("span",{className:"fc-select__caret","aria-hidden":"true",children:"⌄"})]}),f.isOpen?aa.createPortal(c.jsx("ul",{...f.listboxProps,...b,children:t.map((S,w)=>c.jsx("li",{...f.getOptionProps(w),children:S.label},S.value))}),document.body):null]})}function oj(e){return e}function lj({title:e,description:t,children:n}){return c.jsxs("section",{className:"fc-settings-card",children:[e?c.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?c.jsx("p",{className:"fc-settings-card__desc",children:t}):null,c.jsx("div",{className:"fc-settings-card__body",children:n})]})}function cj({label:e,hint:t,children:n}){const i=v.useId(),r=v.useId();return c.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[c.jsxs("div",{className:"fc-settings-row__copy",children:[c.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-row__hint",id:r,children:t}):null]}),c.jsx("div",{className:"fc-settings-row__control",children:n})]})}function uj({checked:e,onChange:t,label:n,disabled:i=!1}){const r=v.useId();return c.jsxs("label",{className:"fc-settings-toggle",htmlFor:r,children:[c.jsx("input",{id:r,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:i,"aria-label":n?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),c.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?c.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function dj({value:e,options:t,onChange:n,label:i,disabled:r=!1}){const o=v.useId(),u=t.map(p=>({value:p.value,label:p.label})),h=c.jsx(Ni,{value:e,options:u,onChange:n,disabled:r,label:i?void 0:"Select setting","aria-labelledby":i?o:void 0});return i?c.jsxs("label",{className:"fc-settings-select",children:[c.jsx("span",{className:"fc-settings-select__label",id:o,children:i}),h]}):c.jsx("div",{className:"fc-settings-select",children:h})}function hj({label:e,hint:t,children:n}){const i=v.useId(),r=v.useId();return c.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[c.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-field__hint",id:r,children:t}):null,c.jsx("div",{className:"fc-settings-field__control",children:n})]})}const fj=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:lj,SettingsField:hj,SettingsRow:cj,SettingsSelect:dj,SettingsToggle:uj,defineSettingsSection:oj},Symbol.toStringTag,{value:"Module"}));function pj(e){return e}const mj=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:pj},Symbol.toStringTag,{value:"Module"})),gj=c.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class cp extends v.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??gj:this.props.children}}const _j=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:cp,React:ap,Select:Ni,default:ap,useSelect:rT},Symbol.toStringTag,{value:"Module"}));var T_={exports:{}},xu={},A_={exports:{}},R_={};var PC;function vj(){return PC||(PC=1,(function(e){function t(k,T){var R=k.length;k.push(T);e:for(;0<R;){var $=R-1>>>1,K=k[$];if(0<r(K,T))k[$]=T,k[R]=K,R=$;else break e}}function n(k){return k.length===0?null:k[0]}function i(k){if(k.length===0)return null;var T=k[0],R=k.pop();if(R!==T){k[0]=R;e:for(var $=0,K=k.length,L=K>>>1;$<L;){var q=2*($+1)-1,H=k[q],ne=q+1,oe=k[ne];if(0>r(H,R))ne<K&&0>r(oe,H)?(k[$]=oe,k[ne]=R,$=ne):(k[$]=H,k[q]=R,$=q);else if(ne<K&&0>r(oe,R))k[$]=oe,k[ne]=R,$=ne;else break e}}return T}function r(k,T){var R=k.sortIndex-T.sortIndex;return R!==0?R:k.id-T.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var p=[],f=[],m=1,_=null,b=3,S=!1,w=!1,x=!1,C=!1,D=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function N(k){for(var T=n(f);T!==null;){if(T.callback===null)i(f);else if(T.startTime<=k)i(f),T.sortIndex=T.expirationTime,t(p,T);else break;T=n(f)}}function I(k){if(x=!1,N(k),!w)if(n(p)!==null)w=!0,j||(j=!0,O());else{var T=n(f);T!==null&&M(I,T.startTime-k)}}var j=!1,U=-1,G=5,W=-1;function Z(){return C?!0:!(e.unstable_now()-W<G)}function V(){if(C=!1,j){var k=e.unstable_now();W=k;var T=!0;try{e:{w=!1,x&&(x=!1,z(U),U=-1),S=!0;var R=b;try{t:{for(N(k),_=n(p);_!==null&&!(_.expirationTime>k&&Z());){var $=_.callback;if(typeof $=="function"){_.callback=null,b=_.priorityLevel;var K=$(_.expirationTime<=k);if(k=e.unstable_now(),typeof K=="function"){_.callback=K,N(k),T=!0;break t}_===n(p)&&i(p),N(k)}else i(p);_=n(p)}if(_!==null)T=!0;else{var L=n(f);L!==null&&M(I,L.startTime-k),T=!1}}break e}finally{_=null,b=R,S=!1}T=void 0}}finally{T?O():j=!1}}}var O;if(typeof F=="function")O=function(){F(V)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,B=A.port2;A.port1.onmessage=V,O=function(){B.postMessage(null)}}else O=function(){D(V,0)};function M(k,T){U=D(function(){k(e.unstable_now())},T)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(k){switch(b){case 1:case 2:case 3:var T=3;break;default:T=b}var R=b;b=T;try{return k()}finally{b=R}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(k,T){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var R=b;b=k;try{return T()}finally{b=R}},e.unstable_scheduleCallback=function(k,T,R){var $=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?$+R:$):R=$,k){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=R+K,k={id:m++,callback:T,priorityLevel:k,startTime:R,expirationTime:K,sortIndex:-1},R>$?(k.sortIndex=R,t(f,k),n(p)===null&&k===n(f)&&(x?(z(U),U=-1):x=!0,M(I,R-$))):(k.sortIndex=K,t(p,k),w||S||(w=!0,j||(j=!0,O()))),k},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(k){var T=b;return function(){var R=b;b=T;try{return k.apply(this,arguments)}finally{b=R}}}})(R_)),R_}var $C;function yj(){return $C||($C=1,A_.exports=vj()),A_.exports}var zC;function bj(){if(zC)return xu;zC=1;var e=yj(),t=_0(),n=sT();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function u(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function p(s){if(o(s)!==s)throw Error(i(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(i(188));return a!==s?null:s}for(var l=s,d=a;;){var g=l.return;if(g===null)break;var y=g.alternate;if(y===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===y.child){for(y=g.child;y;){if(y===l)return p(g),s;if(y===d)return p(g),a;y=y.sibling}throw Error(i(188))}if(l.return!==d.return)l=g,d=y;else{for(var E=!1,P=g.child;P;){if(P===l){E=!0,l=g,d=y;break}if(P===d){E=!0,d=g,l=y;break}P=P.sibling}if(!E){for(P=y.child;P;){if(P===l){E=!0,l=y,d=g;break}if(P===d){E=!0,d=y,l=g;break}P=P.sibling}if(!E)throw Error(i(189))}}if(l.alternate!==d)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?s:a}function m(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=m(s),a!==null)return a;s=s.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),F=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function O(s){return s===null||typeof s!="object"?null:(s=V&&s[V]||s["@@iterator"],typeof s=="function"?s:null)}var A=Symbol.for("react.client.reference");function B(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===A?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case D:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case j:return"SuspenseList";case W:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case F:return s.displayName||"Context";case z:return(s._context.displayName||"Context")+".Consumer";case N:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case U:return a=s.displayName||null,a!==null?a:B(s.type)||"Memo";case G:a=s._payload,s=s._init;try{return B(s(a))}catch{}}return null}var M=Array.isArray,k=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},$=[],K=-1;function L(s){return{current:s}}function q(s){0>K||(s.current=$[K],$[K]=null,K--)}function H(s,a){K++,$[K]=s.current,s.current=a}var ne=L(null),oe=L(null),Se=L(null),xe=L(null);function fe(s,a){switch(H(Se,a),H(oe,s),H(ne,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?eC(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=eC(a),s=tC(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}q(ne),H(ne,s)}function De(){q(ne),q(oe),q(Se)}function rt(s){s.memoizedState!==null&&H(xe,s);var a=ne.current,l=tC(a,s.type);a!==l&&(H(oe,s),H(ne,l))}function Ie(s){oe.current===s&&(q(ne),q(oe)),xe.current===s&&(q(xe),vu._currentValue=R)}var Ce,Me;function je(s){if(Ce===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Ce=a&&a[1]||"",Me=-1<l.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Ce+s+Me}var ze=!1;function bt(s,a){if(!s||ze)return"";ze=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(he){var ce=he}Reflect.construct(s,[],ve)}else{try{ve.call()}catch(he){ce=he}s.call(ve.prototype)}}else{try{throw Error()}catch(he){ce=he}(ve=s())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(he){if(he&&ce&&typeof he.stack=="string")return[he.stack,ce.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),E=y[0],P=y[1];if(E&&P){var J=E.split(`
4
+ `),ae=P.split(`
5
+ `);for(g=d=0;d<J.length&&!J[d].includes("DetermineComponentFrameRoot");)d++;for(;g<ae.length&&!ae[g].includes("DetermineComponentFrameRoot");)g++;if(d===J.length||g===ae.length)for(d=J.length-1,g=ae.length-1;1<=d&&0<=g&&J[d]!==ae[g];)g--;for(;1<=d&&0<=g;d--,g--)if(J[d]!==ae[g]){if(d!==1||g!==1)do if(d--,g--,0>g||J[d]!==ae[g]){var me=`
6
+ `+J[d].replace(" at new "," at ");return s.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",s.displayName)),me}while(1<=d&&0<=g);break}}}finally{ze=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?je(l):""}function pt(s,a){switch(s.tag){case 26:case 27:case 5:return je(s.type);case 16:return je("Lazy");case 13:return s.child!==a&&a!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return bt(s.type,!1);case 11:return bt(s.type.render,!1);case 1:return bt(s.type,!0);case 31:return je("Activity");default:return""}}function vt(s){try{var a="",l=null;do a+=pt(s,l),l=s,s=s.return;while(s);return a}catch(d){return`
7
+ Error generating stack: `+d.message+`
8
+ `+d.stack}}var lt=Object.prototype.hasOwnProperty,de=e.unstable_scheduleCallback,ut=e.unstable_cancelCallback,tt=e.unstable_shouldYield,Vt=e.unstable_requestPaint,st=e.unstable_now,zt=e.unstable_getCurrentPriorityLevel,Ft=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,cn=e.unstable_LowPriority,ti=e.unstable_IdlePriority,ni=e.log,We=e.unstable_setDisableYieldValue,gt=null,xt=null;function Tt(s){if(typeof ni=="function"&&We(s),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(gt,s)}catch{}}var $t=Math.clz32?Math.clz32:le,Cn=Math.log,ee=Math.LN2;function le(s){return s>>>=0,s===0?32:31-(Cn(s)/ee|0)|0}var Be=256,Le=262144,Fe=4194304;function it(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function X(s,a,l){var d=s.pendingLanes;if(d===0)return 0;var g=0,y=s.suspendedLanes,E=s.pingedLanes;s=s.warmLanes;var P=d&134217727;return P!==0?(d=P&~y,d!==0?g=it(d):(E&=P,E!==0?g=it(E):l||(l=P&~s,l!==0&&(g=it(l))))):(P=d&~y,P!==0?g=it(P):E!==0?g=it(E):l||(l=d&~s,l!==0&&(g=it(l)))),g===0?0:a!==0&&a!==g&&(a&y)===0&&(y=g&-g,l=a&-a,y>=l||y===32&&(l&4194048)!==0)?a:g}function ue(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function be(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var s=Fe;return Fe<<=1,(Fe&62914560)===0&&(Fe=4194304),s}function At(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function jt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Re(s,a,l,d,g,y){var E=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var P=s.entanglements,J=s.expirationTimes,ae=s.hiddenUpdates;for(l=E&~l;0<l;){var me=31-$t(l),ve=1<<me;P[me]=0,J[me]=-1;var ce=ae[me];if(ce!==null)for(ae[me]=null,me=0;me<ce.length;me++){var he=ce[me];he!==null&&(he.lane&=-536870913)}l&=~ve}d!==0&&Ae(s,d,0),y!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=y&~(E&~a))}function Ae(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var d=31-$t(a);s.entangledLanes|=a,s.entanglements[d]=s.entanglements[d]|1073741824|l&261930}function et(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var d=31-$t(l),g=1<<d;g&a|s[d]&a&&(s[d]|=a),l&=~g}}function fn(s,a){var l=a&-a;return l=(l&42)!==0?1:Rt(l),(l&(s.suspendedLanes|a))!==0?0:l}function Rt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Qt(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Li(){var s=T.p;return s!==0?s:(s=window.event,s===void 0?32:CC(s.type))}function ys(s,a){var l=T.p;try{return T.p=s,a()}finally{T.p=l}}var Ci=Math.random().toString(36).slice(2),en="__reactFiber$"+Ci,tn="__reactProps$"+Ci,ns="__reactContainer$"+Ci,Us="__reactEvents$"+Ci,ua="__reactListeners$"+Ci,Ws="__reactHandles$"+Ci,Tr="__reactResources$"+Ci,Ui="__reactMarker$"+Ci;function Ve(s){delete s[en],delete s[tn],delete s[Us],delete s[ua],delete s[Ws]}function Y(s){var a=s[en];if(a)return a;for(var l=s.parentNode;l;){if(a=l[ns]||l[en]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=lC(s);s!==null;){if(l=s[en])return l;s=lC(s)}return a}s=l,l=s.parentNode}return null}function _e(s){if(s=s[en]||s[ns]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Q(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function Ee(s){var a=s[Tr];return a||(a=s[Tr]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Qe(s){s[Ui]=!0}var Ze=new Set,Ne={};function dt(s,a){pe(s,a),pe(s+"Capture",a)}function pe(s,a){for(Ne[s]=a,s=0;s<a.length;s++)Ze.add(a[s])}var Pe=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]*$"),qe={},Ct={};function Yt(s){return lt.call(Ct,s)?!0:lt.call(qe,s)?!1:Pe.test(s)?Ct[s]=!0:(qe[s]=!0,!1)}function Ke(s,a,l){if(Yt(a))if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+l)}}function Ht(s,a,l){if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+l)}}function nn(s,a,l,d){if(d===null)s.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(a,l,""+d)}}function Bt(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function un(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function qs(s,a,l){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,y=d.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return g.call(this)},set:function(E){l=""+E,y.call(this,E)}}),Object.defineProperty(s,a,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(E){l=""+E},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function is(s){if(!s._valueTracker){var a=un(s)?"checked":"value";s._valueTracker=qs(s,a,""+s[a])}}function Ar(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),d="";return s&&(d=un(s)?s.checked?"true":"false":s.value),s=d,s!==l?(a.setValue(s),!0):!1}function da(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var ki=/[\n"\\]/g;function ii(s){return s.replace(ki,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function co(s,a,l,d,g,y,E,P){s.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?s.type=E:s.removeAttribute("type"),a!=null?E==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Bt(a)):s.value!==""+Bt(a)&&(s.value=""+Bt(a)):E!=="submit"&&E!=="reset"||s.removeAttribute("value"),a!=null?ha(s,E,Bt(a)):l!=null?ha(s,E,Bt(l)):d!=null&&s.removeAttribute("value"),g==null&&y!=null&&(s.defaultChecked=!!y),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.name=""+Bt(P):s.removeAttribute("name")}function rr(s,a,l,d,g,y,E,P){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.type=y),a!=null||l!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){is(s);return}l=l!=null?""+Bt(l):"",a=a!=null?""+Bt(a):l,P||a===s.value||(s.value=a),s.defaultValue=a}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=P?s.checked:!!d,s.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(s.name=E),is(s)}function ha(s,a,l){a==="number"&&da(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function Yn(s,a,l,d){if(s=s.options,a){a={};for(var g=0;g<l.length;g++)a["$"+l[g]]=!0;for(l=0;l<s.length;l++)g=a.hasOwnProperty("$"+s[l].value),s[l].selected!==g&&(s[l].selected=g),g&&d&&(s[l].defaultSelected=!0)}else{for(l=""+Bt(l),a=null,g=0;g<s.length;g++){if(s[g].value===l){s[g].selected=!0,d&&(s[g].defaultSelected=!0);return}a!==null||s[g].disabled||(a=s[g])}a!==null&&(a.selected=!0)}}function il(s,a,l){if(a!=null&&(a=""+Bt(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+Bt(l):""}function sl(s,a,l,d){if(a==null){if(d!=null){if(l!=null)throw Error(i(92));if(M(d)){if(1<d.length)throw Error(i(93));d=d[0]}l=d}l==null&&(l=""),a=l}l=Bt(a),s.defaultValue=l,d=s.textContent,d===l&&d!==""&&d!==null&&(s.value=d),is(s)}function ct(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Ud=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $n(s,a,l){var d=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":d?s.setProperty(a,l):typeof l!="number"||l===0||Ud.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Xt(s,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var g in a)d=a[g],a.hasOwnProperty(g)&&l[g]!==d&&$n(s,g,d)}else for(var y in a)a.hasOwnProperty(y)&&$n(s,y,a[y])}function fa(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rr=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"]]),jc=/^[\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 pa(s){return jc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Te(){}var Ye=null;function _t(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ot=null,kn=null;function bs(s){var a=_e(s);if(a&&(s=a.stateNode)){var l=s[tn]||null;e:switch(s=a.stateNode,a.type){case"input":if(co(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+ii(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var d=l[a];if(d!==s&&d.form===s.form){var g=d[tn]||null;if(!g)throw Error(i(90));co(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<l.length;a++)d=l[a],d.form===s.form&&Ar(d)}break e;case"textarea":il(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&Yn(s,!!l.multiple,a,!1)}}}var Oc=!1;function Wd(s,a,l){if(Oc)return s(a,l);Oc=!0;try{var d=s(a);return d}finally{if(Oc=!1,(Ot!==null||kn!==null)&&(Lh(),Ot&&(a=Ot,s=kn,kn=Ot=null,bs(a),s)))for(a=0;a<s.length;a++)bs(s[a])}}function Dc(s,a){var l=s.stateNode;if(l===null)return null;var d=l[tn]||null;if(d===null)return null;l=d[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var Nr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xm=!1;if(Nr)try{var Ic={};Object.defineProperty(Ic,"passive",{get:function(){xm=!0}}),window.addEventListener("test",Ic,Ic),window.removeEventListener("test",Ic,Ic)}catch{xm=!1}var ma=null,Cm=null,qd=null;function tS(){if(qd)return qd;var s,a=Cm,l=a.length,d,g="value"in ma?ma.value:ma.textContent,y=g.length;for(s=0;s<l&&a[s]===g[s];s++);var E=l-s;for(d=1;d<=E&&a[l-d]===g[y-d];d++);return qd=g.slice(s,1<d?1-d:void 0)}function Gd(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Kd(){return!0}function nS(){return!1}function Wi(s){function a(l,d,g,y,E){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(l=s[P],this[P]=l?l(y):y[P]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Kd:nS,this.isPropagationStopped=nS,this}return _(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Kd)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Kd)},persist:function(){},isPersistent:Kd}),a}var uo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vd=Wi(uo),Bc=_({},uo,{view:0,detail:0}),E3=Wi(Bc),km,Em,Pc,Yd=_({},Bc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Am,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Pc&&(Pc&&s.type==="mousemove"?(km=s.screenX-Pc.screenX,Em=s.screenY-Pc.screenY):Em=km=0,Pc=s),km)},movementY:function(s){return"movementY"in s?s.movementY:Em}}),iS=Wi(Yd),T3=_({},Yd,{dataTransfer:0}),A3=Wi(T3),R3=_({},Bc,{relatedTarget:0}),Tm=Wi(R3),N3=_({},uo,{animationName:0,elapsedTime:0,pseudoElement:0}),L3=Wi(N3),M3=_({},uo,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),j3=Wi(M3),O3=_({},uo,{data:0}),sS=Wi(O3),D3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I3={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"},B3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function P3(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=B3[s])?!!a[s]:!1}function Am(){return P3}var $3=_({},Bc,{key:function(s){if(s.key){var a=D3[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Gd(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?I3[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Am,charCode:function(s){return s.type==="keypress"?Gd(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Gd(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),z3=Wi($3),H3=_({},Yd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rS=Wi(H3),F3=_({},Bc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Am}),U3=Wi(F3),W3=_({},uo,{propertyName:0,elapsedTime:0,pseudoElement:0}),q3=Wi(W3),G3=_({},Yd,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),K3=Wi(G3),V3=_({},uo,{newState:0,oldState:0}),Y3=Wi(V3),X3=[9,13,27,32],Rm=Nr&&"CompositionEvent"in window,$c=null;Nr&&"documentMode"in document&&($c=document.documentMode);var Z3=Nr&&"TextEvent"in window&&!$c,aS=Nr&&(!Rm||$c&&8<$c&&11>=$c),oS=" ",lS=!1;function cS(s,a){switch(s){case"keyup":return X3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uS(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var rl=!1;function J3(s,a){switch(s){case"compositionend":return uS(a);case"keypress":return a.which!==32?null:(lS=!0,oS);case"textInput":return s=a.data,s===oS&&lS?null:s;default:return null}}function Q3(s,a){if(rl)return s==="compositionend"||!Rm&&cS(s,a)?(s=tS(),qd=Cm=ma=null,rl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return aS&&a.locale!=="ko"?null:a.data;default:return null}}var e6={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 dS(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!e6[s.type]:a==="textarea"}function hS(s,a,l,d){Ot?kn?kn.push(d):kn=[d]:Ot=d,a=Ph(a,"onChange"),0<a.length&&(l=new Vd("onChange","change",null,l,d),s.push({event:l,listeners:a}))}var zc=null,Hc=null;function t6(s){Vx(s,0)}function Xd(s){var a=Q(s);if(Ar(a))return s}function fS(s,a){if(s==="change")return a}var pS=!1;if(Nr){var Nm;if(Nr){var Lm="oninput"in document;if(!Lm){var mS=document.createElement("div");mS.setAttribute("oninput","return;"),Lm=typeof mS.oninput=="function"}Nm=Lm}else Nm=!1;pS=Nm&&(!document.documentMode||9<document.documentMode)}function gS(){zc&&(zc.detachEvent("onpropertychange",_S),Hc=zc=null)}function _S(s){if(s.propertyName==="value"&&Xd(Hc)){var a=[];hS(a,Hc,s,_t(s)),Wd(t6,a)}}function n6(s,a,l){s==="focusin"?(gS(),zc=a,Hc=l,zc.attachEvent("onpropertychange",_S)):s==="focusout"&&gS()}function i6(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Xd(Hc)}function s6(s,a){if(s==="click")return Xd(a)}function r6(s,a){if(s==="input"||s==="change")return Xd(a)}function a6(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ss=typeof Object.is=="function"?Object.is:a6;function Fc(s,a){if(ss(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),d=Object.keys(a);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var g=l[d];if(!lt.call(a,g)||!ss(s[g],a[g]))return!1}return!0}function vS(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function yS(s,a){var l=vS(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=a&&d>=a)return{node:l,offset:a-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=vS(l)}}function bS(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?bS(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function SS(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=da(s.document);a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=da(s.document)}return a}function Mm(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var o6=Nr&&"documentMode"in document&&11>=document.documentMode,al=null,jm=null,Uc=null,Om=!1;function wS(s,a,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Om||al==null||al!==da(d)||(d=al,"selectionStart"in d&&Mm(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Uc&&Fc(Uc,d)||(Uc=d,d=Ph(jm,"onSelect"),0<d.length&&(a=new Vd("onSelect","select",null,a,l),s.push({event:a,listeners:d}),a.target=al)))}function ho(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var ol={animationend:ho("Animation","AnimationEnd"),animationiteration:ho("Animation","AnimationIteration"),animationstart:ho("Animation","AnimationStart"),transitionrun:ho("Transition","TransitionRun"),transitionstart:ho("Transition","TransitionStart"),transitioncancel:ho("Transition","TransitionCancel"),transitionend:ho("Transition","TransitionEnd")},Dm={},xS={};Nr&&(xS=document.createElement("div").style,"AnimationEvent"in window||(delete ol.animationend.animation,delete ol.animationiteration.animation,delete ol.animationstart.animation),"TransitionEvent"in window||delete ol.transitionend.transition);function fo(s){if(Dm[s])return Dm[s];if(!ol[s])return s;var a=ol[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in xS)return Dm[s]=a[l];return s}var CS=fo("animationend"),kS=fo("animationiteration"),ES=fo("animationstart"),l6=fo("transitionrun"),c6=fo("transitionstart"),u6=fo("transitioncancel"),TS=fo("transitionend"),AS=new Map,Im="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(" ");Im.push("scrollEnd");function Gs(s,a){AS.set(s,a),dt(a,[s])}var Zd=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ss=[],ll=0,Bm=0;function Jd(){for(var s=ll,a=Bm=ll=0;a<s;){var l=Ss[a];Ss[a++]=null;var d=Ss[a];Ss[a++]=null;var g=Ss[a];Ss[a++]=null;var y=Ss[a];if(Ss[a++]=null,d!==null&&g!==null){var E=d.pending;E===null?g.next=g:(g.next=E.next,E.next=g),d.pending=g}y!==0&&RS(l,g,y)}}function Qd(s,a,l,d){Ss[ll++]=s,Ss[ll++]=a,Ss[ll++]=l,Ss[ll++]=d,Bm|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Pm(s,a,l,d){return Qd(s,a,l,d),eh(s)}function po(s,a){return Qd(s,null,null,a),eh(s)}function RS(s,a,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var g=!1,y=s.return;y!==null;)y.childLanes|=l,d=y.alternate,d!==null&&(d.childLanes|=l),y.tag===22&&(s=y.stateNode,s===null||s._visibility&1||(g=!0)),s=y,y=y.return;return s.tag===3?(y=s.stateNode,g&&a!==null&&(g=31-$t(l),s=y.hiddenUpdates,d=s[g],d===null?s[g]=[a]:d.push(a),a.lane=l|536870912),y):null}function eh(s){if(50<du)throw du=0,Kg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var cl={};function d6(s,a,l,d){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rs(s,a,l,d){return new d6(s,a,l,d)}function $m(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Lr(s,a){var l=s.alternate;return l===null?(l=rs(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function NS(s,a){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,a=l.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function th(s,a,l,d,g,y){var E=0;if(d=s,typeof s=="function")$m(s)&&(E=1);else if(typeof s=="string")E=g4(s,l,ne.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case W:return s=rs(31,l,a,g),s.elementType=W,s.lanes=y,s;case x:return mo(l.children,g,y,a);case C:E=8,g|=24;break;case D:return s=rs(12,l,a,g|2),s.elementType=D,s.lanes=y,s;case I:return s=rs(13,l,a,g),s.elementType=I,s.lanes=y,s;case j:return s=rs(19,l,a,g),s.elementType=j,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case F:E=10;break e;case z:E=9;break e;case N:E=11;break e;case U:E=14;break e;case G:E=16,d=null;break e}E=29,l=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=rs(E,l,a,g),a.elementType=s,a.type=d,a.lanes=y,a}function mo(s,a,l,d){return s=rs(7,s,d,a),s.lanes=l,s}function zm(s,a,l){return s=rs(6,s,null,a),s.lanes=l,s}function LS(s){var a=rs(18,null,null,0);return a.stateNode=s,a}function Hm(s,a,l){return a=rs(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var MS=new WeakMap;function ws(s,a){if(typeof s=="object"&&s!==null){var l=MS.get(s);return l!==void 0?l:(a={value:s,source:a,stack:vt(a)},MS.set(s,a),a)}return{value:s,source:a,stack:vt(a)}}var ul=[],dl=0,nh=null,Wc=0,xs=[],Cs=0,ga=null,ar=1,or="";function Mr(s,a){ul[dl++]=Wc,ul[dl++]=nh,nh=s,Wc=a}function jS(s,a,l){xs[Cs++]=ar,xs[Cs++]=or,xs[Cs++]=ga,ga=s;var d=ar;s=or;var g=32-$t(d)-1;d&=~(1<<g),l+=1;var y=32-$t(a)+g;if(30<y){var E=g-g%5;y=(d&(1<<E)-1).toString(32),d>>=E,g-=E,ar=1<<32-$t(a)+g|l<<g|d,or=y+s}else ar=1<<y|l<<g|d,or=s}function Fm(s){s.return!==null&&(Mr(s,1),jS(s,1,0))}function Um(s){for(;s===nh;)nh=ul[--dl],ul[dl]=null,Wc=ul[--dl],ul[dl]=null;for(;s===ga;)ga=xs[--Cs],xs[Cs]=null,or=xs[--Cs],xs[Cs]=null,ar=xs[--Cs],xs[Cs]=null}function OS(s,a){xs[Cs++]=ar,xs[Cs++]=or,xs[Cs++]=ga,ar=a.id,or=a.overflow,ga=s}var gi=null,mn=null,Pt=!1,_a=null,ks=!1,Wm=Error(i(519));function va(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qc(ws(a,s)),Wm}function DS(s){var a=s.stateNode,l=s.type,d=s.memoizedProps;switch(a[en]=s,a[tn]=d,l){case"dialog":Lt("cancel",a),Lt("close",a);break;case"iframe":case"object":case"embed":Lt("load",a);break;case"video":case"audio":for(l=0;l<fu.length;l++)Lt(fu[l],a);break;case"source":Lt("error",a);break;case"img":case"image":case"link":Lt("error",a),Lt("load",a);break;case"details":Lt("toggle",a);break;case"input":Lt("invalid",a),rr(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Lt("invalid",a);break;case"textarea":Lt("invalid",a),sl(a,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||d.suppressHydrationWarning===!0||Jx(a.textContent,l)?(d.popover!=null&&(Lt("beforetoggle",a),Lt("toggle",a)),d.onScroll!=null&&Lt("scroll",a),d.onScrollEnd!=null&&Lt("scrollend",a),d.onClick!=null&&(a.onclick=Te),a=!0):a=!1,a||va(s,!0)}function IS(s){for(gi=s.return;gi;)switch(gi.tag){case 5:case 31:case 13:ks=!1;return;case 27:case 3:ks=!0;return;default:gi=gi.return}}function hl(s){if(s!==gi)return!1;if(!Pt)return IS(s),Pt=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||l_(s.type,s.memoizedProps)),l=!l),l&&mn&&va(s),IS(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));mn=oC(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));mn=oC(s)}else a===27?(a=mn,Ma(s.type)?(s=f_,f_=null,mn=s):mn=a):mn=gi?Ts(s.stateNode.nextSibling):null;return!0}function go(){mn=gi=null,Pt=!1}function qm(){var s=_a;return s!==null&&(Vi===null?Vi=s:Vi.push.apply(Vi,s),_a=null),s}function qc(s){_a===null?_a=[s]:_a.push(s)}var Gm=L(null),_o=null,jr=null;function ya(s,a,l){H(Gm,a._currentValue),a._currentValue=l}function Or(s){s._currentValue=Gm.current,q(Gm)}function Km(s,a,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),s===l)break;s=s.return}}function Vm(s,a,l,d){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var y=g.dependencies;if(y!==null){var E=g.child;y=y.firstContext;e:for(;y!==null;){var P=y;y=g;for(var J=0;J<a.length;J++)if(P.context===a[J]){y.lanes|=l,P=y.alternate,P!==null&&(P.lanes|=l),Km(y.return,l,s),d||(E=null);break e}y=P.next}}else if(g.tag===18){if(E=g.return,E===null)throw Error(i(341));E.lanes|=l,y=E.alternate,y!==null&&(y.lanes|=l),Km(E,l,s),E=null}else E=g.child;if(E!==null)E.return=g;else for(E=g;E!==null;){if(E===s){E=null;break}if(g=E.sibling,g!==null){g.return=E.return,E=g;break}E=E.return}g=E}}function fl(s,a,l,d){s=null;for(var g=a,y=!1;g!==null;){if(!y){if((g.flags&524288)!==0)y=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var E=g.alternate;if(E===null)throw Error(i(387));if(E=E.memoizedProps,E!==null){var P=g.type;ss(g.pendingProps.value,E.value)||(s!==null?s.push(P):s=[P])}}else if(g===xe.current){if(E=g.alternate,E===null)throw Error(i(387));E.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(vu):s=[vu])}g=g.return}s!==null&&Vm(a,s,l,d),a.flags|=262144}function ih(s){for(s=s.firstContext;s!==null;){if(!ss(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function vo(s){_o=s,jr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function _i(s){return BS(_o,s)}function sh(s,a){return _o===null&&vo(s),BS(s,a)}function BS(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},jr===null){if(s===null)throw Error(i(308));jr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else jr=jr.next=a;return l}var h6=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(l,d){s.push(d)}};this.abort=function(){a.aborted=!0,s.forEach(function(l){return l()})}},f6=e.unstable_scheduleCallback,p6=e.unstable_NormalPriority,zn={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ym(){return{controller:new h6,data:new Map,refCount:0}}function Gc(s){s.refCount--,s.refCount===0&&f6(p6,function(){s.controller.abort()})}var Kc=null,Xm=0,pl=0,ml=null;function m6(s,a){if(Kc===null){var l=Kc=[];Xm=0,pl=Qg(),ml={status:"pending",value:void 0,then:function(d){l.push(d)}}}return Xm++,a.then(PS,PS),a}function PS(){if(--Xm===0&&Kc!==null){ml!==null&&(ml.status="fulfilled");var s=Kc;Kc=null,pl=0,ml=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function g6(s,a){var l=[],d={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return s.then(function(){d.status="fulfilled",d.value=a;for(var g=0;g<l.length;g++)(0,l[g])(a)},function(g){for(d.status="rejected",d.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),d}var $S=k.S;k.S=function(s,a){wx=st(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&m6(s,a),$S!==null&&$S(s,a)};var yo=L(null);function Zm(){var s=yo.current;return s!==null?s:dn.pooledCache}function rh(s,a){a===null?H(yo,yo.current):H(yo,a.pool)}function zS(){var s=Zm();return s===null?null:{parent:zn._currentValue,pool:s}}var gl=Error(i(460)),Jm=Error(i(474)),ah=Error(i(542)),oh={then:function(){}};function HS(s){return s=s.status,s==="fulfilled"||s==="rejected"}function FS(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(Te,Te),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,WS(s),s;default:if(typeof a.status=="string")a.then(Te,Te);else{if(s=dn,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(d){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=d}},function(d){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=d}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,WS(s),s}throw So=a,gl}}function bo(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(So=l,gl):l}}var So=null;function US(){if(So===null)throw Error(i(459));var s=So;return So=null,s}function WS(s){if(s===gl||s===ah)throw Error(i(483))}var _l=null,Vc=0;function lh(s){var a=Vc;return Vc+=1,_l===null&&(_l=[]),FS(_l,s,a)}function Yc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function ch(s,a){throw a.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function qS(s){function a(ie,te){if(s){var re=ie.deletions;re===null?(ie.deletions=[te],ie.flags|=16):re.push(te)}}function l(ie,te){if(!s)return null;for(;te!==null;)a(ie,te),te=te.sibling;return null}function d(ie){for(var te=new Map;ie!==null;)ie.key!==null?te.set(ie.key,ie):te.set(ie.index,ie),ie=ie.sibling;return te}function g(ie,te){return ie=Lr(ie,te),ie.index=0,ie.sibling=null,ie}function y(ie,te,re){return ie.index=re,s?(re=ie.alternate,re!==null?(re=re.index,re<te?(ie.flags|=67108866,te):re):(ie.flags|=67108866,te)):(ie.flags|=1048576,te)}function E(ie){return s&&ie.alternate===null&&(ie.flags|=67108866),ie}function P(ie,te,re,ge){return te===null||te.tag!==6?(te=zm(re,ie.mode,ge),te.return=ie,te):(te=g(te,re),te.return=ie,te)}function J(ie,te,re,ge){var nt=re.type;return nt===x?me(ie,te,re.props.children,ge,re.key):te!==null&&(te.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===G&&bo(nt)===te.type)?(te=g(te,re.props),Yc(te,re),te.return=ie,te):(te=th(re.type,re.key,re.props,null,ie.mode,ge),Yc(te,re),te.return=ie,te)}function ae(ie,te,re,ge){return te===null||te.tag!==4||te.stateNode.containerInfo!==re.containerInfo||te.stateNode.implementation!==re.implementation?(te=Hm(re,ie.mode,ge),te.return=ie,te):(te=g(te,re.children||[]),te.return=ie,te)}function me(ie,te,re,ge,nt){return te===null||te.tag!==7?(te=mo(re,ie.mode,ge,nt),te.return=ie,te):(te=g(te,re),te.return=ie,te)}function ve(ie,te,re){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=zm(""+te,ie.mode,re),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return re=th(te.type,te.key,te.props,null,ie.mode,re),Yc(re,te),re.return=ie,re;case w:return te=Hm(te,ie.mode,re),te.return=ie,te;case G:return te=bo(te),ve(ie,te,re)}if(M(te)||O(te))return te=mo(te,ie.mode,re,null),te.return=ie,te;if(typeof te.then=="function")return ve(ie,lh(te),re);if(te.$$typeof===F)return ve(ie,sh(ie,te),re);ch(ie,te)}return null}function ce(ie,te,re,ge){var nt=te!==null?te.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return nt!==null?null:P(ie,te,""+re,ge);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case S:return re.key===nt?J(ie,te,re,ge):null;case w:return re.key===nt?ae(ie,te,re,ge):null;case G:return re=bo(re),ce(ie,te,re,ge)}if(M(re)||O(re))return nt!==null?null:me(ie,te,re,ge,null);if(typeof re.then=="function")return ce(ie,te,lh(re),ge);if(re.$$typeof===F)return ce(ie,te,sh(ie,re),ge);ch(ie,re)}return null}function he(ie,te,re,ge,nt){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ie=ie.get(re)||null,P(te,ie,""+ge,nt);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return ie=ie.get(ge.key===null?re:ge.key)||null,J(te,ie,ge,nt);case w:return ie=ie.get(ge.key===null?re:ge.key)||null,ae(te,ie,ge,nt);case G:return ge=bo(ge),he(ie,te,re,ge,nt)}if(M(ge)||O(ge))return ie=ie.get(re)||null,me(te,ie,ge,nt,null);if(typeof ge.then=="function")return he(ie,te,re,lh(ge),nt);if(ge.$$typeof===F)return he(ie,te,re,sh(te,ge),nt);ch(te,ge)}return null}function Ue(ie,te,re,ge){for(var nt=null,Ut=null,Xe=te,St=te=0,It=null;Xe!==null&&St<re.length;St++){Xe.index>St?(It=Xe,Xe=null):It=Xe.sibling;var Wt=ce(ie,Xe,re[St],ge);if(Wt===null){Xe===null&&(Xe=It);break}s&&Xe&&Wt.alternate===null&&a(ie,Xe),te=y(Wt,te,St),Ut===null?nt=Wt:Ut.sibling=Wt,Ut=Wt,Xe=It}if(St===re.length)return l(ie,Xe),Pt&&Mr(ie,St),nt;if(Xe===null){for(;St<re.length;St++)Xe=ve(ie,re[St],ge),Xe!==null&&(te=y(Xe,te,St),Ut===null?nt=Xe:Ut.sibling=Xe,Ut=Xe);return Pt&&Mr(ie,St),nt}for(Xe=d(Xe);St<re.length;St++)It=he(Xe,ie,St,re[St],ge),It!==null&&(s&&It.alternate!==null&&Xe.delete(It.key===null?St:It.key),te=y(It,te,St),Ut===null?nt=It:Ut.sibling=It,Ut=It);return s&&Xe.forEach(function(Ba){return a(ie,Ba)}),Pt&&Mr(ie,St),nt}function at(ie,te,re,ge){if(re==null)throw Error(i(151));for(var nt=null,Ut=null,Xe=te,St=te=0,It=null,Wt=re.next();Xe!==null&&!Wt.done;St++,Wt=re.next()){Xe.index>St?(It=Xe,Xe=null):It=Xe.sibling;var Ba=ce(ie,Xe,Wt.value,ge);if(Ba===null){Xe===null&&(Xe=It);break}s&&Xe&&Ba.alternate===null&&a(ie,Xe),te=y(Ba,te,St),Ut===null?nt=Ba:Ut.sibling=Ba,Ut=Ba,Xe=It}if(Wt.done)return l(ie,Xe),Pt&&Mr(ie,St),nt;if(Xe===null){for(;!Wt.done;St++,Wt=re.next())Wt=ve(ie,Wt.value,ge),Wt!==null&&(te=y(Wt,te,St),Ut===null?nt=Wt:Ut.sibling=Wt,Ut=Wt);return Pt&&Mr(ie,St),nt}for(Xe=d(Xe);!Wt.done;St++,Wt=re.next())Wt=he(Xe,ie,St,Wt.value,ge),Wt!==null&&(s&&Wt.alternate!==null&&Xe.delete(Wt.key===null?St:Wt.key),te=y(Wt,te,St),Ut===null?nt=Wt:Ut.sibling=Wt,Ut=Wt);return s&&Xe.forEach(function(T4){return a(ie,T4)}),Pt&&Mr(ie,St),nt}function an(ie,te,re,ge){if(typeof re=="object"&&re!==null&&re.type===x&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case S:e:{for(var nt=re.key;te!==null;){if(te.key===nt){if(nt=re.type,nt===x){if(te.tag===7){l(ie,te.sibling),ge=g(te,re.props.children),ge.return=ie,ie=ge;break e}}else if(te.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===G&&bo(nt)===te.type){l(ie,te.sibling),ge=g(te,re.props),Yc(ge,re),ge.return=ie,ie=ge;break e}l(ie,te);break}else a(ie,te);te=te.sibling}re.type===x?(ge=mo(re.props.children,ie.mode,ge,re.key),ge.return=ie,ie=ge):(ge=th(re.type,re.key,re.props,null,ie.mode,ge),Yc(ge,re),ge.return=ie,ie=ge)}return E(ie);case w:e:{for(nt=re.key;te!==null;){if(te.key===nt)if(te.tag===4&&te.stateNode.containerInfo===re.containerInfo&&te.stateNode.implementation===re.implementation){l(ie,te.sibling),ge=g(te,re.children||[]),ge.return=ie,ie=ge;break e}else{l(ie,te);break}else a(ie,te);te=te.sibling}ge=Hm(re,ie.mode,ge),ge.return=ie,ie=ge}return E(ie);case G:return re=bo(re),an(ie,te,re,ge)}if(M(re))return Ue(ie,te,re,ge);if(O(re)){if(nt=O(re),typeof nt!="function")throw Error(i(150));return re=nt.call(re),at(ie,te,re,ge)}if(typeof re.then=="function")return an(ie,te,lh(re),ge);if(re.$$typeof===F)return an(ie,te,sh(ie,re),ge);ch(ie,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,te!==null&&te.tag===6?(l(ie,te.sibling),ge=g(te,re),ge.return=ie,ie=ge):(l(ie,te),ge=zm(re,ie.mode,ge),ge.return=ie,ie=ge),E(ie)):l(ie,te)}return function(ie,te,re,ge){try{Vc=0;var nt=an(ie,te,re,ge);return _l=null,nt}catch(Xe){if(Xe===gl||Xe===ah)throw Xe;var Ut=rs(29,Xe,null,ie.mode);return Ut.lanes=ge,Ut.return=ie,Ut}}}var wo=qS(!0),GS=qS(!1),ba=!1;function Qm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eg(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Sa(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function wa(s,a,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Kt&2)!==0){var g=d.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),d.pending=a,a=eh(s),RS(s,null,l),a}return Qd(s,d,a,l),eh(s)}function Xc(s,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var d=a.lanes;d&=s.pendingLanes,l|=d,a.lanes=l,et(s,l)}}function tg(s,a){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var E={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};y===null?g=y=E:y=y.next=E,l=l.next}while(l!==null);y===null?g=y=a:y=y.next=a}else g=y=a;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}var ng=!1;function Zc(){if(ng){var s=ml;if(s!==null)throw s}}function Jc(s,a,l,d){ng=!1;var g=s.updateQueue;ba=!1;var y=g.firstBaseUpdate,E=g.lastBaseUpdate,P=g.shared.pending;if(P!==null){g.shared.pending=null;var J=P,ae=J.next;J.next=null,E===null?y=ae:E.next=ae,E=J;var me=s.alternate;me!==null&&(me=me.updateQueue,P=me.lastBaseUpdate,P!==E&&(P===null?me.firstBaseUpdate=ae:P.next=ae,me.lastBaseUpdate=J))}if(y!==null){var ve=g.baseState;E=0,me=ae=J=null,P=y;do{var ce=P.lane&-536870913,he=ce!==P.lane;if(he?(Dt&ce)===ce:(d&ce)===ce){ce!==0&&ce===pl&&(ng=!0),me!==null&&(me=me.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ue=s,at=P;ce=a;var an=l;switch(at.tag){case 1:if(Ue=at.payload,typeof Ue=="function"){ve=Ue.call(an,ve,ce);break e}ve=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=at.payload,ce=typeof Ue=="function"?Ue.call(an,ve,ce):Ue,ce==null)break e;ve=_({},ve,ce);break e;case 2:ba=!0}}ce=P.callback,ce!==null&&(s.flags|=64,he&&(s.flags|=8192),he=g.callbacks,he===null?g.callbacks=[ce]:he.push(ce))}else he={lane:ce,tag:P.tag,payload:P.payload,callback:P.callback,next:null},me===null?(ae=me=he,J=ve):me=me.next=he,E|=ce;if(P=P.next,P===null){if(P=g.shared.pending,P===null)break;he=P,P=he.next,he.next=null,g.lastBaseUpdate=he,g.shared.pending=null}}while(!0);me===null&&(J=ve),g.baseState=J,g.firstBaseUpdate=ae,g.lastBaseUpdate=me,y===null&&(g.shared.lanes=0),Ta|=E,s.lanes=E,s.memoizedState=ve}}function KS(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function VS(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)KS(l[s],a)}var vl=L(null),uh=L(0);function YS(s,a){s=Ur,H(uh,s),H(vl,a),Ur=s|a.baseLanes}function ig(){H(uh,Ur),H(vl,vl.current)}function sg(){Ur=uh.current,q(vl),q(uh)}var as=L(null),Es=null;function xa(s){var a=s.alternate;H(In,In.current&1),H(as,s),Es===null&&(a===null||vl.current!==null||a.memoizedState!==null)&&(Es=s)}function rg(s){H(In,In.current),H(as,s),Es===null&&(Es=s)}function XS(s){s.tag===22?(H(In,In.current),H(as,s),Es===null&&(Es=s)):Ca()}function Ca(){H(In,In.current),H(as,as.current)}function os(s){q(as),Es===s&&(Es=null),q(In)}var In=L(0);function dh(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||d_(l)||h_(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Dr=0,yt=null,sn=null,Hn=null,hh=!1,yl=!1,xo=!1,fh=0,Qc=0,bl=null,_6=0;function An(){throw Error(i(321))}function ag(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!ss(s[l],a[l]))return!1;return!0}function og(s,a,l,d,g,y){return Dr=y,yt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,k.H=s===null||s.memoizedState===null?jw:wg,xo=!1,y=l(d,g),xo=!1,yl&&(y=JS(a,l,d,g)),ZS(s),y}function ZS(s){k.H=nu;var a=sn!==null&&sn.next!==null;if(Dr=0,Hn=sn=yt=null,hh=!1,Qc=0,bl=null,a)throw Error(i(300));s===null||Fn||(s=s.dependencies,s!==null&&ih(s)&&(Fn=!0))}function JS(s,a,l,d){yt=s;var g=0;do{if(yl&&(bl=null),Qc=0,yl=!1,25<=g)throw Error(i(301));if(g+=1,Hn=sn=null,s.updateQueue!=null){var y=s.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}k.H=Ow,y=a(l,d)}while(yl);return y}function v6(){var s=k.H,a=s.useState()[0];return a=typeof a.then=="function"?eu(a):a,s=s.useState()[0],(sn!==null?sn.memoizedState:null)!==s&&(yt.flags|=1024),a}function lg(){var s=fh!==0;return fh=0,s}function cg(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function ug(s){if(hh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}hh=!1}Dr=0,Hn=sn=yt=null,yl=!1,Qc=fh=0,bl=null}function Mi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Hn===null?yt.memoizedState=Hn=s:Hn=Hn.next=s,Hn}function Bn(){if(sn===null){var s=yt.alternate;s=s!==null?s.memoizedState:null}else s=sn.next;var a=Hn===null?yt.memoizedState:Hn.next;if(a!==null)Hn=a,sn=s;else{if(s===null)throw yt.alternate===null?Error(i(467)):Error(i(310));sn=s,s={memoizedState:sn.memoizedState,baseState:sn.baseState,baseQueue:sn.baseQueue,queue:sn.queue,next:null},Hn===null?yt.memoizedState=Hn=s:Hn=Hn.next=s}return Hn}function ph(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function eu(s){var a=Qc;return Qc+=1,bl===null&&(bl=[]),s=FS(bl,s,a),a=yt,(Hn===null?a.memoizedState:Hn.next)===null&&(a=a.alternate,k.H=a===null||a.memoizedState===null?jw:wg),s}function mh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return eu(s);if(s.$$typeof===F)return _i(s)}throw Error(i(438,String(s)))}function dg(s){var a=null,l=yt.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var d=yt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(a={data:d.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=ph(),yt.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(s),d=0;d<s;d++)l[d]=Z;return a.index++,l}function Ir(s,a){return typeof a=="function"?a(s):a}function gh(s){var a=Bn();return hg(a,sn,s)}function hg(s,a,l){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=l;var g=s.baseQueue,y=d.pending;if(y!==null){if(g!==null){var E=g.next;g.next=y.next,y.next=E}a.baseQueue=g=y,d.pending=null}if(y=s.baseState,g===null)s.memoizedState=y;else{a=g.next;var P=E=null,J=null,ae=a,me=!1;do{var ve=ae.lane&-536870913;if(ve!==ae.lane?(Dt&ve)===ve:(Dr&ve)===ve){var ce=ae.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),ve===pl&&(me=!0);else if((Dr&ce)===ce){ae=ae.next,ce===pl&&(me=!0);continue}else ve={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},J===null?(P=J=ve,E=y):J=J.next=ve,yt.lanes|=ce,Ta|=ce;ve=ae.action,xo&&l(y,ve),y=ae.hasEagerState?ae.eagerState:l(y,ve)}else ce={lane:ve,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},J===null?(P=J=ce,E=y):J=J.next=ce,yt.lanes|=ve,Ta|=ve;ae=ae.next}while(ae!==null&&ae!==a);if(J===null?E=y:J.next=P,!ss(y,s.memoizedState)&&(Fn=!0,me&&(l=ml,l!==null)))throw l;s.memoizedState=y,s.baseState=E,s.baseQueue=J,d.lastRenderedState=y}return g===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function fg(s){var a=Bn(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=s;var d=l.dispatch,g=l.pending,y=a.memoizedState;if(g!==null){l.pending=null;var E=g=g.next;do y=s(y,E.action),E=E.next;while(E!==g);ss(y,a.memoizedState)||(Fn=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),l.lastRenderedState=y}return[y,d]}function QS(s,a,l){var d=yt,g=Bn(),y=Pt;if(y){if(l===void 0)throw Error(i(407));l=l()}else l=a();var E=!ss((sn||g).memoizedState,l);if(E&&(g.memoizedState=l,Fn=!0),g=g.queue,gg(nw.bind(null,d,g,s),[s]),g.getSnapshot!==a||E||Hn!==null&&Hn.memoizedState.tag&1){if(d.flags|=2048,Sl(9,{destroy:void 0},tw.bind(null,d,g,l,a),null),dn===null)throw Error(i(349));y||(Dr&127)!==0||ew(d,a,l)}return l}function ew(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=yt.updateQueue,a===null?(a=ph(),yt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function tw(s,a,l,d){a.value=l,a.getSnapshot=d,iw(a)&&sw(s)}function nw(s,a,l){return l(function(){iw(a)&&sw(s)})}function iw(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ss(s,l)}catch{return!0}}function sw(s){var a=po(s,2);a!==null&&Yi(a,s,2)}function pg(s){var a=Mi();if(typeof s=="function"){var l=s;if(s=l(),xo){Tt(!0);try{l()}finally{Tt(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:s},a}function rw(s,a,l,d){return s.baseState=l,hg(s,sn,typeof d=="function"?d:Ir)}function y6(s,a,l,d,g){if(yh(s))throw Error(i(485));if(s=a.action,s!==null){var y={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};k.T!==null?l(!0):y.isTransition=!1,d(y),l=a.pending,l===null?(y.next=a.pending=y,aw(a,y)):(y.next=l.next,a.pending=l.next=y)}}function aw(s,a){var l=a.action,d=a.payload,g=s.state;if(a.isTransition){var y=k.T,E={};k.T=E;try{var P=l(g,d),J=k.S;J!==null&&J(E,P),ow(s,a,P)}catch(ae){mg(s,a,ae)}finally{y!==null&&E.types!==null&&(y.types=E.types),k.T=y}}else try{y=l(g,d),ow(s,a,y)}catch(ae){mg(s,a,ae)}}function ow(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){lw(s,a,d)},function(d){return mg(s,a,d)}):lw(s,a,l)}function lw(s,a,l){a.status="fulfilled",a.value=l,cw(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,aw(s,l)))}function mg(s,a,l){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=l,cw(a),a=a.next;while(a!==d)}s.action=null}function cw(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function uw(s,a){return a}function dw(s,a){if(Pt){var l=dn.formState;if(l!==null){e:{var d=yt;if(Pt){if(mn){t:{for(var g=mn,y=ks;g.nodeType!==8;){if(!y){g=null;break t}if(g=Ts(g.nextSibling),g===null){g=null;break t}}y=g.data,g=y==="F!"||y==="F"?g:null}if(g){mn=Ts(g.nextSibling),d=g.data==="F!";break e}}va(d)}d=!1}d&&(a=l[0])}}return l=Mi(),l.memoizedState=l.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uw,lastRenderedState:a},l.queue=d,l=Nw.bind(null,yt,d),d.dispatch=l,d=pg(!1),y=Sg.bind(null,yt,!1,d.queue),d=Mi(),g={state:a,dispatch:null,action:s,pending:null},d.queue=g,l=y6.bind(null,yt,g,y,l),g.dispatch=l,d.memoizedState=s,[a,l,!1]}function hw(s){var a=Bn();return fw(a,sn,s)}function fw(s,a,l){if(a=hg(s,a,uw)[0],s=gh(Ir)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=eu(a)}catch(E){throw E===gl?ah:E}else d=a;a=Bn();var g=a.queue,y=g.dispatch;return l!==a.memoizedState&&(yt.flags|=2048,Sl(9,{destroy:void 0},b6.bind(null,g,l),null)),[d,y,s]}function b6(s,a){s.action=a}function pw(s){var a=Bn(),l=sn;if(l!==null)return fw(a,l,s);Bn(),a=a.memoizedState,l=Bn();var d=l.queue.dispatch;return l.memoizedState=s,[a,d,!1]}function Sl(s,a,l,d){return s={tag:s,create:l,deps:d,inst:a,next:null},a=yt.updateQueue,a===null&&(a=ph(),yt.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,a.lastEffect=s),s}function mw(){return Bn().memoizedState}function _h(s,a,l,d){var g=Mi();yt.flags|=s,g.memoizedState=Sl(1|a,{destroy:void 0},l,d===void 0?null:d)}function vh(s,a,l,d){var g=Bn();d=d===void 0?null:d;var y=g.memoizedState.inst;sn!==null&&d!==null&&ag(d,sn.memoizedState.deps)?g.memoizedState=Sl(a,y,l,d):(yt.flags|=s,g.memoizedState=Sl(1|a,y,l,d))}function gw(s,a){_h(8390656,8,s,a)}function gg(s,a){vh(2048,8,s,a)}function S6(s){yt.flags|=4;var a=yt.updateQueue;if(a===null)a=ph(),yt.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function _w(s){var a=Bn().memoizedState;return S6({ref:a,nextImpl:s}),function(){if((Kt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function vw(s,a){return vh(4,2,s,a)}function yw(s,a){return vh(4,4,s,a)}function bw(s,a){if(typeof a=="function"){s=s();var l=a(s);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function Sw(s,a,l){l=l!=null?l.concat([s]):null,vh(4,4,bw.bind(null,a,s),l)}function _g(){}function ww(s,a){var l=Bn();a=a===void 0?null:a;var d=l.memoizedState;return a!==null&&ag(a,d[1])?d[0]:(l.memoizedState=[s,a],s)}function xw(s,a){var l=Bn();a=a===void 0?null:a;var d=l.memoizedState;if(a!==null&&ag(a,d[1]))return d[0];if(d=s(),xo){Tt(!0);try{s()}finally{Tt(!1)}}return l.memoizedState=[d,a],d}function vg(s,a,l){return l===void 0||(Dr&1073741824)!==0&&(Dt&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=Cx(),yt.lanes|=s,Ta|=s,l)}function Cw(s,a,l,d){return ss(l,a)?l:vl.current!==null?(s=vg(s,l,d),ss(s,a)||(Fn=!0),s):(Dr&42)===0||(Dr&1073741824)!==0&&(Dt&261930)===0?(Fn=!0,s.memoizedState=l):(s=Cx(),yt.lanes|=s,Ta|=s,a)}function kw(s,a,l,d,g){var y=T.p;T.p=y!==0&&8>y?y:8;var E=k.T,P={};k.T=P,Sg(s,!1,a,l);try{var J=g(),ae=k.S;if(ae!==null&&ae(P,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var me=g6(J,d);tu(s,a,me,us(s))}else tu(s,a,d,us(s))}catch(ve){tu(s,a,{then:function(){},status:"rejected",reason:ve},us())}finally{T.p=y,E!==null&&P.types!==null&&(E.types=P.types),k.T=E}}function w6(){}function yg(s,a,l,d){if(s.tag!==5)throw Error(i(476));var g=Ew(s).queue;kw(s,g,a,R,l===null?w6:function(){return Tw(s),l(d)})}function Ew(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:R},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function Tw(s){var a=Ew(s);a.next===null&&(a=s.alternate.memoizedState),tu(s,a.next.queue,{},us())}function bg(){return _i(vu)}function Aw(){return Bn().memoizedState}function Rw(){return Bn().memoizedState}function x6(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=us();s=Sa(l);var d=wa(a,s,l);d!==null&&(Yi(d,a,l),Xc(d,a,l)),a={cache:Ym()},s.payload=a;return}a=a.return}}function C6(s,a,l){var d=us();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},yh(s)?Lw(a,l):(l=Pm(s,a,l,d),l!==null&&(Yi(l,s,d),Mw(l,a,d)))}function Nw(s,a,l){var d=us();tu(s,a,l,d)}function tu(s,a,l,d){var g={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(yh(s))Lw(a,g);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var E=a.lastRenderedState,P=y(E,l);if(g.hasEagerState=!0,g.eagerState=P,ss(P,E))return Qd(s,a,g,0),dn===null&&Jd(),!1}catch{}if(l=Pm(s,a,g,d),l!==null)return Yi(l,s,d),Mw(l,a,d),!0}return!1}function Sg(s,a,l,d){if(d={lane:2,revertLane:Qg(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},yh(s)){if(a)throw Error(i(479))}else a=Pm(s,l,d,2),a!==null&&Yi(a,s,2)}function yh(s){var a=s.alternate;return s===yt||a!==null&&a===yt}function Lw(s,a){yl=hh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function Mw(s,a,l){if((l&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,l|=d,a.lanes=l,et(s,l)}}var nu={readContext:_i,use:mh,useCallback:An,useContext:An,useEffect:An,useImperativeHandle:An,useLayoutEffect:An,useInsertionEffect:An,useMemo:An,useReducer:An,useRef:An,useState:An,useDebugValue:An,useDeferredValue:An,useTransition:An,useSyncExternalStore:An,useId:An,useHostTransitionStatus:An,useFormState:An,useActionState:An,useOptimistic:An,useMemoCache:An,useCacheRefresh:An};nu.useEffectEvent=An;var jw={readContext:_i,use:mh,useCallback:function(s,a){return Mi().memoizedState=[s,a===void 0?null:a],s},useContext:_i,useEffect:gw,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,_h(4194308,4,bw.bind(null,a,s),l)},useLayoutEffect:function(s,a){return _h(4194308,4,s,a)},useInsertionEffect:function(s,a){_h(4,2,s,a)},useMemo:function(s,a){var l=Mi();a=a===void 0?null:a;var d=s();if(xo){Tt(!0);try{s()}finally{Tt(!1)}}return l.memoizedState=[d,a],d},useReducer:function(s,a,l){var d=Mi();if(l!==void 0){var g=l(a);if(xo){Tt(!0);try{l(a)}finally{Tt(!1)}}}else g=a;return d.memoizedState=d.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},d.queue=s,s=s.dispatch=C6.bind(null,yt,s),[d.memoizedState,s]},useRef:function(s){var a=Mi();return s={current:s},a.memoizedState=s},useState:function(s){s=pg(s);var a=s.queue,l=Nw.bind(null,yt,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:_g,useDeferredValue:function(s,a){var l=Mi();return vg(l,s,a)},useTransition:function(){var s=pg(!1);return s=kw.bind(null,yt,s.queue,!0,!1),Mi().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var d=yt,g=Mi();if(Pt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),dn===null)throw Error(i(349));(Dt&127)!==0||ew(d,a,l)}g.memoizedState=l;var y={value:l,getSnapshot:a};return g.queue=y,gw(nw.bind(null,d,y,s),[s]),d.flags|=2048,Sl(9,{destroy:void 0},tw.bind(null,d,y,l,a),null),l},useId:function(){var s=Mi(),a=dn.identifierPrefix;if(Pt){var l=or,d=ar;l=(d&~(1<<32-$t(d)-1)).toString(32)+l,a="_"+a+"R_"+l,l=fh++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=_6++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:bg,useFormState:dw,useActionState:dw,useOptimistic:function(s){var a=Mi();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=Sg.bind(null,yt,!0,l),l.dispatch=a,[s,a]},useMemoCache:dg,useCacheRefresh:function(){return Mi().memoizedState=x6.bind(null,yt)},useEffectEvent:function(s){var a=Mi(),l={impl:s};return a.memoizedState=l,function(){if((Kt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},wg={readContext:_i,use:mh,useCallback:ww,useContext:_i,useEffect:gg,useImperativeHandle:Sw,useInsertionEffect:vw,useLayoutEffect:yw,useMemo:xw,useReducer:gh,useRef:mw,useState:function(){return gh(Ir)},useDebugValue:_g,useDeferredValue:function(s,a){var l=Bn();return Cw(l,sn.memoizedState,s,a)},useTransition:function(){var s=gh(Ir)[0],a=Bn().memoizedState;return[typeof s=="boolean"?s:eu(s),a]},useSyncExternalStore:QS,useId:Aw,useHostTransitionStatus:bg,useFormState:hw,useActionState:hw,useOptimistic:function(s,a){var l=Bn();return rw(l,sn,s,a)},useMemoCache:dg,useCacheRefresh:Rw};wg.useEffectEvent=_w;var Ow={readContext:_i,use:mh,useCallback:ww,useContext:_i,useEffect:gg,useImperativeHandle:Sw,useInsertionEffect:vw,useLayoutEffect:yw,useMemo:xw,useReducer:fg,useRef:mw,useState:function(){return fg(Ir)},useDebugValue:_g,useDeferredValue:function(s,a){var l=Bn();return sn===null?vg(l,s,a):Cw(l,sn.memoizedState,s,a)},useTransition:function(){var s=fg(Ir)[0],a=Bn().memoizedState;return[typeof s=="boolean"?s:eu(s),a]},useSyncExternalStore:QS,useId:Aw,useHostTransitionStatus:bg,useFormState:pw,useActionState:pw,useOptimistic:function(s,a){var l=Bn();return sn!==null?rw(l,sn,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:dg,useCacheRefresh:Rw};Ow.useEffectEvent=_w;function xg(s,a,l,d){a=s.memoizedState,l=l(d,a),l=l==null?a:_({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Cg={enqueueSetState:function(s,a,l){s=s._reactInternals;var d=us(),g=Sa(d);g.payload=a,l!=null&&(g.callback=l),a=wa(s,g,d),a!==null&&(Yi(a,s,d),Xc(a,s,d))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var d=us(),g=Sa(d);g.tag=1,g.payload=a,l!=null&&(g.callback=l),a=wa(s,g,d),a!==null&&(Yi(a,s,d),Xc(a,s,d))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=us(),d=Sa(l);d.tag=2,a!=null&&(d.callback=a),a=wa(s,d,l),a!==null&&(Yi(a,s,l),Xc(a,s,l))}};function Dw(s,a,l,d,g,y,E){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,y,E):a.prototype&&a.prototype.isPureReactComponent?!Fc(l,d)||!Fc(g,y):!0}function Iw(s,a,l,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,d),a.state!==s&&Cg.enqueueReplaceState(a,a.state,null)}function Co(s,a){var l=a;if("ref"in a){l={};for(var d in a)d!=="ref"&&(l[d]=a[d])}if(s=s.defaultProps){l===a&&(l=_({},l));for(var g in s)l[g]===void 0&&(l[g]=s[g])}return l}function Bw(s){Zd(s)}function Pw(s){console.error(s)}function $w(s){Zd(s)}function bh(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function zw(s,a,l){try{var d=s.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function kg(s,a,l){return l=Sa(l),l.tag=3,l.payload={element:null},l.callback=function(){bh(s,a)},l}function Hw(s){return s=Sa(s),s.tag=3,s}function Fw(s,a,l,d){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var y=d.value;s.payload=function(){return g(y)},s.callback=function(){zw(a,l,d)}}var E=l.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(s.callback=function(){zw(a,l,d),typeof g!="function"&&(Aa===null?Aa=new Set([this]):Aa.add(this));var P=d.stack;this.componentDidCatch(d.value,{componentStack:P!==null?P:""})})}function k6(s,a,l,d,g){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=l.alternate,a!==null&&fl(a,l,g,!0),l=as.current,l!==null){switch(l.tag){case 31:case 13:return Es===null?Mh():l.alternate===null&&Rn===0&&(Rn=3),l.flags&=-257,l.flags|=65536,l.lanes=g,d===oh?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([d]):a.add(d),Xg(s,d,g)),!1;case 22:return l.flags|=65536,d===oh?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([d]):l.add(d)),Xg(s,d,g)),!1}throw Error(i(435,l.tag))}return Xg(s,d,g),Mh(),!1}if(Pt)return a=as.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,d!==Wm&&(s=Error(i(422),{cause:d}),qc(ws(s,l)))):(d!==Wm&&(a=Error(i(423),{cause:d}),qc(ws(a,l))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,d=ws(d,l),g=kg(s.stateNode,d,g),tg(s,g),Rn!==4&&(Rn=2)),!1;var y=Error(i(520),{cause:d});if(y=ws(y,l),uu===null?uu=[y]:uu.push(y),Rn!==4&&(Rn=2),a===null)return!0;d=ws(d,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=g&-g,l.lanes|=s,s=kg(l.stateNode,d,s),tg(l,s),!1;case 1:if(a=l.type,y=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Aa===null||!Aa.has(y))))return l.flags|=65536,g&=-g,l.lanes|=g,g=Hw(g),Fw(g,s,l,d),tg(l,g),!1}l=l.return}while(l!==null);return!1}var Eg=Error(i(461)),Fn=!1;function vi(s,a,l,d){a.child=s===null?GS(a,null,l,d):wo(a,s.child,l,d)}function Uw(s,a,l,d,g){l=l.render;var y=a.ref;if("ref"in d){var E={};for(var P in d)P!=="ref"&&(E[P]=d[P])}else E=d;return vo(a),d=og(s,a,l,E,y,g),P=lg(),s!==null&&!Fn?(cg(s,a,g),Br(s,a,g)):(Pt&&P&&Fm(a),a.flags|=1,vi(s,a,d,g),a.child)}function Ww(s,a,l,d,g){if(s===null){var y=l.type;return typeof y=="function"&&!$m(y)&&y.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=y,qw(s,a,y,d,g)):(s=th(l.type,null,d,a,a.mode,g),s.ref=a.ref,s.return=a,a.child=s)}if(y=s.child,!Og(s,g)){var E=y.memoizedProps;if(l=l.compare,l=l!==null?l:Fc,l(E,d)&&s.ref===a.ref)return Br(s,a,g)}return a.flags|=1,s=Lr(y,d),s.ref=a.ref,s.return=a,a.child=s}function qw(s,a,l,d,g){if(s!==null){var y=s.memoizedProps;if(Fc(y,d)&&s.ref===a.ref)if(Fn=!1,a.pendingProps=d=y,Og(s,g))(s.flags&131072)!==0&&(Fn=!0);else return a.lanes=s.lanes,Br(s,a,g)}return Tg(s,a,l,d,g)}function Gw(s,a,l,d){var g=d.children,y=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|l:l,s!==null){for(d=a.child=s.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~y}else d=0,a.child=null;return Kw(s,a,y,l,d)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&rh(a,y!==null?y.cachePool:null),y!==null?YS(a,y):ig(),XS(a);else return d=a.lanes=536870912,Kw(s,a,y!==null?y.baseLanes|l:l,l,d)}else y!==null?(rh(a,y.cachePool),YS(a,y),Ca(),a.memoizedState=null):(s!==null&&rh(a,null),ig(),Ca());return vi(s,a,g,l),a.child}function iu(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Kw(s,a,l,d,g){var y=Zm();return y=y===null?null:{parent:zn._currentValue,pool:y},a.memoizedState={baseLanes:l,cachePool:y},s!==null&&rh(a,null),ig(),XS(a),s!==null&&fl(s,a,d,!0),a.childLanes=g,null}function Sh(s,a){return a=xh({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function Vw(s,a,l){return wo(a,s.child,null,l),s=Sh(a,a.pendingProps),s.flags|=2,os(a),a.memoizedState=null,s}function E6(s,a,l){var d=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Pt){if(d.mode==="hidden")return s=Sh(a,d),a.lanes=536870912,iu(null,s);if(rg(a),(s=mn)?(s=aC(s,ks),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ga!==null?{id:ar,overflow:or}:null,retryLane:536870912,hydrationErrors:null},l=LS(s),l.return=a,a.child=l,gi=a,mn=null)):s=null,s===null)throw va(a);return a.lanes=536870912,null}return Sh(a,d)}var y=s.memoizedState;if(y!==null){var E=y.dehydrated;if(rg(a),g)if(a.flags&256)a.flags&=-257,a=Vw(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(Fn||fl(s,a,l,!1),g=(l&s.childLanes)!==0,Fn||g){if(d=dn,d!==null&&(E=fn(d,l),E!==0&&E!==y.retryLane))throw y.retryLane=E,po(s,E),Yi(d,s,E),Eg;Mh(),a=Vw(s,a,l)}else s=y.treeContext,mn=Ts(E.nextSibling),gi=a,Pt=!0,_a=null,ks=!1,s!==null&&OS(a,s),a=Sh(a,d),a.flags|=4096;return a}return s=Lr(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function wh(s,a){var l=a.ref;if(l===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(s===null||s.ref!==l)&&(a.flags|=4194816)}}function Tg(s,a,l,d,g){return vo(a),l=og(s,a,l,d,void 0,g),d=lg(),s!==null&&!Fn?(cg(s,a,g),Br(s,a,g)):(Pt&&d&&Fm(a),a.flags|=1,vi(s,a,l,g),a.child)}function Yw(s,a,l,d,g,y){return vo(a),a.updateQueue=null,l=JS(a,d,l,g),ZS(s),d=lg(),s!==null&&!Fn?(cg(s,a,y),Br(s,a,y)):(Pt&&d&&Fm(a),a.flags|=1,vi(s,a,l,y),a.child)}function Xw(s,a,l,d,g){if(vo(a),a.stateNode===null){var y=cl,E=l.contextType;typeof E=="object"&&E!==null&&(y=_i(E)),y=new l(d,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Cg,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=d,y.state=a.memoizedState,y.refs={},Qm(a),E=l.contextType,y.context=typeof E=="object"&&E!==null?_i(E):cl,y.state=a.memoizedState,E=l.getDerivedStateFromProps,typeof E=="function"&&(xg(a,l,E,d),y.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&Cg.enqueueReplaceState(y,y.state,null),Jc(a,d,y,g),Zc(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){y=a.stateNode;var P=a.memoizedProps,J=Co(l,P);y.props=J;var ae=y.context,me=l.contextType;E=cl,typeof me=="object"&&me!==null&&(E=_i(me));var ve=l.getDerivedStateFromProps;me=typeof ve=="function"||typeof y.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,me||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(P||ae!==E)&&Iw(a,y,d,E),ba=!1;var ce=a.memoizedState;y.state=ce,Jc(a,d,y,g),Zc(),ae=a.memoizedState,P||ce!==ae||ba?(typeof ve=="function"&&(xg(a,l,ve,d),ae=a.memoizedState),(J=ba||Dw(a,l,J,d,ce,ae,E))?(me||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ae),y.props=d,y.state=ae,y.context=E,d=J):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{y=a.stateNode,eg(s,a),E=a.memoizedProps,me=Co(l,E),y.props=me,ve=a.pendingProps,ce=y.context,ae=l.contextType,J=cl,typeof ae=="object"&&ae!==null&&(J=_i(ae)),P=l.getDerivedStateFromProps,(ae=typeof P=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==ve||ce!==J)&&Iw(a,y,d,J),ba=!1,ce=a.memoizedState,y.state=ce,Jc(a,d,y,g),Zc();var he=a.memoizedState;E!==ve||ce!==he||ba||s!==null&&s.dependencies!==null&&ih(s.dependencies)?(typeof P=="function"&&(xg(a,l,P,d),he=a.memoizedState),(me=ba||Dw(a,l,me,d,ce,he,J)||s!==null&&s.dependencies!==null&&ih(s.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,he,J),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,he,J)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===s.memoizedProps&&ce===s.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===s.memoizedProps&&ce===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=he),y.props=d,y.state=he,y.context=J,d=me):(typeof y.componentDidUpdate!="function"||E===s.memoizedProps&&ce===s.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===s.memoizedProps&&ce===s.memoizedState||(a.flags|=1024),d=!1)}return y=d,wh(s,a),d=(a.flags&128)!==0,y||d?(y=a.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,s!==null&&d?(a.child=wo(a,s.child,null,g),a.child=wo(a,null,l,g)):vi(s,a,l,g),a.memoizedState=y.state,s=a.child):s=Br(s,a,g),s}function Zw(s,a,l,d){return go(),a.flags|=256,vi(s,a,l,d),a.child}var Ag={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rg(s){return{baseLanes:s,cachePool:zS()}}function Ng(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=cs),s}function Jw(s,a,l){var d=a.pendingProps,g=!1,y=(a.flags&128)!==0,E;if((E=y)||(E=s!==null&&s.memoizedState===null?!1:(In.current&2)!==0),E&&(g=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,s===null){if(Pt){if(g?xa(a):Ca(),(s=mn)?(s=aC(s,ks),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ga!==null?{id:ar,overflow:or}:null,retryLane:536870912,hydrationErrors:null},l=LS(s),l.return=a,a.child=l,gi=a,mn=null)):s=null,s===null)throw va(a);return h_(s)?a.lanes=32:a.lanes=536870912,null}var P=d.children;return d=d.fallback,g?(Ca(),g=a.mode,P=xh({mode:"hidden",children:P},g),d=mo(d,g,l,null),P.return=a,d.return=a,P.sibling=d,a.child=P,d=a.child,d.memoizedState=Rg(l),d.childLanes=Ng(s,E,l),a.memoizedState=Ag,iu(null,d)):(xa(a),Lg(a,P))}var J=s.memoizedState;if(J!==null&&(P=J.dehydrated,P!==null)){if(y)a.flags&256?(xa(a),a.flags&=-257,a=Mg(s,a,l)):a.memoizedState!==null?(Ca(),a.child=s.child,a.flags|=128,a=null):(Ca(),P=d.fallback,g=a.mode,d=xh({mode:"visible",children:d.children},g),P=mo(P,g,l,null),P.flags|=2,d.return=a,P.return=a,d.sibling=P,a.child=d,wo(a,s.child,null,l),d=a.child,d.memoizedState=Rg(l),d.childLanes=Ng(s,E,l),a.memoizedState=Ag,a=iu(null,d));else if(xa(a),h_(P)){if(E=P.nextSibling&&P.nextSibling.dataset,E)var ae=E.dgst;E=ae,d=Error(i(419)),d.stack="",d.digest=E,qc({value:d,source:null,stack:null}),a=Mg(s,a,l)}else if(Fn||fl(s,a,l,!1),E=(l&s.childLanes)!==0,Fn||E){if(E=dn,E!==null&&(d=fn(E,l),d!==0&&d!==J.retryLane))throw J.retryLane=d,po(s,d),Yi(E,s,d),Eg;d_(P)||Mh(),a=Mg(s,a,l)}else d_(P)?(a.flags|=192,a.child=s.child,a=null):(s=J.treeContext,mn=Ts(P.nextSibling),gi=a,Pt=!0,_a=null,ks=!1,s!==null&&OS(a,s),a=Lg(a,d.children),a.flags|=4096);return a}return g?(Ca(),P=d.fallback,g=a.mode,J=s.child,ae=J.sibling,d=Lr(J,{mode:"hidden",children:d.children}),d.subtreeFlags=J.subtreeFlags&65011712,ae!==null?P=Lr(ae,P):(P=mo(P,g,l,null),P.flags|=2),P.return=a,d.return=a,d.sibling=P,a.child=d,iu(null,d),d=a.child,P=s.child.memoizedState,P===null?P=Rg(l):(g=P.cachePool,g!==null?(J=zn._currentValue,g=g.parent!==J?{parent:J,pool:J}:g):g=zS(),P={baseLanes:P.baseLanes|l,cachePool:g}),d.memoizedState=P,d.childLanes=Ng(s,E,l),a.memoizedState=Ag,iu(s.child,d)):(xa(a),l=s.child,s=l.sibling,l=Lr(l,{mode:"visible",children:d.children}),l.return=a,l.sibling=null,s!==null&&(E=a.deletions,E===null?(a.deletions=[s],a.flags|=16):E.push(s)),a.child=l,a.memoizedState=null,l)}function Lg(s,a){return a=xh({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function xh(s,a){return s=rs(22,s,null,a),s.lanes=0,s}function Mg(s,a,l){return wo(a,s.child,null,l),s=Lg(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function Qw(s,a,l){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),Km(s.return,a,l)}function jg(s,a,l,d,g,y){var E=s.memoizedState;E===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g,treeForkCount:y}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=l,E.tailMode=g,E.treeForkCount=y)}function ex(s,a,l){var d=a.pendingProps,g=d.revealOrder,y=d.tail;d=d.children;var E=In.current,P=(E&2)!==0;if(P?(E=E&1|2,a.flags|=128):E&=1,H(In,E),vi(s,a,d,l),d=Pt?Wc:0,!P&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Qw(s,l,a);else if(s.tag===19)Qw(s,l,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(g){case"forwards":for(l=a.child,g=null;l!==null;)s=l.alternate,s!==null&&dh(s)===null&&(g=l),l=l.sibling;l=g,l===null?(g=a.child,a.child=null):(g=l.sibling,l.sibling=null),jg(a,!1,g,l,y,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=a.child,a.child=null;g!==null;){if(s=g.alternate,s!==null&&dh(s)===null){a.child=g;break}s=g.sibling,g.sibling=l,l=g,g=s}jg(a,!0,l,null,y,d);break;case"together":jg(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Br(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),Ta|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(fl(s,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,l=Lr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=Lr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function Og(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&ih(s)))}function T6(s,a,l){switch(a.tag){case 3:fe(a,a.stateNode.containerInfo),ya(a,zn,s.memoizedState.cache),go();break;case 27:case 5:rt(a);break;case 4:fe(a,a.stateNode.containerInfo);break;case 10:ya(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,rg(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(xa(a),a.flags|=128,null):(l&a.child.childLanes)!==0?Jw(s,a,l):(xa(a),s=Br(s,a,l),s!==null?s.sibling:null);xa(a);break;case 19:var g=(s.flags&128)!==0;if(d=(l&a.childLanes)!==0,d||(fl(s,a,l,!1),d=(l&a.childLanes)!==0),g){if(d)return ex(s,a,l);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),H(In,In.current),d)break;return null;case 22:return a.lanes=0,Gw(s,a,l,a.pendingProps);case 24:ya(a,zn,s.memoizedState.cache)}return Br(s,a,l)}function tx(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)Fn=!0;else{if(!Og(s,l)&&(a.flags&128)===0)return Fn=!1,T6(s,a,l);Fn=(s.flags&131072)!==0}else Fn=!1,Pt&&(a.flags&1048576)!==0&&jS(a,Wc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=bo(a.elementType),a.type=s,typeof s=="function")$m(s)?(d=Co(s,d),a.tag=1,a=Xw(null,a,s,d,l)):(a.tag=0,a=Tg(null,a,s,d,l));else{if(s!=null){var g=s.$$typeof;if(g===N){a.tag=11,a=Uw(null,a,s,d,l);break e}else if(g===U){a.tag=14,a=Ww(null,a,s,d,l);break e}}throw a=B(s)||s,Error(i(306,a,""))}}return a;case 0:return Tg(s,a,a.type,a.pendingProps,l);case 1:return d=a.type,g=Co(d,a.pendingProps),Xw(s,a,d,g,l);case 3:e:{if(fe(a,a.stateNode.containerInfo),s===null)throw Error(i(387));d=a.pendingProps;var y=a.memoizedState;g=y.element,eg(s,a),Jc(a,d,null,l);var E=a.memoizedState;if(d=E.cache,ya(a,zn,d),d!==y.cache&&Vm(a,[zn],l,!0),Zc(),d=E.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:E.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Zw(s,a,d,l);break e}else if(d!==g){g=ws(Error(i(424)),a),qc(g),a=Zw(s,a,d,l);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,mn=Ts(s.firstChild),gi=a,Pt=!0,_a=null,ks=!0,l=GS(a,null,d,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(go(),d===g){a=Br(s,a,l);break e}vi(s,a,d,l)}a=a.child}return a;case 26:return wh(s,a),s===null?(l=hC(a.type,null,a.pendingProps,null))?a.memoizedState=l:Pt||(l=a.type,s=a.pendingProps,d=$h(Se.current).createElement(l),d[en]=a,d[tn]=s,yi(d,l,s),Qe(d),a.stateNode=d):a.memoizedState=hC(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return rt(a),s===null&&Pt&&(d=a.stateNode=cC(a.type,a.pendingProps,Se.current),gi=a,ks=!0,g=mn,Ma(a.type)?(f_=g,mn=Ts(d.firstChild)):mn=g),vi(s,a,a.pendingProps.children,l),wh(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Pt&&((g=d=mn)&&(d=i4(d,a.type,a.pendingProps,ks),d!==null?(a.stateNode=d,gi=a,mn=Ts(d.firstChild),ks=!1,g=!0):g=!1),g||va(a)),rt(a),g=a.type,y=a.pendingProps,E=s!==null?s.memoizedProps:null,d=y.children,l_(g,y)?d=null:E!==null&&l_(g,E)&&(a.flags|=32),a.memoizedState!==null&&(g=og(s,a,v6,null,null,l),vu._currentValue=g),wh(s,a),vi(s,a,d,l),a.child;case 6:return s===null&&Pt&&((s=l=mn)&&(l=s4(l,a.pendingProps,ks),l!==null?(a.stateNode=l,gi=a,mn=null,s=!0):s=!1),s||va(a)),null;case 13:return Jw(s,a,l);case 4:return fe(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=wo(a,null,d,l):vi(s,a,d,l),a.child;case 11:return Uw(s,a,a.type,a.pendingProps,l);case 7:return vi(s,a,a.pendingProps,l),a.child;case 8:return vi(s,a,a.pendingProps.children,l),a.child;case 12:return vi(s,a,a.pendingProps.children,l),a.child;case 10:return d=a.pendingProps,ya(a,a.type,d.value),vi(s,a,d.children,l),a.child;case 9:return g=a.type._context,d=a.pendingProps.children,vo(a),g=_i(g),d=d(g),a.flags|=1,vi(s,a,d,l),a.child;case 14:return Ww(s,a,a.type,a.pendingProps,l);case 15:return qw(s,a,a.type,a.pendingProps,l);case 19:return ex(s,a,l);case 31:return E6(s,a,l);case 22:return Gw(s,a,l,a.pendingProps);case 24:return vo(a),d=_i(zn),s===null?(g=Zm(),g===null&&(g=dn,y=Ym(),g.pooledCache=y,y.refCount++,y!==null&&(g.pooledCacheLanes|=l),g=y),a.memoizedState={parent:d,cache:g},Qm(a),ya(a,zn,g)):((s.lanes&l)!==0&&(eg(s,a),Jc(a,null,null,l),Zc()),g=s.memoizedState,y=a.memoizedState,g.parent!==d?(g={parent:d,cache:d},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),ya(a,zn,d)):(d=y.cache,ya(a,zn,d),d!==g.cache&&Vm(a,[zn],l,!0))),vi(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Pr(s){s.flags|=4}function Dg(s,a,l,d,g){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(Ax())s.flags|=8192;else throw So=oh,Jm}else s.flags&=-16777217}function nx(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!_C(a))if(Ax())s.flags|=8192;else throw So=oh,Jm}function Ch(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Ge():536870912,s.lanes|=a,kl|=a)}function su(s,a){if(!Pt)switch(s.tailMode){case"hidden":a=s.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function gn(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(a)for(var g=s.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=d,s.childLanes=l,a}function A6(s,a,l){var d=a.pendingProps;switch(Um(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(a),null;case 1:return gn(a),null;case 3:return l=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Or(zn),De(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(hl(a)?Pr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,qm())),gn(a),null;case 26:var g=a.type,y=a.memoizedState;return s===null?(Pr(a),y!==null?(gn(a),nx(a,y)):(gn(a),Dg(a,g,null,d,l))):y?y!==s.memoizedState?(Pr(a),gn(a),nx(a,y)):(gn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==d&&Pr(a),gn(a),Dg(a,g,s,d,l)),null;case 27:if(Ie(a),l=Se.current,g=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==d&&Pr(a);else{if(!d){if(a.stateNode===null)throw Error(i(166));return gn(a),null}s=ne.current,hl(a)?DS(a):(s=cC(g,d,l),a.stateNode=s,Pr(a))}return gn(a),null;case 5:if(Ie(a),g=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==d&&Pr(a);else{if(!d){if(a.stateNode===null)throw Error(i(166));return gn(a),null}if(y=ne.current,hl(a))DS(a);else{var E=$h(Se.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?E.createElement(g,{is:d.is}):E.createElement(g)}}y[en]=a,y[tn]=d;e:for(E=a.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===a)break e;for(;E.sibling===null;){if(E.return===null||E.return===a)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}a.stateNode=y;e:switch(yi(y,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Pr(a)}}return gn(a),Dg(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==d&&Pr(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=Se.current,hl(a)){if(s=a.stateNode,l=a.memoizedProps,d=null,g=gi,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}s[en]=a,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||Jx(s.nodeValue,l)),s||va(a,!0)}else s=$h(s).createTextNode(d),s[en]=a,a.stateNode=s}return gn(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(d=hl(a),l!==null){if(s===null){if(!d)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[en]=a}else go(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;gn(a),s=!1}else l=qm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(os(a),a):(os(a),null);if((a.flags&128)!==0)throw Error(i(558))}return gn(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=hl(a),d!==null&&d.dehydrated!==null){if(s===null){if(!g)throw Error(i(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));g[en]=a}else go(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;gn(a),g=!1}else g=qm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(os(a),a):(os(a),null)}return os(a),(a.flags&128)!==0?(a.lanes=l,a):(l=d!==null,s=s!==null&&s.memoizedState!==null,l&&(d=a.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==g&&(d.flags|=2048)),l!==s&&l&&(a.child.flags|=8192),Ch(a,a.updateQueue),gn(a),null);case 4:return De(),s===null&&i_(a.stateNode.containerInfo),gn(a),null;case 10:return Or(a.type),gn(a),null;case 19:if(q(In),d=a.memoizedState,d===null)return gn(a),null;if(g=(a.flags&128)!==0,y=d.rendering,y===null)if(g)su(d,!1);else{if(Rn!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(y=dh(s),y!==null){for(a.flags|=128,su(d,!1),s=y.updateQueue,a.updateQueue=s,Ch(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)NS(l,s),l=l.sibling;return H(In,In.current&1|2),Pt&&Mr(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&st()>Rh&&(a.flags|=128,g=!0,su(d,!1),a.lanes=4194304)}else{if(!g)if(s=dh(y),s!==null){if(a.flags|=128,g=!0,s=s.updateQueue,a.updateQueue=s,Ch(a,s),su(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!Pt)return gn(a),null}else 2*st()-d.renderingStartTime>Rh&&l!==536870912&&(a.flags|=128,g=!0,su(d,!1),a.lanes=4194304);d.isBackwards?(y.sibling=a.child,a.child=y):(s=d.last,s!==null?s.sibling=y:a.child=y,d.last=y)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=st(),s.sibling=null,l=In.current,H(In,g?l&1|2:l&1),Pt&&Mr(a,d.treeForkCount),s):(gn(a),null);case 22:case 23:return os(a),sg(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(l&536870912)!==0&&(a.flags&128)===0&&(gn(a),a.subtreeFlags&6&&(a.flags|=8192)):gn(a),l=a.updateQueue,l!==null&&Ch(a,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==l&&(a.flags|=2048),s!==null&&q(yo),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Or(zn),gn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function R6(s,a){switch(Um(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Or(zn),De(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Ie(a),null;case 31:if(a.memoizedState!==null){if(os(a),a.alternate===null)throw Error(i(340));go()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(os(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));go()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return q(In),null;case 4:return De(),null;case 10:return Or(a.type),null;case 22:case 23:return os(a),sg(),s!==null&&q(yo),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Or(zn),null;case 25:return null;default:return null}}function ix(s,a){switch(Um(a),a.tag){case 3:Or(zn),De();break;case 26:case 27:case 5:Ie(a);break;case 4:De();break;case 31:a.memoizedState!==null&&os(a);break;case 13:os(a);break;case 19:q(In);break;case 10:Or(a.type);break;case 22:case 23:os(a),sg(),s!==null&&q(yo);break;case 24:Or(zn)}}function ru(s,a){try{var l=a.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var g=d.next;l=g;do{if((l.tag&s)===s){d=void 0;var y=l.create,E=l.inst;d=y(),E.destroy=d}l=l.next}while(l!==g)}}catch(P){Jt(a,a.return,P)}}function ka(s,a,l){try{var d=a.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var y=g.next;d=y;do{if((d.tag&s)===s){var E=d.inst,P=E.destroy;if(P!==void 0){E.destroy=void 0,g=a;var J=l,ae=P;try{ae()}catch(me){Jt(g,J,me)}}}d=d.next}while(d!==y)}}catch(me){Jt(a,a.return,me)}}function sx(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{VS(a,l)}catch(d){Jt(s,s.return,d)}}}function rx(s,a,l){l.props=Co(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(d){Jt(s,a,d)}}function au(s,a){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof l=="function"?s.refCleanup=l(d):l.current=d}}catch(g){Jt(s,a,g)}}function lr(s,a){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(g){Jt(s,a,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){Jt(s,a,g)}else l.current=null}function ax(s){var a=s.type,l=s.memoizedProps,d=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(g){Jt(s,s.return,g)}}function Ig(s,a,l){try{var d=s.stateNode;Z6(d,s.type,l,a),d[tn]=a}catch(g){Jt(s,s.return,g)}}function ox(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ma(s.type)||s.tag===4}function Bg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||ox(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ma(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Pg(s,a,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(s),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Te));else if(d!==4&&(d===27&&Ma(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(Pg(s,a,l),s=s.sibling;s!==null;)Pg(s,a,l),s=s.sibling}function kh(s,a,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?l.insertBefore(s,a):l.appendChild(s);else if(d!==4&&(d===27&&Ma(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(kh(s,a,l),s=s.sibling;s!==null;)kh(s,a,l),s=s.sibling}function lx(s){var a=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);yi(a,d,l),a[en]=s,a[tn]=l}catch(y){Jt(s,s.return,y)}}var $r=!1,Un=!1,$g=!1,cx=typeof WeakSet=="function"?WeakSet:Set,si=null;function N6(s,a){if(s=s.containerInfo,a_=Gh,s=SS(s),Mm(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var E=0,P=-1,J=-1,ae=0,me=0,ve=s,ce=null;t:for(;;){for(var he;ve!==l||g!==0&&ve.nodeType!==3||(P=E+g),ve!==y||d!==0&&ve.nodeType!==3||(J=E+d),ve.nodeType===3&&(E+=ve.nodeValue.length),(he=ve.firstChild)!==null;)ce=ve,ve=he;for(;;){if(ve===s)break t;if(ce===l&&++ae===g&&(P=E),ce===y&&++me===d&&(J=E),(he=ve.nextSibling)!==null)break;ve=ce,ce=ve.parentNode}ve=he}l=P===-1||J===-1?null:{start:P,end:J}}else l=null}l=l||{start:0,end:0}}else l=null;for(o_={focusedElem:s,selectionRange:l},Gh=!1,si=a;si!==null;)if(a=si,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,si=s;else for(;si!==null;){switch(a=si,y=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)g=s[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&y!==null){s=void 0,l=a,g=y.memoizedProps,y=y.memoizedState,d=l.stateNode;try{var Ue=Co(l.type,g);s=d.getSnapshotBeforeUpdate(Ue,y),d.__reactInternalSnapshotBeforeUpdate=s}catch(at){Jt(l,l.return,at)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)u_(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":u_(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,si=s;break}si=a.return}}function ux(s,a,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Hr(s,l),d&4&&ru(5,l);break;case 1:if(Hr(s,l),d&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(E){Jt(l,l.return,E)}else{var g=Co(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(g,a,s.__reactInternalSnapshotBeforeUpdate)}catch(E){Jt(l,l.return,E)}}d&64&&sx(l),d&512&&au(l,l.return);break;case 3:if(Hr(s,l),d&64&&(s=l.updateQueue,s!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{VS(s,a)}catch(E){Jt(l,l.return,E)}}break;case 27:a===null&&d&4&&lx(l);case 26:case 5:Hr(s,l),a===null&&d&4&&ax(l),d&512&&au(l,l.return);break;case 12:Hr(s,l);break;case 31:Hr(s,l),d&4&&fx(s,l);break;case 13:Hr(s,l),d&4&&px(s,l),d&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=$6.bind(null,l),r4(s,l))));break;case 22:if(d=l.memoizedState!==null||$r,!d){a=a!==null&&a.memoizedState!==null||Un,g=$r;var y=Un;$r=d,(Un=a)&&!y?Fr(s,l,(l.subtreeFlags&8772)!==0):Hr(s,l),$r=g,Un=y}break;case 30:break;default:Hr(s,l)}}function dx(s){var a=s.alternate;a!==null&&(s.alternate=null,dx(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Ve(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Sn=null,qi=!1;function zr(s,a,l){for(l=l.child;l!==null;)hx(s,a,l),l=l.sibling}function hx(s,a,l){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(gt,l)}catch{}switch(l.tag){case 26:Un||lr(l,a),zr(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Un||lr(l,a);var d=Sn,g=qi;Ma(l.type)&&(Sn=l.stateNode,qi=!1),zr(s,a,l),mu(l.stateNode),Sn=d,qi=g;break;case 5:Un||lr(l,a);case 6:if(d=Sn,g=qi,Sn=null,zr(s,a,l),Sn=d,qi=g,Sn!==null)if(qi)try{(Sn.nodeType===9?Sn.body:Sn.nodeName==="HTML"?Sn.ownerDocument.body:Sn).removeChild(l.stateNode)}catch(y){Jt(l,a,y)}else try{Sn.removeChild(l.stateNode)}catch(y){Jt(l,a,y)}break;case 18:Sn!==null&&(qi?(s=Sn,sC(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),jl(s)):sC(Sn,l.stateNode));break;case 4:d=Sn,g=qi,Sn=l.stateNode.containerInfo,qi=!0,zr(s,a,l),Sn=d,qi=g;break;case 0:case 11:case 14:case 15:ka(2,l,a),Un||ka(4,l,a),zr(s,a,l);break;case 1:Un||(lr(l,a),d=l.stateNode,typeof d.componentWillUnmount=="function"&&rx(l,a,d)),zr(s,a,l);break;case 21:zr(s,a,l);break;case 22:Un=(d=Un)||l.memoizedState!==null,zr(s,a,l),Un=d;break;default:zr(s,a,l)}}function fx(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{jl(s)}catch(l){Jt(a,a.return,l)}}}function px(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{jl(s)}catch(l){Jt(a,a.return,l)}}function L6(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new cx),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new cx),a;default:throw Error(i(435,s.tag))}}function Eh(s,a){var l=L6(s);a.forEach(function(d){if(!l.has(d)){l.add(d);var g=z6.bind(null,s,d);d.then(g,g)}})}function Gi(s,a){var l=a.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d],y=s,E=a,P=E;e:for(;P!==null;){switch(P.tag){case 27:if(Ma(P.type)){Sn=P.stateNode,qi=!1;break e}break;case 5:Sn=P.stateNode,qi=!1;break e;case 3:case 4:Sn=P.stateNode.containerInfo,qi=!0;break e}P=P.return}if(Sn===null)throw Error(i(160));hx(y,E,g),Sn=null,qi=!1,y=g.alternate,y!==null&&(y.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)mx(a,s),a=a.sibling}var Ks=null;function mx(s,a){var l=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Gi(a,s),Ki(s),d&4&&(ka(3,s,s.return),ru(3,s),ka(5,s,s.return));break;case 1:Gi(a,s),Ki(s),d&512&&(Un||l===null||lr(l,l.return)),d&64&&$r&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var g=Ks;if(Gi(a,s),Ki(s),d&512&&(Un||l===null||lr(l,l.return)),d&4){var y=l!==null?l.memoizedState:null;if(d=s.memoizedState,l===null)if(d===null)if(s.stateNode===null){e:{d=s.type,l=s.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":y=g.getElementsByTagName("title")[0],(!y||y[Ui]||y[en]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=g.createElement(d),g.head.insertBefore(y,g.querySelector("head > title"))),yi(y,d,l),y[en]=s,Qe(y),d=y;break e;case"link":var E=mC("link","href",g).get(d+(l.href||""));if(E){for(var P=0;P<E.length;P++)if(y=E[P],y.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&y.getAttribute("rel")===(l.rel==null?null:l.rel)&&y.getAttribute("title")===(l.title==null?null:l.title)&&y.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){E.splice(P,1);break t}}y=g.createElement(d),yi(y,d,l),g.head.appendChild(y);break;case"meta":if(E=mC("meta","content",g).get(d+(l.content||""))){for(P=0;P<E.length;P++)if(y=E[P],y.getAttribute("content")===(l.content==null?null:""+l.content)&&y.getAttribute("name")===(l.name==null?null:l.name)&&y.getAttribute("property")===(l.property==null?null:l.property)&&y.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&y.getAttribute("charset")===(l.charSet==null?null:l.charSet)){E.splice(P,1);break t}}y=g.createElement(d),yi(y,d,l),g.head.appendChild(y);break;default:throw Error(i(468,d))}y[en]=s,Qe(y),d=y}s.stateNode=d}else gC(g,s.type,s.stateNode);else s.stateNode=pC(g,d,s.memoizedProps);else y!==d?(y===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):y.count--,d===null?gC(g,s.type,s.stateNode):pC(g,d,s.memoizedProps)):d===null&&s.stateNode!==null&&Ig(s,s.memoizedProps,l.memoizedProps)}break;case 27:Gi(a,s),Ki(s),d&512&&(Un||l===null||lr(l,l.return)),l!==null&&d&4&&Ig(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Gi(a,s),Ki(s),d&512&&(Un||l===null||lr(l,l.return)),s.flags&32){g=s.stateNode;try{ct(g,"")}catch(Ue){Jt(s,s.return,Ue)}}d&4&&s.stateNode!=null&&(g=s.memoizedProps,Ig(s,g,l!==null?l.memoizedProps:g)),d&1024&&($g=!0);break;case 6:if(Gi(a,s),Ki(s),d&4){if(s.stateNode===null)throw Error(i(162));d=s.memoizedProps,l=s.stateNode;try{l.nodeValue=d}catch(Ue){Jt(s,s.return,Ue)}}break;case 3:if(Fh=null,g=Ks,Ks=zh(a.containerInfo),Gi(a,s),Ks=g,Ki(s),d&4&&l!==null&&l.memoizedState.isDehydrated)try{jl(a.containerInfo)}catch(Ue){Jt(s,s.return,Ue)}$g&&($g=!1,gx(s));break;case 4:d=Ks,Ks=zh(s.stateNode.containerInfo),Gi(a,s),Ki(s),Ks=d;break;case 12:Gi(a,s),Ki(s);break;case 31:Gi(a,s),Ki(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Eh(s,d)));break;case 13:Gi(a,s),Ki(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Ah=st()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Eh(s,d)));break;case 22:g=s.memoizedState!==null;var J=l!==null&&l.memoizedState!==null,ae=$r,me=Un;if($r=ae||g,Un=me||J,Gi(a,s),Un=me,$r=ae,Ki(s),d&8192)e:for(a=s.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(l===null||J||$r||Un||ko(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){J=l=a;try{if(y=J.stateNode,g)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{P=J.stateNode;var ve=J.memoizedProps.style,ce=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;P.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Ue){Jt(J,J.return,Ue)}}}else if(a.tag===6){if(l===null){J=a;try{J.stateNode.nodeValue=g?"":J.memoizedProps}catch(Ue){Jt(J,J.return,Ue)}}}else if(a.tag===18){if(l===null){J=a;try{var he=J.stateNode;g?rC(he,!0):rC(J.stateNode,!1)}catch(Ue){Jt(J,J.return,Ue)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=s.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,Eh(s,l))));break;case 19:Gi(a,s),Ki(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Eh(s,d)));break;case 30:break;case 21:break;default:Gi(a,s),Ki(s)}}function Ki(s){var a=s.flags;if(a&2){try{for(var l,d=s.return;d!==null;){if(ox(d)){l=d;break}d=d.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var g=l.stateNode,y=Bg(s);kh(s,y,g);break;case 5:var E=l.stateNode;l.flags&32&&(ct(E,""),l.flags&=-33);var P=Bg(s);kh(s,P,E);break;case 3:case 4:var J=l.stateNode.containerInfo,ae=Bg(s);Pg(s,ae,J);break;default:throw Error(i(161))}}catch(me){Jt(s,s.return,me)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function gx(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;gx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Hr(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ux(s,a.alternate,a),a=a.sibling}function ko(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ka(4,a,a.return),ko(a);break;case 1:lr(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&rx(a,a.return,l),ko(a);break;case 27:mu(a.stateNode);case 26:case 5:lr(a,a.return),ko(a);break;case 22:a.memoizedState===null&&ko(a);break;case 30:ko(a);break;default:ko(a)}s=s.sibling}}function Fr(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,g=s,y=a,E=y.flags;switch(y.tag){case 0:case 11:case 15:Fr(g,y,l),ru(4,y);break;case 1:if(Fr(g,y,l),d=y,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ae){Jt(d,d.return,ae)}if(d=y,g=d.updateQueue,g!==null){var P=d.stateNode;try{var J=g.shared.hiddenCallbacks;if(J!==null)for(g.shared.hiddenCallbacks=null,g=0;g<J.length;g++)KS(J[g],P)}catch(ae){Jt(d,d.return,ae)}}l&&E&64&&sx(y),au(y,y.return);break;case 27:lx(y);case 26:case 5:Fr(g,y,l),l&&d===null&&E&4&&ax(y),au(y,y.return);break;case 12:Fr(g,y,l);break;case 31:Fr(g,y,l),l&&E&4&&fx(g,y);break;case 13:Fr(g,y,l),l&&E&4&&px(g,y);break;case 22:y.memoizedState===null&&Fr(g,y,l),au(y,y.return);break;case 30:break;default:Fr(g,y,l)}a=a.sibling}}function zg(s,a){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&Gc(l))}function Hg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Gc(s))}function Vs(s,a,l,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)_x(s,a,l,d),a=a.sibling}function _x(s,a,l,d){var g=a.flags;switch(a.tag){case 0:case 11:case 15:Vs(s,a,l,d),g&2048&&ru(9,a);break;case 1:Vs(s,a,l,d);break;case 3:Vs(s,a,l,d),g&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Gc(s)));break;case 12:if(g&2048){Vs(s,a,l,d),s=a.stateNode;try{var y=a.memoizedProps,E=y.id,P=y.onPostCommit;typeof P=="function"&&P(E,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(J){Jt(a,a.return,J)}}else Vs(s,a,l,d);break;case 31:Vs(s,a,l,d);break;case 13:Vs(s,a,l,d);break;case 23:break;case 22:y=a.stateNode,E=a.alternate,a.memoizedState!==null?y._visibility&2?Vs(s,a,l,d):ou(s,a):y._visibility&2?Vs(s,a,l,d):(y._visibility|=2,wl(s,a,l,d,(a.subtreeFlags&10256)!==0||!1)),g&2048&&zg(E,a);break;case 24:Vs(s,a,l,d),g&2048&&Hg(a.alternate,a);break;default:Vs(s,a,l,d)}}function wl(s,a,l,d,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=s,E=a,P=l,J=d,ae=E.flags;switch(E.tag){case 0:case 11:case 15:wl(y,E,P,J,g),ru(8,E);break;case 23:break;case 22:var me=E.stateNode;E.memoizedState!==null?me._visibility&2?wl(y,E,P,J,g):ou(y,E):(me._visibility|=2,wl(y,E,P,J,g)),g&&ae&2048&&zg(E.alternate,E);break;case 24:wl(y,E,P,J,g),g&&ae&2048&&Hg(E.alternate,E);break;default:wl(y,E,P,J,g)}a=a.sibling}}function ou(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=s,d=a,g=d.flags;switch(d.tag){case 22:ou(l,d),g&2048&&zg(d.alternate,d);break;case 24:ou(l,d),g&2048&&Hg(d.alternate,d);break;default:ou(l,d)}a=a.sibling}}var lu=8192;function xl(s,a,l){if(s.subtreeFlags&lu)for(s=s.child;s!==null;)vx(s,a,l),s=s.sibling}function vx(s,a,l){switch(s.tag){case 26:xl(s,a,l),s.flags&lu&&s.memoizedState!==null&&_4(l,Ks,s.memoizedState,s.memoizedProps);break;case 5:xl(s,a,l);break;case 3:case 4:var d=Ks;Ks=zh(s.stateNode.containerInfo),xl(s,a,l),Ks=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=lu,lu=16777216,xl(s,a,l),lu=d):xl(s,a,l));break;default:xl(s,a,l)}}function yx(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function cu(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var d=a[l];si=d,Sx(d,s)}yx(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)bx(s),s=s.sibling}function bx(s){switch(s.tag){case 0:case 11:case 15:cu(s),s.flags&2048&&ka(9,s,s.return);break;case 3:cu(s);break;case 12:cu(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Th(s)):cu(s);break;default:cu(s)}}function Th(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var d=a[l];si=d,Sx(d,s)}yx(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ka(8,a,a.return),Th(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,Th(a));break;default:Th(a)}s=s.sibling}}function Sx(s,a){for(;si!==null;){var l=si;switch(l.tag){case 0:case 11:case 15:ka(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Gc(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,si=d;else e:for(l=s;si!==null;){d=si;var g=d.sibling,y=d.return;if(dx(d),d===l){si=null;break e}if(g!==null){g.return=y,si=g;break e}si=y}}}var M6={getCacheForType:function(s){var a=_i(zn),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return _i(zn).controller.signal}},j6=typeof WeakMap=="function"?WeakMap:Map,Kt=0,dn=null,Nt=null,Dt=0,Zt=0,ls=null,Ea=!1,Cl=!1,Fg=!1,Ur=0,Rn=0,Ta=0,Eo=0,Ug=0,cs=0,kl=0,uu=null,Vi=null,Wg=!1,Ah=0,wx=0,Rh=1/0,Nh=null,Aa=null,Xn=0,Ra=null,El=null,Wr=0,qg=0,Gg=null,xx=null,du=0,Kg=null;function us(){return(Kt&2)!==0&&Dt!==0?Dt&-Dt:k.T!==null?Qg():Li()}function Cx(){if(cs===0)if((Dt&536870912)===0||Pt){var s=Le;Le<<=1,(Le&3932160)===0&&(Le=262144),cs=s}else cs=536870912;return s=as.current,s!==null&&(s.flags|=32),cs}function Yi(s,a,l){(s===dn&&(Zt===2||Zt===9)||s.cancelPendingCommit!==null)&&(Tl(s,0),Na(s,Dt,cs,!1)),jt(s,l),((Kt&2)===0||s!==dn)&&(s===dn&&((Kt&2)===0&&(Eo|=l),Rn===4&&Na(s,Dt,cs,!1)),cr(s))}function kx(s,a,l){if((Kt&6)!==0)throw Error(i(327));var d=!l&&(a&127)===0&&(a&s.expiredLanes)===0||ue(s,a),g=d?I6(s,a):Yg(s,a,!0),y=d;do{if(g===0){Cl&&!d&&Na(s,a,0,!1);break}else{if(l=s.current.alternate,y&&!O6(l)){g=Yg(s,a,!1),y=!1;continue}if(g===2){if(y=a,s.errorRecoveryDisabledLanes&y)var E=0;else E=s.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){a=E;e:{var P=s;g=uu;var J=P.current.memoizedState.isDehydrated;if(J&&(Tl(P,E).flags|=256),E=Yg(P,E,!1),E!==2){if(Fg&&!J){P.errorRecoveryDisabledLanes|=y,Eo|=y,g=4;break e}y=Vi,Vi=g,y!==null&&(Vi===null?Vi=y:Vi.push.apply(Vi,y))}g=E}if(y=!1,g!==2)continue}}if(g===1){Tl(s,0),Na(s,a,0,!0);break}e:{switch(d=s,y=g,y){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Na(d,a,cs,!Ea);break e;case 2:Vi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(g=Ah+300-st(),10<g)){if(Na(d,a,cs,!Ea),X(d,0,!0)!==0)break e;Wr=a,d.timeoutHandle=nC(Ex.bind(null,d,l,Vi,Nh,Wg,a,cs,Eo,kl,Ea,y,"Throttled",-0,0),g);break e}Ex(d,l,Vi,Nh,Wg,a,cs,Eo,kl,Ea,y,null,-0,0)}}break}while(!0);cr(s)}function Ex(s,a,l,d,g,y,E,P,J,ae,me,ve,ce,he){if(s.timeoutHandle=-1,ve=a.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Te},vx(a,y,ve);var Ue=(y&62914560)===y?Ah-st():(y&4194048)===y?wx-st():0;if(Ue=v4(ve,Ue),Ue!==null){Wr=y,s.cancelPendingCommit=Ue(Ox.bind(null,s,a,y,l,d,g,E,P,J,me,ve,null,ce,he)),Na(s,y,E,!ae);return}}Ox(s,a,y,l,d,g,E,P,J)}function O6(s){for(var a=s;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var g=l[d],y=g.getSnapshot;g=g.value;try{if(!ss(y(),g))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Na(s,a,l,d){a&=~Ug,a&=~Eo,s.suspendedLanes|=a,s.pingedLanes&=~a,d&&(s.warmLanes|=a),d=s.expirationTimes;for(var g=a;0<g;){var y=31-$t(g),E=1<<y;d[y]=-1,g&=~E}l!==0&&Ae(s,l,a)}function Lh(){return(Kt&6)===0?(hu(0),!1):!0}function Vg(){if(Nt!==null){if(Zt===0)var s=Nt.return;else s=Nt,jr=_o=null,ug(s),_l=null,Vc=0,s=Nt;for(;s!==null;)ix(s.alternate,s),s=s.return;Nt=null}}function Tl(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,e4(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Wr=0,Vg(),dn=s,Nt=l=Lr(s.current,null),Dt=a,Zt=0,ls=null,Ea=!1,Cl=ue(s,a),Fg=!1,kl=cs=Ug=Eo=Ta=Rn=0,Vi=uu=null,Wg=!1,(a&8)!==0&&(a|=a&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=a;0<d;){var g=31-$t(d),y=1<<g;a|=s[g],d&=~y}return Ur=a,Jd(),l}function Tx(s,a){yt=null,k.H=nu,a===gl||a===ah?(a=US(),Zt=3):a===Jm?(a=US(),Zt=4):Zt=a===Eg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ls=a,Nt===null&&(Rn=1,bh(s,ws(a,s.current)))}function Ax(){var s=as.current;return s===null?!0:(Dt&4194048)===Dt?Es===null:(Dt&62914560)===Dt||(Dt&536870912)!==0?s===Es:!1}function Rx(){var s=k.H;return k.H=nu,s===null?nu:s}function Nx(){var s=k.A;return k.A=M6,s}function Mh(){Rn=4,Ea||(Dt&4194048)!==Dt&&as.current!==null||(Cl=!0),(Ta&134217727)===0&&(Eo&134217727)===0||dn===null||Na(dn,Dt,cs,!1)}function Yg(s,a,l){var d=Kt;Kt|=2;var g=Rx(),y=Nx();(dn!==s||Dt!==a)&&(Nh=null,Tl(s,a)),a=!1;var E=Rn;e:do try{if(Zt!==0&&Nt!==null){var P=Nt,J=ls;switch(Zt){case 8:Vg(),E=6;break e;case 3:case 2:case 9:case 6:as.current===null&&(a=!0);var ae=Zt;if(Zt=0,ls=null,Al(s,P,J,ae),l&&Cl){E=0;break e}break;default:ae=Zt,Zt=0,ls=null,Al(s,P,J,ae)}}D6(),E=Rn;break}catch(me){Tx(s,me)}while(!0);return a&&s.shellSuspendCounter++,jr=_o=null,Kt=d,k.H=g,k.A=y,Nt===null&&(dn=null,Dt=0,Jd()),E}function D6(){for(;Nt!==null;)Lx(Nt)}function I6(s,a){var l=Kt;Kt|=2;var d=Rx(),g=Nx();dn!==s||Dt!==a?(Nh=null,Rh=st()+500,Tl(s,a)):Cl=ue(s,a);e:do try{if(Zt!==0&&Nt!==null){a=Nt;var y=ls;t:switch(Zt){case 1:Zt=0,ls=null,Al(s,a,y,1);break;case 2:case 9:if(HS(y)){Zt=0,ls=null,Mx(a);break}a=function(){Zt!==2&&Zt!==9||dn!==s||(Zt=7),cr(s)},y.then(a,a);break e;case 3:Zt=7;break e;case 4:Zt=5;break e;case 7:HS(y)?(Zt=0,ls=null,Mx(a)):(Zt=0,ls=null,Al(s,a,y,7));break;case 5:var E=null;switch(Nt.tag){case 26:E=Nt.memoizedState;case 5:case 27:var P=Nt;if(E?_C(E):P.stateNode.complete){Zt=0,ls=null;var J=P.sibling;if(J!==null)Nt=J;else{var ae=P.return;ae!==null?(Nt=ae,jh(ae)):Nt=null}break t}}Zt=0,ls=null,Al(s,a,y,5);break;case 6:Zt=0,ls=null,Al(s,a,y,6);break;case 8:Vg(),Rn=6;break e;default:throw Error(i(462))}}B6();break}catch(me){Tx(s,me)}while(!0);return jr=_o=null,k.H=d,k.A=g,Kt=l,Nt!==null?0:(dn=null,Dt=0,Jd(),Rn)}function B6(){for(;Nt!==null&&!tt();)Lx(Nt)}function Lx(s){var a=tx(s.alternate,s,Ur);s.memoizedProps=s.pendingProps,a===null?jh(s):Nt=a}function Mx(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=Yw(l,a,a.pendingProps,a.type,void 0,Dt);break;case 11:a=Yw(l,a,a.pendingProps,a.type.render,a.ref,Dt);break;case 5:ug(a);default:ix(l,a),a=Nt=NS(a,Ur),a=tx(l,a,Ur)}s.memoizedProps=s.pendingProps,a===null?jh(s):Nt=a}function Al(s,a,l,d){jr=_o=null,ug(a),_l=null,Vc=0;var g=a.return;try{if(k6(s,g,a,l,Dt)){Rn=1,bh(s,ws(l,s.current)),Nt=null;return}}catch(y){if(g!==null)throw Nt=g,y;Rn=1,bh(s,ws(l,s.current)),Nt=null;return}a.flags&32768?(Pt||d===1?s=!0:Cl||(Dt&536870912)!==0?s=!1:(Ea=s=!0,(d===2||d===9||d===3||d===6)&&(d=as.current,d!==null&&d.tag===13&&(d.flags|=16384))),jx(a,s)):jh(a)}function jh(s){var a=s;do{if((a.flags&32768)!==0){jx(a,Ea);return}s=a.return;var l=A6(a.alternate,a,Ur);if(l!==null){Nt=l;return}if(a=a.sibling,a!==null){Nt=a;return}Nt=a=s}while(a!==null);Rn===0&&(Rn=5)}function jx(s,a){do{var l=R6(s.alternate,s);if(l!==null){l.flags&=32767,Nt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){Nt=s;return}Nt=s=l}while(s!==null);Rn=6,Nt=null}function Ox(s,a,l,d,g,y,E,P,J){s.cancelPendingCommit=null;do Oh();while(Xn!==0);if((Kt&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(y=a.lanes|a.childLanes,y|=Bm,Re(s,l,y,E,P,J),s===dn&&(Nt=dn=null,Dt=0),El=a,Ra=s,Wr=l,qg=y,Gg=g,xx=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,H6(Oe,function(){return $x(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=k.T,k.T=null,g=T.p,T.p=2,E=Kt,Kt|=4;try{N6(s,a,l)}finally{Kt=E,T.p=g,k.T=d}}Xn=1,Dx(),Ix(),Bx()}}function Dx(){if(Xn===1){Xn=0;var s=Ra,a=El,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=k.T,k.T=null;var d=T.p;T.p=2;var g=Kt;Kt|=4;try{mx(a,s);var y=o_,E=SS(s.containerInfo),P=y.focusedElem,J=y.selectionRange;if(E!==P&&P&&P.ownerDocument&&bS(P.ownerDocument.documentElement,P)){if(J!==null&&Mm(P)){var ae=J.start,me=J.end;if(me===void 0&&(me=ae),"selectionStart"in P)P.selectionStart=ae,P.selectionEnd=Math.min(me,P.value.length);else{var ve=P.ownerDocument||document,ce=ve&&ve.defaultView||window;if(ce.getSelection){var he=ce.getSelection(),Ue=P.textContent.length,at=Math.min(J.start,Ue),an=J.end===void 0?at:Math.min(J.end,Ue);!he.extend&&at>an&&(E=an,an=at,at=E);var ie=yS(P,at),te=yS(P,an);if(ie&&te&&(he.rangeCount!==1||he.anchorNode!==ie.node||he.anchorOffset!==ie.offset||he.focusNode!==te.node||he.focusOffset!==te.offset)){var re=ve.createRange();re.setStart(ie.node,ie.offset),he.removeAllRanges(),at>an?(he.addRange(re),he.extend(te.node,te.offset)):(re.setEnd(te.node,te.offset),he.addRange(re))}}}}for(ve=[],he=P;he=he.parentNode;)he.nodeType===1&&ve.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<ve.length;P++){var ge=ve[P];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}Gh=!!a_,o_=a_=null}finally{Kt=g,T.p=d,k.T=l}}s.current=a,Xn=2}}function Ix(){if(Xn===2){Xn=0;var s=Ra,a=El,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=k.T,k.T=null;var d=T.p;T.p=2;var g=Kt;Kt|=4;try{ux(s,a.alternate,a)}finally{Kt=g,T.p=d,k.T=l}}Xn=3}}function Bx(){if(Xn===4||Xn===3){Xn=0,Vt();var s=Ra,a=El,l=Wr,d=xx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Xn=5:(Xn=0,El=Ra=null,Px(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(Aa=null),Qt(l),a=a.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(gt,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=k.T,g=T.p,T.p=2,k.T=null;try{for(var y=s.onRecoverableError,E=0;E<d.length;E++){var P=d[E];y(P.value,{componentStack:P.stack})}}finally{k.T=a,T.p=g}}(Wr&3)!==0&&Oh(),cr(s),g=s.pendingLanes,(l&261930)!==0&&(g&42)!==0?s===Kg?du++:(du=0,Kg=s):du=0,hu(0)}}function Px(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Gc(a)))}function Oh(){return Dx(),Ix(),Bx(),$x()}function $x(){if(Xn!==5)return!1;var s=Ra,a=qg;qg=0;var l=Qt(Wr),d=k.T,g=T.p;try{T.p=32>l?32:l,k.T=null,l=Gg,Gg=null;var y=Ra,E=Wr;if(Xn=0,El=Ra=null,Wr=0,(Kt&6)!==0)throw Error(i(331));var P=Kt;if(Kt|=4,bx(y.current),_x(y,y.current,E,l),Kt=P,hu(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(gt,y)}catch{}return!0}finally{T.p=g,k.T=d,Px(s,a)}}function zx(s,a,l){a=ws(l,a),a=kg(s.stateNode,a,2),s=wa(s,a,2),s!==null&&(jt(s,2),cr(s))}function Jt(s,a,l){if(s.tag===3)zx(s,s,l);else for(;a!==null;){if(a.tag===3){zx(a,s,l);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Aa===null||!Aa.has(d))){s=ws(l,s),l=Hw(2),d=wa(a,l,2),d!==null&&(Fw(l,d,a,s),jt(d,2),cr(d));break}}a=a.return}}function Xg(s,a,l){var d=s.pingCache;if(d===null){d=s.pingCache=new j6;var g=new Set;d.set(a,g)}else g=d.get(a),g===void 0&&(g=new Set,d.set(a,g));g.has(l)||(Fg=!0,g.add(l),s=P6.bind(null,s,a,l),a.then(s,s))}function P6(s,a,l){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,dn===s&&(Dt&l)===l&&(Rn===4||Rn===3&&(Dt&62914560)===Dt&&300>st()-Ah?(Kt&2)===0&&Tl(s,0):Ug|=l,kl===Dt&&(kl=0)),cr(s)}function Hx(s,a){a===0&&(a=Ge()),s=po(s,a),s!==null&&(jt(s,a),cr(s))}function $6(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),Hx(s,l)}function z6(s,a){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,g=s.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),Hx(s,l)}function H6(s,a){return de(s,a)}var Dh=null,Rl=null,Zg=!1,Ih=!1,Jg=!1,La=0;function cr(s){s!==Rl&&s.next===null&&(Rl===null?Dh=Rl=s:Rl=Rl.next=s),Ih=!0,Zg||(Zg=!0,U6())}function hu(s,a){if(!Jg&&Ih){Jg=!0;do for(var l=!1,d=Dh;d!==null;){if(s!==0){var g=d.pendingLanes;if(g===0)var y=0;else{var E=d.suspendedLanes,P=d.pingedLanes;y=(1<<31-$t(42|s)+1)-1,y&=g&~(E&~P),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(l=!0,qx(d,y))}else y=Dt,y=X(d,d===dn?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||ue(d,y)||(l=!0,qx(d,y));d=d.next}while(l);Jg=!1}}function F6(){Fx()}function Fx(){Ih=Zg=!1;var s=0;La!==0&&Q6()&&(s=La);for(var a=st(),l=null,d=Dh;d!==null;){var g=d.next,y=Ux(d,a);y===0?(d.next=null,l===null?Dh=g:l.next=g,g===null&&(Rl=l)):(l=d,(s!==0||(y&3)!==0)&&(Ih=!0)),d=g}Xn!==0&&Xn!==5||hu(s),La!==0&&(La=0)}function Ux(s,a){for(var l=s.suspendedLanes,d=s.pingedLanes,g=s.expirationTimes,y=s.pendingLanes&-62914561;0<y;){var E=31-$t(y),P=1<<E,J=g[E];J===-1?((P&l)===0||(P&d)!==0)&&(g[E]=be(P,a)):J<=a&&(s.expiredLanes|=P),y&=~P}if(a=dn,l=Dt,l=X(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,l===0||s===a&&(Zt===2||Zt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&ut(d),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||ue(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(d!==null&&ut(d),Qt(l)){case 2:case 8:l=we;break;case 32:l=Oe;break;case 268435456:l=ti;break;default:l=Oe}return d=Wx.bind(null,s),l=de(l,d),s.callbackPriority=a,s.callbackNode=l,a}return d!==null&&d!==null&&ut(d),s.callbackPriority=2,s.callbackNode=null,2}function Wx(s,a){if(Xn!==0&&Xn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(Oh()&&s.callbackNode!==l)return null;var d=Dt;return d=X(s,s===dn?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(kx(s,d,a),Ux(s,st()),s.callbackNode!=null&&s.callbackNode===l?Wx.bind(null,s):null)}function qx(s,a){if(Oh())return null;kx(s,a,!0)}function U6(){t4(function(){(Kt&6)!==0?de(Ft,F6):Fx()})}function Qg(){if(La===0){var s=pl;s===0&&(s=Be,Be<<=1,(Be&261888)===0&&(Be=256)),La=s}return La}function Gx(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:pa(""+s)}function Kx(s,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,s.id&&l.setAttribute("form",s.id),a.parentNode.insertBefore(l,a),s=new FormData(s),l.parentNode.removeChild(l),s}function W6(s,a,l,d,g){if(a==="submit"&&l&&l.stateNode===g){var y=Gx((g[tn]||null).action),E=d.submitter;E&&(a=(a=E[tn]||null)?Gx(a.formAction):E.getAttribute("formAction"),a!==null&&(y=a,E=null));var P=new Vd("action","action",null,d,g);s.push({event:P,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(La!==0){var J=E?Kx(g,E):new FormData(g);yg(l,{pending:!0,data:J,method:g.method,action:y},null,J)}}else typeof y=="function"&&(P.preventDefault(),J=E?Kx(g,E):new FormData(g),yg(l,{pending:!0,data:J,method:g.method,action:y},y,J))},currentTarget:g}]})}}for(var e_=0;e_<Im.length;e_++){var t_=Im[e_],q6=t_.toLowerCase(),G6=t_[0].toUpperCase()+t_.slice(1);Gs(q6,"on"+G6)}Gs(CS,"onAnimationEnd"),Gs(kS,"onAnimationIteration"),Gs(ES,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(l6,"onTransitionRun"),Gs(c6,"onTransitionStart"),Gs(u6,"onTransitionCancel"),Gs(TS,"onTransitionEnd"),pe("onMouseEnter",["mouseout","mouseover"]),pe("onMouseLeave",["mouseout","mouseover"]),pe("onPointerEnter",["pointerout","pointerover"]),pe("onPointerLeave",["pointerout","pointerover"]),dt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),dt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),dt("onBeforeInput",["compositionend","keypress","textInput","paste"]),dt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),dt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),dt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fu="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(" "),K6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fu));function Vx(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],g=d.event;d=d.listeners;e:{var y=void 0;if(a)for(var E=d.length-1;0<=E;E--){var P=d[E],J=P.instance,ae=P.currentTarget;if(P=P.listener,J!==y&&g.isPropagationStopped())break e;y=P,g.currentTarget=ae;try{y(g)}catch(me){Zd(me)}g.currentTarget=null,y=J}else for(E=0;E<d.length;E++){if(P=d[E],J=P.instance,ae=P.currentTarget,P=P.listener,J!==y&&g.isPropagationStopped())break e;y=P,g.currentTarget=ae;try{y(g)}catch(me){Zd(me)}g.currentTarget=null,y=J}}}}function Lt(s,a){var l=a[Us];l===void 0&&(l=a[Us]=new Set);var d=s+"__bubble";l.has(d)||(Yx(a,s,2,!1),l.add(d))}function n_(s,a,l){var d=0;a&&(d|=4),Yx(l,s,d,a)}var Bh="_reactListening"+Math.random().toString(36).slice(2);function i_(s){if(!s[Bh]){s[Bh]=!0,Ze.forEach(function(l){l!=="selectionchange"&&(K6.has(l)||n_(l,!1,s),n_(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Bh]||(a[Bh]=!0,n_("selectionchange",!1,a))}}function Yx(s,a,l,d){switch(CC(a)){case 2:var g=S4;break;case 8:g=w4;break;default:g=v_}l=g.bind(null,a,l,s),g=void 0,!xm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),d?g!==void 0?s.addEventListener(a,l,{capture:!0,passive:g}):s.addEventListener(a,l,!0):g!==void 0?s.addEventListener(a,l,{passive:g}):s.addEventListener(a,l,!1)}function s_(s,a,l,d,g){var y=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var P=d.stateNode.containerInfo;if(P===g)break;if(E===4)for(E=d.return;E!==null;){var J=E.tag;if((J===3||J===4)&&E.stateNode.containerInfo===g)return;E=E.return}for(;P!==null;){if(E=Y(P),E===null)return;if(J=E.tag,J===5||J===6||J===26||J===27){d=y=E;continue e}P=P.parentNode}}d=d.return}Wd(function(){var ae=y,me=_t(l),ve=[];e:{var ce=AS.get(s);if(ce!==void 0){var he=Vd,Ue=s;switch(s){case"keypress":if(Gd(l)===0)break e;case"keydown":case"keyup":he=z3;break;case"focusin":Ue="focus",he=Tm;break;case"focusout":Ue="blur",he=Tm;break;case"beforeblur":case"afterblur":he=Tm;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=iS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=A3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=U3;break;case CS:case kS:case ES:he=L3;break;case TS:he=q3;break;case"scroll":case"scrollend":he=E3;break;case"wheel":he=K3;break;case"copy":case"cut":case"paste":he=j3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=rS;break;case"toggle":case"beforetoggle":he=Y3}var at=(a&4)!==0,an=!at&&(s==="scroll"||s==="scrollend"),ie=at?ce!==null?ce+"Capture":null:ce;at=[];for(var te=ae,re;te!==null;){var ge=te;if(re=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||re===null||ie===null||(ge=Dc(te,ie),ge!=null&&at.push(pu(te,ge,re))),an)break;te=te.return}0<at.length&&(ce=new he(ce,Ue,null,l,me),ve.push({event:ce,listeners:at}))}}if((a&7)===0){e:{if(ce=s==="mouseover"||s==="pointerover",he=s==="mouseout"||s==="pointerout",ce&&l!==Ye&&(Ue=l.relatedTarget||l.fromElement)&&(Y(Ue)||Ue[ns]))break e;if((he||ce)&&(ce=me.window===me?me:(ce=me.ownerDocument)?ce.defaultView||ce.parentWindow:window,he?(Ue=l.relatedTarget||l.toElement,he=ae,Ue=Ue?Y(Ue):null,Ue!==null&&(an=o(Ue),at=Ue.tag,Ue!==an||at!==5&&at!==27&&at!==6)&&(Ue=null)):(he=null,Ue=ae),he!==Ue)){if(at=iS,ge="onMouseLeave",ie="onMouseEnter",te="mouse",(s==="pointerout"||s==="pointerover")&&(at=rS,ge="onPointerLeave",ie="onPointerEnter",te="pointer"),an=he==null?ce:Q(he),re=Ue==null?ce:Q(Ue),ce=new at(ge,te+"leave",he,l,me),ce.target=an,ce.relatedTarget=re,ge=null,Y(me)===ae&&(at=new at(ie,te+"enter",Ue,l,me),at.target=re,at.relatedTarget=an,ge=at),an=ge,he&&Ue)t:{for(at=V6,ie=he,te=Ue,re=0,ge=ie;ge;ge=at(ge))re++;ge=0;for(var nt=te;nt;nt=at(nt))ge++;for(;0<re-ge;)ie=at(ie),re--;for(;0<ge-re;)te=at(te),ge--;for(;re--;){if(ie===te||te!==null&&ie===te.alternate){at=ie;break t}ie=at(ie),te=at(te)}at=null}else at=null;he!==null&&Xx(ve,ce,he,at,!1),Ue!==null&&an!==null&&Xx(ve,an,Ue,at,!0)}}e:{if(ce=ae?Q(ae):window,he=ce.nodeName&&ce.nodeName.toLowerCase(),he==="select"||he==="input"&&ce.type==="file")var Ut=fS;else if(dS(ce))if(pS)Ut=r6;else{Ut=i6;var Xe=n6}else he=ce.nodeName,!he||he.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?ae&&fa(ae.elementType)&&(Ut=fS):Ut=s6;if(Ut&&(Ut=Ut(s,ae))){hS(ve,Ut,l,me);break e}Xe&&Xe(s,ce,ae),s==="focusout"&&ae&&ce.type==="number"&&ae.memoizedProps.value!=null&&ha(ce,"number",ce.value)}switch(Xe=ae?Q(ae):window,s){case"focusin":(dS(Xe)||Xe.contentEditable==="true")&&(al=Xe,jm=ae,Uc=null);break;case"focusout":Uc=jm=al=null;break;case"mousedown":Om=!0;break;case"contextmenu":case"mouseup":case"dragend":Om=!1,wS(ve,l,me);break;case"selectionchange":if(o6)break;case"keydown":case"keyup":wS(ve,l,me)}var St;if(Rm)e:{switch(s){case"compositionstart":var It="onCompositionStart";break e;case"compositionend":It="onCompositionEnd";break e;case"compositionupdate":It="onCompositionUpdate";break e}It=void 0}else rl?cS(s,l)&&(It="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(It="onCompositionStart");It&&(aS&&l.locale!=="ko"&&(rl||It!=="onCompositionStart"?It==="onCompositionEnd"&&rl&&(St=tS()):(ma=me,Cm="value"in ma?ma.value:ma.textContent,rl=!0)),Xe=Ph(ae,It),0<Xe.length&&(It=new sS(It,s,null,l,me),ve.push({event:It,listeners:Xe}),St?It.data=St:(St=uS(l),St!==null&&(It.data=St)))),(St=Z3?J3(s,l):Q3(s,l))&&(It=Ph(ae,"onBeforeInput"),0<It.length&&(Xe=new sS("onBeforeInput","beforeinput",null,l,me),ve.push({event:Xe,listeners:It}),Xe.data=St)),W6(ve,s,ae,l,me)}Vx(ve,a)})}function pu(s,a,l){return{instance:s,listener:a,currentTarget:l}}function Ph(s,a){for(var l=a+"Capture",d=[];s!==null;){var g=s,y=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||y===null||(g=Dc(s,l),g!=null&&d.unshift(pu(s,g,y)),g=Dc(s,a),g!=null&&d.push(pu(s,g,y))),s.tag===3)return d;s=s.return}return[]}function V6(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Xx(s,a,l,d,g){for(var y=a._reactName,E=[];l!==null&&l!==d;){var P=l,J=P.alternate,ae=P.stateNode;if(P=P.tag,J!==null&&J===d)break;P!==5&&P!==26&&P!==27||ae===null||(J=ae,g?(ae=Dc(l,y),ae!=null&&E.unshift(pu(l,ae,J))):g||(ae=Dc(l,y),ae!=null&&E.push(pu(l,ae,J)))),l=l.return}E.length!==0&&s.push({event:a,listeners:E})}var Y6=/\r\n?/g,X6=/\u0000|\uFFFD/g;function Zx(s){return(typeof s=="string"?s:""+s).replace(Y6,`
9
+ `).replace(X6,"")}function Jx(s,a){return a=Zx(a),Zx(s)===a}function rn(s,a,l,d,g,y){switch(l){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||ct(s,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&ct(s,""+d);break;case"className":Ht(s,"class",d);break;case"tabIndex":Ht(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ht(s,l,d);break;case"style":Xt(s,d,y);break;case"data":if(a!=="object"){Ht(s,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||l!=="href")){s.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=pa(""+d),s.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(l==="formAction"?(a!=="input"&&rn(s,a,"name",g.name,g,null),rn(s,a,"formEncType",g.formEncType,g,null),rn(s,a,"formMethod",g.formMethod,g,null),rn(s,a,"formTarget",g.formTarget,g,null)):(rn(s,a,"encType",g.encType,g,null),rn(s,a,"method",g.method,g,null),rn(s,a,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=pa(""+d),s.setAttribute(l,d);break;case"onClick":d!=null&&(s.onclick=Te);break;case"onScroll":d!=null&&Lt("scroll",s);break;case"onScrollEnd":d!=null&&Lt("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}l=pa(""+d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""+d):s.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":d===!0?s.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(l,d):s.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(l):s.setAttribute(l,d);break;case"popover":Lt("beforetoggle",s),Lt("toggle",s),Ke(s,"popover",d);break;case"xlinkActuate":nn(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":nn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":nn(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":nn(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":nn(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":nn(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":nn(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":nn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":nn(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Ke(s,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Rr.get(l)||l,Ke(s,l,d))}}function r_(s,a,l,d,g,y){switch(l){case"style":Xt(s,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"children":typeof d=="string"?ct(s,d):(typeof d=="number"||typeof d=="bigint")&&ct(s,""+d);break;case"onScroll":d!=null&&Lt("scroll",s);break;case"onScrollEnd":d!=null&&Lt("scrollend",s);break;case"onClick":d!=null&&(s.onclick=Te);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ne.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),a=l.slice(2,g?l.length-7:void 0),y=s[tn]||null,y=y!=null?y[l]:null,typeof y=="function"&&s.removeEventListener(a,y,g),typeof d=="function")){typeof y!="function"&&y!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(a,d,g);break e}l in s?s[l]=d:d===!0?s.setAttribute(l,""):Ke(s,l,d)}}}function yi(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Lt("error",s),Lt("load",s);var d=!1,g=!1,y;for(y in l)if(l.hasOwnProperty(y)){var E=l[y];if(E!=null)switch(y){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:rn(s,a,y,E,l,null)}}g&&rn(s,a,"srcSet",l.srcSet,l,null),d&&rn(s,a,"src",l.src,l,null);return;case"input":Lt("invalid",s);var P=y=E=g=null,J=null,ae=null;for(d in l)if(l.hasOwnProperty(d)){var me=l[d];if(me!=null)switch(d){case"name":g=me;break;case"type":E=me;break;case"checked":J=me;break;case"defaultChecked":ae=me;break;case"value":y=me;break;case"defaultValue":P=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(i(137,a));break;default:rn(s,a,d,me,l,null)}}rr(s,y,P,J,ae,E,g,!1);return;case"select":Lt("invalid",s),d=E=y=null;for(g in l)if(l.hasOwnProperty(g)&&(P=l[g],P!=null))switch(g){case"value":y=P;break;case"defaultValue":E=P;break;case"multiple":d=P;default:rn(s,a,g,P,l,null)}a=y,l=E,s.multiple=!!d,a!=null?Yn(s,!!d,a,!1):l!=null&&Yn(s,!!d,l,!0);return;case"textarea":Lt("invalid",s),y=g=d=null;for(E in l)if(l.hasOwnProperty(E)&&(P=l[E],P!=null))switch(E){case"value":d=P;break;case"defaultValue":g=P;break;case"children":y=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(91));break;default:rn(s,a,E,P,l,null)}sl(s,d,g,y);return;case"option":for(J in l)l.hasOwnProperty(J)&&(d=l[J],d!=null)&&(J==="selected"?s.selected=d&&typeof d!="function"&&typeof d!="symbol":rn(s,a,J,d,l,null));return;case"dialog":Lt("beforetoggle",s),Lt("toggle",s),Lt("cancel",s),Lt("close",s);break;case"iframe":case"object":Lt("load",s);break;case"video":case"audio":for(d=0;d<fu.length;d++)Lt(fu[d],s);break;case"image":Lt("error",s),Lt("load",s);break;case"details":Lt("toggle",s);break;case"embed":case"source":case"link":Lt("error",s),Lt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in l)if(l.hasOwnProperty(ae)&&(d=l[ae],d!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:rn(s,a,ae,d,l,null)}return;default:if(fa(a)){for(me in l)l.hasOwnProperty(me)&&(d=l[me],d!==void 0&&r_(s,a,me,d,l,void 0));return}}for(P in l)l.hasOwnProperty(P)&&(d=l[P],d!=null&&rn(s,a,P,d,l,null))}function Z6(s,a,l,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,y=null,E=null,P=null,J=null,ae=null,me=null;for(he in l){var ve=l[he];if(l.hasOwnProperty(he)&&ve!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":J=ve;default:d.hasOwnProperty(he)||rn(s,a,he,null,d,ve)}}for(var ce in d){var he=d[ce];if(ve=l[ce],d.hasOwnProperty(ce)&&(he!=null||ve!=null))switch(ce){case"type":y=he;break;case"name":g=he;break;case"checked":ae=he;break;case"defaultChecked":me=he;break;case"value":E=he;break;case"defaultValue":P=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(i(137,a));break;default:he!==ve&&rn(s,a,ce,he,d,ve)}}co(s,E,P,J,ae,me,y,g);return;case"select":he=E=P=ce=null;for(y in l)if(J=l[y],l.hasOwnProperty(y)&&J!=null)switch(y){case"value":break;case"multiple":he=J;default:d.hasOwnProperty(y)||rn(s,a,y,null,d,J)}for(g in d)if(y=d[g],J=l[g],d.hasOwnProperty(g)&&(y!=null||J!=null))switch(g){case"value":ce=y;break;case"defaultValue":P=y;break;case"multiple":E=y;default:y!==J&&rn(s,a,g,y,d,J)}a=P,l=E,d=he,ce!=null?Yn(s,!!l,ce,!1):!!d!=!!l&&(a!=null?Yn(s,!!l,a,!0):Yn(s,!!l,l?[]:"",!1));return;case"textarea":he=ce=null;for(P in l)if(g=l[P],l.hasOwnProperty(P)&&g!=null&&!d.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:rn(s,a,P,null,d,g)}for(E in d)if(g=d[E],y=l[E],d.hasOwnProperty(E)&&(g!=null||y!=null))switch(E){case"value":ce=g;break;case"defaultValue":he=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==y&&rn(s,a,E,g,d,y)}il(s,ce,he);return;case"option":for(var Ue in l)ce=l[Ue],l.hasOwnProperty(Ue)&&ce!=null&&!d.hasOwnProperty(Ue)&&(Ue==="selected"?s.selected=!1:rn(s,a,Ue,null,d,ce));for(J in d)ce=d[J],he=l[J],d.hasOwnProperty(J)&&ce!==he&&(ce!=null||he!=null)&&(J==="selected"?s.selected=ce&&typeof ce!="function"&&typeof ce!="symbol":rn(s,a,J,ce,d,he));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var at in l)ce=l[at],l.hasOwnProperty(at)&&ce!=null&&!d.hasOwnProperty(at)&&rn(s,a,at,null,d,ce);for(ae in d)if(ce=d[ae],he=l[ae],d.hasOwnProperty(ae)&&ce!==he&&(ce!=null||he!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,a));break;default:rn(s,a,ae,ce,d,he)}return;default:if(fa(a)){for(var an in l)ce=l[an],l.hasOwnProperty(an)&&ce!==void 0&&!d.hasOwnProperty(an)&&r_(s,a,an,void 0,d,ce);for(me in d)ce=d[me],he=l[me],!d.hasOwnProperty(me)||ce===he||ce===void 0&&he===void 0||r_(s,a,me,ce,d,he);return}}for(var ie in l)ce=l[ie],l.hasOwnProperty(ie)&&ce!=null&&!d.hasOwnProperty(ie)&&rn(s,a,ie,null,d,ce);for(ve in d)ce=d[ve],he=l[ve],!d.hasOwnProperty(ve)||ce===he||ce==null&&he==null||rn(s,a,ve,ce,d,he)}function Qx(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function J6(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var g=l[d],y=g.transferSize,E=g.initiatorType,P=g.duration;if(y&&P&&Qx(E)){for(E=0,P=g.responseEnd,d+=1;d<l.length;d++){var J=l[d],ae=J.startTime;if(ae>P)break;var me=J.transferSize,ve=J.initiatorType;me&&Qx(ve)&&(J=J.responseEnd,E+=me*(J<P?1:(P-ae)/(J-ae)))}if(--d,a+=8*(y+E)/(g.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var a_=null,o_=null;function $h(s){return s.nodeType===9?s:s.ownerDocument}function eC(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tC(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function l_(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var c_=null;function Q6(){var s=window.event;return s&&s.type==="popstate"?s===c_?!1:(c_=s,!0):(c_=null,!1)}var nC=typeof setTimeout=="function"?setTimeout:void 0,e4=typeof clearTimeout=="function"?clearTimeout:void 0,iC=typeof Promise=="function"?Promise:void 0,t4=typeof queueMicrotask=="function"?queueMicrotask:typeof iC<"u"?function(s){return iC.resolve(null).then(s).catch(n4)}:nC;function n4(s){setTimeout(function(){throw s})}function Ma(s){return s==="head"}function sC(s,a){var l=a,d=0;do{var g=l.nextSibling;if(s.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(g),jl(a);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")mu(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,mu(l);for(var y=l.firstChild;y;){var E=y.nextSibling,P=y.nodeName;y[Ui]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&y.rel.toLowerCase()==="stylesheet"||l.removeChild(y),y=E}}else l==="body"&&mu(s.ownerDocument.body);l=g}while(l);jl(a)}function rC(s,a){var l=s;s=0;do{var d=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=d}while(l)}function u_(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":u_(l),Ve(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function i4(s,a,l,d){for(;s.nodeType===1;){var g=l;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[Ui])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(y=s.getAttribute("rel"),y==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(y!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(y=s.getAttribute("src"),(y!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&y&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var y=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===y)return s}else return s;if(s=Ts(s.nextSibling),s===null)break}return null}function s4(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Ts(s.nextSibling),s===null))return null;return s}function aC(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=Ts(s.nextSibling),s===null))return null;return s}function d_(s){return s.data==="$?"||s.data==="$~"}function h_(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function r4(s,a){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||l.readyState!=="loading")a();else{var d=function(){a(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Ts(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var f_=null;function oC(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return Ts(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function lC(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return s;a--}else l!=="/$"&&l!=="/&"||a++}s=s.previousSibling}return null}function cC(s,a,l){switch(a=$h(l),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function mu(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Ve(s)}var As=new Map,uC=new Set;function zh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var qr=T.d;T.d={f:a4,r:o4,D:l4,C:c4,L:u4,m:d4,X:f4,S:h4,M:p4};function a4(){var s=qr.f(),a=Lh();return s||a}function o4(s){var a=_e(s);a!==null&&a.tag===5&&a.type==="form"?Tw(a):qr.r(s)}var Nl=typeof document>"u"?null:document;function dC(s,a,l){var d=Nl;if(d&&typeof a=="string"&&a){var g=ii(a);g='link[rel="'+s+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),uC.has(g)||(uC.add(g),s={rel:s,crossOrigin:l,href:a},d.querySelector(g)===null&&(a=d.createElement("link"),yi(a,"link",s),Qe(a),d.head.appendChild(a)))}}function l4(s){qr.D(s),dC("dns-prefetch",s,null)}function c4(s,a){qr.C(s,a),dC("preconnect",s,a)}function u4(s,a,l){qr.L(s,a,l);var d=Nl;if(d&&s&&a){var g='link[rel="preload"][as="'+ii(a)+'"]';a==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+ii(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+ii(l.imageSizes)+'"]')):g+='[href="'+ii(s)+'"]';var y=g;switch(a){case"style":y=Ll(s);break;case"script":y=Ml(s)}As.has(y)||(s=_({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),As.set(y,s),d.querySelector(g)!==null||a==="style"&&d.querySelector(gu(y))||a==="script"&&d.querySelector(_u(y))||(a=d.createElement("link"),yi(a,"link",s),Qe(a),d.head.appendChild(a)))}}function d4(s,a){qr.m(s,a);var l=Nl;if(l&&s){var d=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+ii(d)+'"][href="'+ii(s)+'"]',y=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Ml(s)}if(!As.has(y)&&(s=_({rel:"modulepreload",href:s},a),As.set(y,s),l.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(_u(y)))return}d=l.createElement("link"),yi(d,"link",s),Qe(d),l.head.appendChild(d)}}}function h4(s,a,l){qr.S(s,a,l);var d=Nl;if(d&&s){var g=Ee(d).hoistableStyles,y=Ll(s);a=a||"default";var E=g.get(y);if(!E){var P={loading:0,preload:null};if(E=d.querySelector(gu(y)))P.loading=5;else{s=_({rel:"stylesheet",href:s,"data-precedence":a},l),(l=As.get(y))&&p_(s,l);var J=E=d.createElement("link");Qe(J),yi(J,"link",s),J._p=new Promise(function(ae,me){J.onload=ae,J.onerror=me}),J.addEventListener("load",function(){P.loading|=1}),J.addEventListener("error",function(){P.loading|=2}),P.loading|=4,Hh(E,a,d)}E={type:"stylesheet",instance:E,count:1,state:P},g.set(y,E)}}}function f4(s,a){qr.X(s,a);var l=Nl;if(l&&s){var d=Ee(l).hoistableScripts,g=Ml(s),y=d.get(g);y||(y=l.querySelector(_u(g)),y||(s=_({src:s,async:!0},a),(a=As.get(g))&&m_(s,a),y=l.createElement("script"),Qe(y),yi(y,"link",s),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function p4(s,a){qr.M(s,a);var l=Nl;if(l&&s){var d=Ee(l).hoistableScripts,g=Ml(s),y=d.get(g);y||(y=l.querySelector(_u(g)),y||(s=_({src:s,async:!0,type:"module"},a),(a=As.get(g))&&m_(s,a),y=l.createElement("script"),Qe(y),yi(y,"link",s),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function hC(s,a,l,d){var g=(g=Se.current)?zh(g):null;if(!g)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=Ll(l.href),l=Ee(g).hoistableStyles,d=l.get(a),d||(d={type:"style",instance:null,count:0,state:null},l.set(a,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=Ll(l.href);var y=Ee(g).hoistableStyles,E=y.get(s);if(E||(g=g.ownerDocument||g,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(s,E),(y=g.querySelector(gu(s)))&&!y._p&&(E.instance=y,E.state.loading=5),As.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},As.set(s,l),y||m4(g,s,l,E.state))),a&&d===null)throw Error(i(528,""));return E}if(a&&d!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ml(l),l=Ee(g).hoistableScripts,d=l.get(a),d||(d={type:"script",instance:null,count:0,state:null},l.set(a,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Ll(s){return'href="'+ii(s)+'"'}function gu(s){return'link[rel="stylesheet"]['+s+"]"}function fC(s){return _({},s,{"data-precedence":s.precedence,precedence:null})}function m4(s,a,l,d){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=s.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),yi(a,"link",l),Qe(a),s.head.appendChild(a))}function Ml(s){return'[src="'+ii(s)+'"]'}function _u(s){return"script[async]"+s}function pC(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var d=s.querySelector('style[data-href~="'+ii(l.href)+'"]');if(d)return a.instance=d,Qe(d),d;var g=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),Qe(d),yi(d,"style",g),Hh(d,l.precedence,s),a.instance=d;case"stylesheet":g=Ll(l.href);var y=s.querySelector(gu(g));if(y)return a.state.loading|=4,a.instance=y,Qe(y),y;d=fC(l),(g=As.get(g))&&p_(d,g),y=(s.ownerDocument||s).createElement("link"),Qe(y);var E=y;return E._p=new Promise(function(P,J){E.onload=P,E.onerror=J}),yi(y,"link",d),a.state.loading|=4,Hh(y,l.precedence,s),a.instance=y;case"script":return y=Ml(l.src),(g=s.querySelector(_u(y)))?(a.instance=g,Qe(g),g):(d=l,(g=As.get(y))&&(d=_({},l),m_(d,g)),s=s.ownerDocument||s,g=s.createElement("script"),Qe(g),yi(g,"link",d),s.head.appendChild(g),a.instance=g);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,Hh(d,l.precedence,s));return a.instance}function Hh(s,a,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,y=g,E=0;E<d.length;E++){var P=d[E];if(P.dataset.precedence===a)y=P;else if(y!==g)break}y?y.parentNode.insertBefore(s,y.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(s,a.firstChild))}function p_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function m_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Fh=null;function mC(s,a,l){if(Fh===null){var d=new Map,g=Fh=new Map;g.set(l,d)}else g=Fh,d=g.get(l),d||(d=new Map,g.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),g=0;g<l.length;g++){var y=l[g];if(!(y[Ui]||y[en]||s==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(a)||"";E=s+E;var P=d.get(E);P?P.push(y):d.set(E,[y])}}return d}function gC(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function g4(s,a,l){if(l===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function _C(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function _4(s,a,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=Ll(d.href),y=a.querySelector(gu(g));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Uh.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=y,Qe(y);return}y=a.ownerDocument||a,d=fC(d),(g=As.get(g))&&p_(d,g),y=y.createElement("link"),Qe(y);var E=y;E._p=new Promise(function(P,J){E.onload=P,E.onerror=J}),yi(y,"link",d),l.instance=y}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Uh.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var g_=0;function v4(s,a){return s.stylesheets&&s.count===0&&qh(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&qh(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+a);0<s.imgBytes&&g_===0&&(g_=62500*J6());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&qh(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>g_?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function Uh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Wh=null;function qh(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Wh=new Map,a.forEach(y4,s),Wh=null,Uh.call(s))}function y4(s,a){if(!(a.state.loading&4)){var l=Wh.get(s);if(l)var d=l.get(null);else{l=new Map,Wh.set(s,l);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<g.length;y++){var E=g[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(l.set(E.dataset.precedence,E),d=E)}d&&l.set(null,d)}g=a.instance,E=g.getAttribute("data-precedence"),y=l.get(E)||d,y===d&&l.set(null,g),l.set(E,g),this.count++,d=Uh.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),y?y.parentNode.insertBefore(g,y.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),a.state.loading|=4}}var vu={$$typeof:F,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function b4(s,a,l,d,g,y,E,P,J){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=At(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.hiddenUpdates=At(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function vC(s,a,l,d,g,y,E,P,J,ae,me,ve){return s=new b4(s,a,l,E,J,ae,me,ve,P),a=1,y===!0&&(a|=24),y=rs(3,null,null,a),s.current=y,y.stateNode=s,a=Ym(),a.refCount++,s.pooledCache=a,a.refCount++,y.memoizedState={element:d,isDehydrated:l,cache:a},Qm(y),s}function yC(s){return s?(s=cl,s):cl}function bC(s,a,l,d,g,y){g=yC(g),d.context===null?d.context=g:d.pendingContext=g,d=Sa(a),d.payload={element:l},y=y===void 0?null:y,y!==null&&(d.callback=y),l=wa(s,d,a),l!==null&&(Yi(l,s,a),Xc(l,s,a))}function SC(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function __(s,a){SC(s,a),(s=s.alternate)&&SC(s,a)}function wC(s){if(s.tag===13||s.tag===31){var a=po(s,67108864);a!==null&&Yi(a,s,67108864),__(s,67108864)}}function xC(s){if(s.tag===13||s.tag===31){var a=us();a=Rt(a);var l=po(s,a);l!==null&&Yi(l,s,a),__(s,a)}}var Gh=!0;function S4(s,a,l,d){var g=k.T;k.T=null;var y=T.p;try{T.p=2,v_(s,a,l,d)}finally{T.p=y,k.T=g}}function w4(s,a,l,d){var g=k.T;k.T=null;var y=T.p;try{T.p=8,v_(s,a,l,d)}finally{T.p=y,k.T=g}}function v_(s,a,l,d){if(Gh){var g=y_(d);if(g===null)s_(s,a,d,Kh,l),kC(s,d);else if(C4(g,s,a,l,d))d.stopPropagation();else if(kC(s,d),a&4&&-1<x4.indexOf(s)){for(;g!==null;){var y=_e(g);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=it(y.pendingLanes);if(E!==0){var P=y;for(P.pendingLanes|=2,P.entangledLanes|=2;E;){var J=1<<31-$t(E);P.entanglements[1]|=J,E&=~J}cr(y),(Kt&6)===0&&(Rh=st()+500,hu(0))}}break;case 31:case 13:P=po(y,2),P!==null&&Yi(P,y,2),Lh(),__(y,2)}if(y=y_(d),y===null&&s_(s,a,d,Kh,l),y===g)break;g=y}g!==null&&d.stopPropagation()}else s_(s,a,d,null,l)}}function y_(s){return s=_t(s),b_(s)}var Kh=null;function b_(s){if(Kh=null,s=Y(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=u(a),s!==null)return s;s=null}else if(l===31){if(s=h(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Kh=s,null}function CC(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(zt()){case Ft:return 2;case we:return 8;case Oe:case cn:return 32;case ti:return 268435456;default:return 32}default:return 32}}var S_=!1,ja=null,Oa=null,Da=null,yu=new Map,bu=new Map,Ia=[],x4="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 kC(s,a){switch(s){case"focusin":case"focusout":ja=null;break;case"dragenter":case"dragleave":Oa=null;break;case"mouseover":case"mouseout":Da=null;break;case"pointerover":case"pointerout":yu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":bu.delete(a.pointerId)}}function Su(s,a,l,d,g,y){return s===null||s.nativeEvent!==y?(s={blockedOn:a,domEventName:l,eventSystemFlags:d,nativeEvent:y,targetContainers:[g]},a!==null&&(a=_e(a),a!==null&&wC(a)),s):(s.eventSystemFlags|=d,a=s.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),s)}function C4(s,a,l,d,g){switch(a){case"focusin":return ja=Su(ja,s,a,l,d,g),!0;case"dragenter":return Oa=Su(Oa,s,a,l,d,g),!0;case"mouseover":return Da=Su(Da,s,a,l,d,g),!0;case"pointerover":var y=g.pointerId;return yu.set(y,Su(yu.get(y)||null,s,a,l,d,g)),!0;case"gotpointercapture":return y=g.pointerId,bu.set(y,Su(bu.get(y)||null,s,a,l,d,g)),!0}return!1}function EC(s){var a=Y(s.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=u(l),a!==null){s.blockedOn=a,ys(s.priority,function(){xC(l)});return}}else if(a===31){if(a=h(l),a!==null){s.blockedOn=a,ys(s.priority,function(){xC(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Vh(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=y_(s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);Ye=d,l.target.dispatchEvent(d),Ye=null}else return a=_e(l),a!==null&&wC(a),s.blockedOn=l,!1;a.shift()}return!0}function TC(s,a,l){Vh(s)&&l.delete(a)}function k4(){S_=!1,ja!==null&&Vh(ja)&&(ja=null),Oa!==null&&Vh(Oa)&&(Oa=null),Da!==null&&Vh(Da)&&(Da=null),yu.forEach(TC),bu.forEach(TC)}function Yh(s,a){s.blockedOn===a&&(s.blockedOn=null,S_||(S_=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,k4)))}var Xh=null;function AC(s){Xh!==s&&(Xh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Xh===s&&(Xh=null);for(var a=0;a<s.length;a+=3){var l=s[a],d=s[a+1],g=s[a+2];if(typeof d!="function"){if(b_(d||l)===null)continue;break}var y=_e(l);y!==null&&(s.splice(a,3),a-=3,yg(y,{pending:!0,data:g,method:l.method,action:d},d,g))}}))}function jl(s){function a(J){return Yh(J,s)}ja!==null&&Yh(ja,s),Oa!==null&&Yh(Oa,s),Da!==null&&Yh(Da,s),yu.forEach(a),bu.forEach(a);for(var l=0;l<Ia.length;l++){var d=Ia[l];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Ia.length&&(l=Ia[0],l.blockedOn===null);)EC(l),l.blockedOn===null&&Ia.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var g=l[d],y=l[d+1],E=g[tn]||null;if(typeof y=="function")E||AC(l);else if(E){var P=null;if(y&&y.hasAttribute("formAction")){if(g=y,E=y[tn]||null)P=E.formAction;else if(b_(g)!==null)continue}else P=E.action;typeof P=="function"?l[d+1]=P:(l.splice(d,3),d-=3),AC(l)}}}function RC(){function s(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return g=E})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),g!==null&&(g(),g=null)}}}function w_(s){this._internalRoot=s}Zh.prototype.render=w_.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,d=us();bC(l,d,s,a,null,null)},Zh.prototype.unmount=w_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;bC(s.current,2,null,s,null,null),Lh(),a[ns]=null}};function Zh(s){this._internalRoot=s}Zh.prototype.unstable_scheduleHydration=function(s){if(s){var a=Li();s={blockedOn:null,target:s,priority:a};for(var l=0;l<Ia.length&&a!==0&&a<Ia[l].priority;l++);Ia.splice(l,0,s),l===0&&EC(s)}};var NC=t.version;if(NC!=="19.2.7")throw Error(i(527,NC,"19.2.7"));T.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=f(a),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var E4={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{gt=Jh.inject(E4),xt=Jh}catch{}}return xu.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,d="",g=Bw,y=Pw,E=$w;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError)),a=vC(s,1,!1,null,null,l,d,null,g,y,E,RC),s[ns]=a.current,i_(s),new w_(a)},xu.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var d=!1,g="",y=Bw,E=Pw,P=$w,J=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(E=l.onCaughtError),l.onRecoverableError!==void 0&&(P=l.onRecoverableError),l.formState!==void 0&&(J=l.formState)),a=vC(s,1,!0,a,l??null,d,g,J,y,E,P,RC),a.context=yC(null),l=a.current,d=us(),d=Rt(d),g=Sa(d),g.callback=null,wa(l,g,d),l=d,a.current.lanes=l,jt(a,l),cr(a),s[ns]=a.current,i_(s),new Zh(a)},xu.version="19.2.7",xu}var HC;function Sj(){if(HC)return T_.exports;HC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),T_.exports=bj(),T_.exports}var aT=Sj();var FC="popstate";function UC(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function wj(e={}){function t(i,r){let o=r.state?.masked,{pathname:u,search:h,hash:p}=o||i.location;return ry("",{pathname:u,search:h,hash:p},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:gd(r)}return Cj(t,n,null,e)}function wn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Qs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xj(){return Math.random().toString(36).substring(2,10)}function WC(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 ry(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Cc(t):t,state:n,key:t&&t.key||i||xj(),mask:r}}function gd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Cc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function Cj(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,u=r.history,h="POP",p=null,f=m();f==null&&(f=0,u.replaceState({...u.state,idx:f},""));function m(){return(u.state||{idx:null}).idx}function _(){h="POP";let C=m(),D=C==null?null:C-f;f=C,p&&p({action:h,location:x.location,delta:D})}function b(C,D){h="PUSH";let z=UC(C)?C:ry(x.location,C,D);f=m()+1;let F=WC(z,f),N=x.createHref(z.mask||z);try{u.pushState(F,"",N)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;r.location.assign(N)}o&&p&&p({action:h,location:x.location,delta:1})}function S(C,D){h="REPLACE";let z=UC(C)?C:ry(x.location,C,D);f=m();let F=WC(z,f),N=x.createHref(z.mask||z);u.replaceState(F,"",N),o&&p&&p({action:h,location:x.location,delta:0})}function w(C){return kj(r,C)}let x={get action(){return h},get location(){return e(r,u)},listen(C){if(p)throw new Error("A history only accepts one active listener");return r.addEventListener(FC,_),p=C,()=>{r.removeEventListener(FC,_),p=null}},createHref(C){return t(r,C)},createURL:w,encodeLocation(C){let D=w(C);return{pathname:D.pathname,search:D.search,hash:D.hash}},push:b,replace:S,go(C){return u.go(C)}};return x}function kj(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),wn(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:gd(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function oT(e,t,n="/"){return Ej(e,t,n,!1)}function Ej(e,t,n,i,r){let o=typeof t=="string"?Cc(t):t,u=ra(o.pathname||"/",n);if(u==null)return null;let h=Tj(e),p=null,f=$j(u);for(let m=0;p==null&&m<h.length;++m)p=Bj(h[m],f,i);return p}function Tj(e){let t=lT(e);return Aj(t),t}function lT(e,t=[],n=[],i="",r=!1){let o=(u,h,p=r,f)=>{let m={relativePath:f===void 0?u.path||"":f,caseSensitive:u.caseSensitive===!0,childrenIndex:h,route:u};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(i)&&p)return;wn(m.relativePath.startsWith(i),`Absolute route path "${m.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(i.length)}let _=Js([i,m.relativePath]),b=n.concat(m);u.children&&u.children.length>0&&(wn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${_}".`),lT(u.children,t,b,_,p)),!(u.path==null&&!u.index)&&t.push({path:_,score:Dj(_,u.index),routesMeta:b})};return e.forEach((u,h)=>{if(u.path===""||!u.path?.includes("?"))o(u,h);else for(let p of cT(u.path))o(u,h,!0,p)}),t}function cT(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,r=n.endsWith("?"),o=n.replace(/\?$/,"");if(i.length===0)return r?[o,""]:[o];let u=cT(i.join("/")),h=[];return h.push(...u.map(p=>p===""?o:[o,p].join("/"))),r&&h.push(...u),h.map(p=>e.startsWith("/")&&p===""?"/":p)}function Aj(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ij(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var Rj=/^:[\w-]+$/,Nj=3,Lj=2,Mj=1,jj=10,Oj=-2,qC=e=>e==="*";function Dj(e,t){let n=e.split("/"),i=n.length;return n.some(qC)&&(i+=Oj),t&&(i+=Lj),n.filter(r=>!qC(r)).reduce((r,o)=>r+(Rj.test(o)?Nj:o===""?Mj:jj),i)}function Ij(e,t){return e.length===t.length&&e.slice(0,-1).every((i,r)=>i===t[r])?e[e.length-1]-t[t.length-1]:0}function Bj(e,t,n=!1){let{routesMeta:i}=e,r={},o="/",u=[];for(let h=0;h<i.length;++h){let p=i[h],f=h===i.length-1,m=o==="/"?t:t.slice(o.length)||"/",_=up({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},m),b=p.route;if(!_&&f&&n&&!i[i.length-1].route.index&&(_=up({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},m)),!_)return null;Object.assign(r,_.params),u.push({params:r,pathname:Js([o,_.pathname]),pathnameBase:Uj(Js([o,_.pathnameBase])),route:b}),_.pathnameBase!=="/"&&(o=Js([o,_.pathnameBase]))}return u}function up(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=Pj(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],u=o.replace(/(.)\/+$/,"$1"),h=r.slice(1);return{params:i.reduce((f,{paramName:m,isOptional:_},b)=>{if(m==="*"){let w=h[b]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=h[b];return _&&!S?f[m]=void 0:f[m]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:u,pattern:e}}function Pj(e,t=!1,n=!0){Qs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,h,p,f,m)=>{if(i.push({paramName:h,isOptional:p!=null}),p){let _=m.charAt(f+u.length);return _&&_!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function $j(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Qs(!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 ra(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}var zj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Hj(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?Cc(e):e,o;return n?(n=uT(n),n.startsWith("/")?o=GC(n.substring(1),"/"):o=GC(n,t)):o=t,{pathname:o,search:Wj(i),hash:qj(r)}}function GC(e,t){let n=dp(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function N_(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Fj(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function v0(e){let t=Fj(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Vp(e,t,n,i=!1){let r;typeof e=="string"?r=Cc(e):(r={...e},wn(!r.pathname||!r.pathname.includes("?"),N_("?","pathname","search",r)),wn(!r.pathname||!r.pathname.includes("#"),N_("#","pathname","hash",r)),wn(!r.search||!r.search.includes("#"),N_("#","search","hash",r)));let o=e===""||r.pathname==="",u=o?"/":r.pathname,h;if(u==null)h=n;else{let _=t.length-1;if(!i&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),_-=1;r.pathname=b.join("/")}h=_>=0?t[_]:"/"}let p=Hj(r,h),f=u&&u!=="/"&&u.endsWith("/"),m=(o||u===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(f||m)&&(p.pathname+="/"),p}var uT=e=>e.replace(/\/\/+/g,"/"),Js=e=>uT(e.join("/")),dp=e=>e.replace(/\/+$/,""),Uj=e=>dp(e).replace(/^\/*/,"/"),Wj=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,qj=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Gj=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Kj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Vj(e){let t=e.map(n=>n.route.path).filter(Boolean);return Js(t)||"/"}var dT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hT(e,t){let n=e;if(typeof n!="string"||!zj.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(dT)try{let o=new URL(window.location.href),u=n.startsWith("//")?new URL(o.protocol+n):new URL(n),h=ra(u.pathname,t);u.origin===o.origin&&h!=null?n=h+u.search+u.hash:r=!0}catch{Qs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fT=["POST","PUT","PATCH","DELETE"];new Set(fT);var Yj=["GET",...fT];new Set(Yj);var kc=v.createContext(null);kc.displayName="DataRouter";var Yp=v.createContext(null);Yp.displayName="DataRouterState";var pT=v.createContext(!1);function Xj(){return v.useContext(pT)}var mT=v.createContext({isTransitioning:!1});mT.displayName="ViewTransition";var Zj=v.createContext(new Map);Zj.displayName="Fetchers";var Jj=v.createContext(null);Jj.displayName="Await";var _s=v.createContext(null);_s.displayName="Navigation";var jd=v.createContext(null);jd.displayName="Location";var kr=v.createContext({outlet:null,matches:[],isDataRoute:!1});kr.displayName="Route";var y0=v.createContext(null);y0.displayName="RouteError";var gT="REACT_ROUTER_ERROR",Qj="REDIRECT",eO="ROUTE_ERROR_RESPONSE";function tO(e){if(e.startsWith(`${gT}:${Qj}:{`))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 nO(e){if(e.startsWith(`${gT}:${eO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Gj(t.status,t.statusText,t.data)}catch{}}function iO(e,{relative:t}={}){wn(Ec(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=v.useContext(_s),{hash:r,pathname:o,search:u}=Od(e,{relative:t}),h=o;return n!=="/"&&(h=o==="/"?n:Js([n,o])),i.createHref({pathname:h,search:u,hash:r})}function Ec(){return v.useContext(jd)!=null}function vs(){return wn(Ec(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(jd).location}var _T="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function vT(e){v.useContext(_s).static||v.useLayoutEffect(e)}function Tc(){let{isDataRoute:e}=v.useContext(kr);return e?gO():sO()}function sO(){wn(Ec(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(kc),{basename:t,navigator:n}=v.useContext(_s),{matches:i}=v.useContext(kr),{pathname:r}=vs(),o=JSON.stringify(v0(i)),u=v.useRef(!1);return vT(()=>{u.current=!0}),v.useCallback((p,f={})=>{if(Qs(u.current,_T),!u.current)return;if(typeof p=="number"){n.go(p);return}let m=Vp(p,JSON.parse(o),r,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Js([t,m.pathname])),(f.replace?n.replace:n.push)(m,f.state,f)},[t,n,o,r,e])}v.createContext(null);function Od(e,{relative:t}={}){let{matches:n}=v.useContext(kr),{pathname:i}=vs(),r=JSON.stringify(v0(n));return v.useMemo(()=>Vp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function rO(e,t){return yT(e,t)}function yT(e,t,n){wn(Ec(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(_s),{matches:r}=v.useContext(kr),o=r[r.length-1],u=o?o.params:{},h=o?o.pathname:"/",p=o?o.pathnameBase:"/",f=o&&o.route;{let C=f&&f.path||"";ST(h,!f||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${C}">) 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="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let m=vs(),_;if(t){let C=typeof t=="string"?Cc(t):t;wn(p==="/"||C.pathname?.startsWith(p),`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 "${p}" but pathname "${C.pathname}" was given in the \`location\` prop.`),_=C}else _=m;let b=_.pathname||"/",S=b;if(p!=="/"){let C=p.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(C=>Object.assign(C,{route:n.manifest[C.route.id]||C.route})):oT(e,{pathname:S});Qs(f||w!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Qs(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=uO(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:Js([p,i.encodeLocation?i.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?p:Js([p,i.encodeLocation?i.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),r,n);return t&&x?v.createElement(jd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,..._},navigationType:"POP"}},x):x}function aO(){let e=mO(),t=Kj(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:o},"ErrorBoundary")," or"," ",v.createElement("code",{style:o},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:r},n):null,u)}var oO=v.createElement(aO,null),bT=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=nO(e.digest);n&&(e=n)}let t=e!==void 0?v.createElement(kr.Provider,{value:this.props.routeContext},v.createElement(y0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(lO,{error:e},t):t}};bT.contextType=pT;var L_=new WeakMap;function lO({children:e,error:t}){let{basename:n}=v.useContext(_s);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=tO(t.digest);if(i){let r=L_.get(t);if(r)throw r;let o=hT(i.location,n);if(dT&&!L_.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw L_.set(t,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function cO({routeContext:e,match:t,children:n}){let i=v.useContext(kc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(kr.Provider,{value:e},n)}function uO(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,o=i?.errors;if(o!=null){let m=r.findIndex(_=>_.route.id&&o?.[_.route.id]!==void 0);wn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,m+1))}let u=!1,h=-1;if(n&&i){u=i.renderFallback;for(let m=0;m<r.length;m++){let _=r[m];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(h=m),_.route.id){let{loaderData:b,errors:S}=i,w=_.route.loader&&!b.hasOwnProperty(_.route.id)&&(!S||S[_.route.id]===void 0);if(_.route.lazy||w){n.isStatic&&(u=!0),h>=0?r=r.slice(0,h+1):r=[r[0]];break}}}}let p=n?.onError,f=i&&p?(m,_)=>{p(m,{location:i.location,params:i.matches?.[0]?.params??{},pattern:Vj(i.matches),errorInfo:_})}:void 0;return r.reduceRight((m,_,b)=>{let S,w=!1,x=null,C=null;i&&(S=o&&_.route.id?o[_.route.id]:void 0,x=_.route.errorElement||oO,u&&(h<0&&b===0?(ST("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):h===b&&(w=!0,C=_.route.hydrateFallbackElement||null)));let D=t.concat(r.slice(0,b+1)),z=()=>{let F;return S?F=x:w?F=C:_.route.Component?F=v.createElement(_.route.Component,null):_.route.element?F=_.route.element:F=m,v.createElement(cO,{match:_,routeContext:{outlet:m,matches:D,isDataRoute:i!=null},children:F})};return i&&(_.route.ErrorBoundary||_.route.errorElement||b===0)?v.createElement(bT,{location:i.location,revalidation:i.revalidation,component:x,error:S,children:z(),routeContext:{outlet:null,matches:D,isDataRoute:!0},onError:f}):z()},null)}function b0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dO(e){let t=v.useContext(kc);return wn(t,b0(e)),t}function hO(e){let t=v.useContext(Yp);return wn(t,b0(e)),t}function fO(e){let t=v.useContext(kr);return wn(t,b0(e)),t}function S0(e){let t=fO(e),n=t.matches[t.matches.length-1];return wn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function pO(){return S0("useRouteId")}function mO(){let e=v.useContext(y0),t=hO("useRouteError"),n=S0("useRouteError");return e!==void 0?e:t.errors?.[n]}function gO(){let{router:e}=dO("useNavigate"),t=S0("useNavigate"),n=v.useRef(!1);return vT(()=>{n.current=!0}),v.useCallback(async(r,o={})=>{Qs(n.current,_T),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var KC={};function ST(e,t,n){!t&&!KC[e]&&(KC[e]=!0,Qs(!1,n))}v.memo(_O);function _O({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return yT(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function M_({to:e,replace:t,state:n,relative:i}){wn(Ec(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=v.useContext(_s);Qs(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=v.useContext(kr),{pathname:u}=vs(),h=Tc(),p=Vp(e,v0(o),u,i==="path"),f=JSON.stringify(p);return v.useEffect(()=>{h(JSON.parse(f),{replace:t,state:n,relative:i})},[h,f,i,t,n]),null}function Fl(e){wn(!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 vO({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:u}){wn(!Ec(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),p=v.useMemo(()=>({basename:h,navigator:r,static:o,useTransitions:u,future:{}}),[h,r,o,u]);typeof n=="string"&&(n=Cc(n));let{pathname:f="/",search:m="",hash:_="",state:b=null,key:S="default",mask:w}=n,x=v.useMemo(()=>{let C=ra(f,h);return C==null?null:{location:{pathname:C,search:m,hash:_,state:b,key:S,mask:w},navigationType:i}},[h,f,m,_,b,S,i,w]);return Qs(x!=null,`<Router basename="${h}"> is not able to match the URL "${f}${m}${_}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:v.createElement(_s.Provider,{value:p},v.createElement(jd.Provider,{children:t,value:x}))}function yO({children:e,location:t}){return rO(ay(e),t)}function ay(e,t=[]){let n=[];return v.Children.forEach(e,(i,r)=>{if(!v.isValidElement(i))return;let o=[...t,r];if(i.type===v.Fragment){n.push.apply(n,ay(i.props.children,o));return}wn(i.type===Fl,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),wn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let u={id:i.props.id||o.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(u.children=ay(i.props.children,o)),n.push(u)}),n}var If="get",Bf="application/x-www-form-urlencoded";function Xp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bO(e){return Xp(e)&&e.tagName.toLowerCase()==="button"}function SO(e){return Xp(e)&&e.tagName.toLowerCase()==="form"}function wO(e){return Xp(e)&&e.tagName.toLowerCase()==="input"}function xO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CO(e,t){return e.button===0&&(!t||t==="_self")&&!xO(e)}var Qh=null;function kO(){if(Qh===null)try{new FormData(document.createElement("form"),0),Qh=!1}catch{Qh=!0}return Qh}var EO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function j_(e){return e!=null&&!EO.has(e)?(Qs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bf}"`),null):e}function TO(e,t){let n,i,r,o,u;if(SO(e)){let h=e.getAttribute("action");i=h?ra(h,t):null,n=e.getAttribute("method")||If,r=j_(e.getAttribute("enctype"))||Bf,o=new FormData(e)}else if(bO(e)||wO(e)&&(e.type==="submit"||e.type==="image")){let h=e.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||h.getAttribute("action");if(i=p?ra(p,t):null,n=e.getAttribute("formmethod")||h.getAttribute("method")||If,r=j_(e.getAttribute("formenctype"))||j_(h.getAttribute("enctype"))||Bf,o=new FormData(h,e),!kO()){let{name:f,type:m,value:_}=e;if(m==="image"){let b=f?`${f}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else f&&o.append(f,_)}}else{if(Xp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=If,i=null,r=Bf,u=e}return o&&r==="text/plain"&&(u=o,o=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function w0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wT(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&ra(r.pathname,t)==="/"?r.pathname=`${dp(t)}/_root.${i}`:r.pathname=`${dp(r.pathname)}.${i}`,r}async function AO(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function RO(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 NO(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let u=await AO(o,n);return u.links?u.links():[]}return[]}));return OO(i.flat(1).filter(RO).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function VC(e,t,n,i,r,o){let u=(p,f)=>n[f]?p.route.id!==n[f].route.id:!0,h=(p,f)=>n[f].pathname!==p.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==p.params["*"];return o==="assets"?t.filter((p,f)=>u(p,f)||h(p,f)):o==="data"?t.filter((p,f)=>{let m=i.routes[p.route.id];if(!m||!m.hasLoader)return!1;if(u(p,f)||h(p,f))return!0;if(p.route.shouldRevalidate){let _=p.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function LO(e,t,{includeHydrateFallback:n}={}){return MO(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function MO(e){return[...new Set(e)]}function jO(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function OO(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(jO(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function x0(){let e=v.useContext(kc);return w0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function DO(){let e=v.useContext(Yp);return w0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var C0=v.createContext(void 0);C0.displayName="FrameworkContext";function k0(){let e=v.useContext(C0);return w0(e,"You must render this element inside a <HydratedRouter> element"),e}function IO(e,t){let n=v.useContext(C0),[i,r]=v.useState(!1),[o,u]=v.useState(!1),{onFocus:h,onBlur:p,onMouseEnter:f,onMouseLeave:m,onTouchStart:_}=t,b=v.useRef(null);v.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let x=D=>{D.forEach(z=>{u(z.isIntersecting)})},C=new IntersectionObserver(x,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[e]),v.useEffect(()=>{if(i){let x=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(x)}}},[i]);let S=()=>{r(!0)},w=()=>{r(!1),u(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:Cu(h,S),onBlur:Cu(p,w),onMouseEnter:Cu(f,S),onMouseLeave:Cu(m,w),onTouchStart:Cu(_,S)}]:[!1,b,{}]}function Cu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function BO({page:e,...t}){let n=Xj(),{router:i}=x0(),r=v.useMemo(()=>oT(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?v.createElement($O,{page:e,matches:r,...t}):v.createElement(zO,{page:e,matches:r,...t}):null}function PO(e){let{manifest:t,routeModules:n}=k0(),[i,r]=v.useState([]);return v.useEffect(()=>{let o=!1;return NO(e,t,n).then(u=>{o||r(u)}),()=>{o=!0}},[e,t,n]),i}function $O({page:e,matches:t,...n}){let i=vs(),{future:r}=k0(),{basename:o}=x0(),u=v.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let h=wT(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,f=[];for(let m of t)typeof m.route.shouldRevalidate=="function"?p=!0:f.push(m.route.id);return p&&f.length>0&&h.searchParams.set("_routes",f.join(",")),[h.pathname+h.search]},[o,r.v8_trailingSlashAwareDataRequests,e,i,t]);return v.createElement(v.Fragment,null,u.map(h=>v.createElement("link",{key:h,rel:"prefetch",as:"fetch",href:h,...n})))}function zO({page:e,matches:t,...n}){let i=vs(),{future:r,manifest:o,routeModules:u}=k0(),{basename:h}=x0(),{loaderData:p,matches:f}=DO(),m=v.useMemo(()=>VC(e,t,f,o,i,"data"),[e,t,f,o,i]),_=v.useMemo(()=>VC(e,t,f,o,i,"assets"),[e,t,f,o,i]),b=v.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,C=!1;if(t.forEach(z=>{let F=o.routes[z.route.id];!F||!F.hasLoader||(!m.some(N=>N.route.id===z.route.id)&&z.route.id in p&&u[z.route.id]?.shouldRevalidate||F.hasClientLoader?C=!0:x.add(z.route.id))}),x.size===0)return[];let D=wT(e,h,r.v8_trailingSlashAwareDataRequests,"data");return C&&x.size>0&&D.searchParams.set("_routes",t.filter(z=>x.has(z.route.id)).map(z=>z.route.id).join(",")),[D.pathname+D.search]},[h,r.v8_trailingSlashAwareDataRequests,p,i,o,m,t,e,u]),S=v.useMemo(()=>LO(_,o),[_,o]),w=PO(_);return v.createElement(v.Fragment,null,b.map(x=>v.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),S.map(x=>v.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),w.map(({key:x,link:C})=>v.createElement("link",{key:x,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function HO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var FO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{FO&&(window.__reactRouterVersion="7.17.0")}catch{}function UO({basename:e,children:t,useTransitions:n,window:i}){let r=v.useRef();r.current==null&&(r.current=wj({window:i,v5Compat:!0}));let o=r.current,[u,h]=v.useState({action:o.action,location:o.location}),p=v.useCallback(f=>{n===!1?h(f):v.startTransition(()=>h(f))},[n]);return v.useLayoutEffect(()=>o.listen(p),[o,p]),v.createElement(vO,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:n})}var xT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_d=v.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:u,mask:h,state:p,target:f,to:m,preventScrollReset:_,viewTransition:b,defaultShouldRevalidate:S,...w},x){let{basename:C,navigator:D,useTransitions:z}=v.useContext(_s),F=typeof m=="string"&&xT.test(m),N=hT(m,C);m=N.to;let I=iO(m,{relative:r}),j=vs(),U=null;if(h){let M=Vp(h,[],j.mask?j.mask.pathname:"/",!0);C!=="/"&&(M.pathname=M.pathname==="/"?C:Js([C,M.pathname])),U=D.createHref(M)}let[G,W,Z]=IO(i,w),V=KO(m,{replace:u,mask:h,state:p,target:f,preventScrollReset:_,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:z});function O(M){t&&t(M),M.defaultPrevented||V(M)}let A=!(N.isExternal||o),B=v.createElement("a",{...w,...Z,href:(A?U:void 0)||N.absoluteURL||I,onClick:A?O:t,ref:HO(x,W),target:f,"data-discover":!F&&n==="render"?"true":void 0});return G&&!F?v.createElement(v.Fragment,null,B,v.createElement(BO,{page:I})):B});_d.displayName="Link";var WO=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:u,viewTransition:h,children:p,...f},m){let _=Od(u,{relative:f.relative}),b=vs(),S=v.useContext(Yp),{navigator:w,basename:x}=v.useContext(_s),C=S!=null&&JO(_)&&h===!0,D=w.encodeLocation?w.encodeLocation(_).pathname:_.pathname,z=b.pathname,F=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(z=z.toLowerCase(),F=F?F.toLowerCase():null,D=D.toLowerCase()),F&&x&&(F=ra(F,x)||F);const N=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let I=z===D||!r&&z.startsWith(D)&&z.charAt(N)==="/",j=F!=null&&(F===D||!r&&F.startsWith(D)&&F.charAt(D.length)==="/"),U={isActive:I,isPending:j,isTransitioning:C},G=I?t:void 0,W;typeof i=="function"?W=i(U):W=[i,I?"active":null,j?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let Z=typeof o=="function"?o(U):o;return v.createElement(_d,{...f,"aria-current":G,className:W,ref:m,style:Z,to:u,viewTransition:h},typeof p=="function"?p(U):p)});WO.displayName="NavLink";var qO=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:u=If,action:h,onSubmit:p,relative:f,preventScrollReset:m,viewTransition:_,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:x}=v.useContext(_s),C=XO(),D=ZO(h,{relative:f}),z=u.toLowerCase()==="get"?"get":"post",F=typeof h=="string"&&xT.test(h),N=I=>{if(p&&p(I),I.defaultPrevented)return;I.preventDefault();let j=I.nativeEvent.submitter,U=j?.getAttribute("formmethod")||u,G=()=>C(j||I.currentTarget,{fetcherKey:t,method:U,navigate:n,replace:r,state:o,relative:f,preventScrollReset:m,viewTransition:_,defaultShouldRevalidate:b});x&&n!==!1?v.startTransition(()=>G()):G()};return v.createElement("form",{ref:w,method:z,action:D,onSubmit:i?p:N,...S,"data-discover":!F&&e==="render"?"true":void 0})});qO.displayName="Form";function GO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function CT(e){let t=v.useContext(kc);return wn(t,GO(e)),t}function KO(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:u,viewTransition:h,defaultShouldRevalidate:p,useTransitions:f}={}){let m=Tc(),_=vs(),b=Od(e,{relative:u});return v.useCallback(S=>{if(CO(S,t)){S.preventDefault();let w=n!==void 0?n:gd(_)===gd(b),x=()=>m(e,{replace:w,mask:i,state:r,preventScrollReset:o,relative:u,viewTransition:h,defaultShouldRevalidate:p});f?v.startTransition(()=>x()):x()}},[_,m,b,n,i,r,t,e,o,u,h,p,f])}var VO=0,YO=()=>`__${String(++VO)}__`;function XO(){let{router:e}=CT("useSubmit"),{basename:t}=v.useContext(_s),n=pO(),i=e.fetch,r=e.navigate;return v.useCallback(async(o,u={})=>{let{action:h,method:p,encType:f,formData:m,body:_}=TO(o,t);if(u.navigate===!1){let b=u.fetcherKey||YO();await i(b,n,u.action||h,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:_,formMethod:u.method||p,formEncType:u.encType||f,flushSync:u.flushSync})}else await r(u.action||h,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:_,formMethod:u.method||p,formEncType:u.encType||f,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,r,t,n])}function ZO(e,{relative:t}={}){let{basename:n}=v.useContext(_s),i=v.useContext(kr);wn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...Od(e||".",{relative:t})},u=vs();if(e==null){o.search=u.search;let h=new URLSearchParams(o.search),p=h.getAll("index");if(p.some(m=>m==="")){h.delete("index"),p.filter(_=>_).forEach(_=>h.append("index",_));let m=h.toString();o.search=m?`?${m}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Js([n,o.pathname])),gd(o)}function JO(e,{relative:t}={}){let n=v.useContext(mT);wn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=CT("useViewTransitionState"),r=Od(e,{relative:t});if(!n.isTransitioning)return!1;let o=ra(n.currentLocation.pathname,i)||n.currentLocation.pathname,u=ra(n.nextLocation.pathname,i)||n.nextLocation.pathname;return up(r.pathname,u)!=null||up(r.pathname,o)!=null}const QO=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let pn=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function YC(e){return(await kT(e)).theaters}async function kT(e){const t=await fetch("/api/v1/theaters",{signal:e});await pi(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new pn(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>T0(i,t.status))}}async function eD(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await pi(i),dD(await i.json(),i.status)}async function tD(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await pi(t),hD(await t.json(),t.status)}async function nD(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const n=t.size>0?`?${t}`:"",i=await fetch(`/api/v1/updates/release-notes${n}`,{signal:e.signal});return await pi(i),pD(await i.json(),i.status)}async function iD(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await pi(t),fD(await t.json(),t.status)}async function ET(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await pi(n);const i=await n.json();return T0(i,n.status)}async function sD(e,t,n){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:t}),signal:n});return await pi(i),T0(await i.json(),i.status)}async function rD(e,t){const n=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await pi(n),yD(await n.json(),n.status)}async function TT(e,t){const n=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await pi(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new pn(n.status,"Invalid folder grant response");return i.folderGrantId}async function aD(e,t){const n=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e}),signal:t});return await pi(n),await n.json()}async function oD(e,t,n){const i=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,name:t}),signal:n});return await pi(i),await i.json()}async function lD(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await pi(n)}async function Qi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await pi(i);const r=await i.json();if(!Array.isArray(r.operations))throw new pn(i.status,"Invalid operations response");return r.operations.map(o=>RT(o,i.status))}async function Mo(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await pi(i);const r=await i.json();if(!Array.isArray(r.groups))throw new pn(i.status,"Invalid groups response");return r.groups.map(o=>E0(o,i.status))}async function cD(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await pi(n);const i=await n.json();return E0(i.group,n.status)}async function O_(e,t,n){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await pi(i);const r=await i.json();return E0(r.group,i.status)}async function uD(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await pi(n)}async function AT(e,t,n){return Pf(e,{title:t},n)}async function Pf(e,t,n){const i=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await pi(i);const r=await i.json();return RT(r.operation,i.status)}function RT(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||vd(n)||vd(n.payload))throw new pn(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,accent:typeof n.accent=="string"?n.accent:null,groupId:n.groupId===null?null:typeof n.groupId=="string"?n.groupId:void 0,ts:n.ts}}function E0(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.name!="string"||typeof n.color!="string"||typeof n.order!="number"||typeof n.createdAt!="number")throw new pn(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function T0(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string"||typeof n.createdAt!="string"||typeof n.lastOpenedAt!="string"||typeof n.hasWiki!="boolean"||typeof n.activeAdmiralCount!="number"||vd(n))throw new pn(t,"Invalid Theater response");return{id:n.id,label:n.label,createdAt:n.createdAt,lastOpenedAt:n.lastOpenedAt,...typeof n.order=="number"&&Number.isInteger(n.order)&&n.order>=0?{order:n.order}:{},hasWiki:n.hasWiki,activeAdmiralCount:n.activeAdmiralCount}}function dD(e,t){const n=e;if(!n||typeof n.workspaces!="number"||typeof n.version!="string"||n.channel!=="stable"&&n.channel!=="local"&&n.channel!=="unknown"||typeof n.updateAvailable!="boolean"||typeof n.port!="number"||n.portMode!=="dynamic"&&n.portMode!=="static"||n.requestedPort!==null&&typeof n.requestedPort!="number"||typeof n.effectivePort!="number"||typeof n.portHonored!="boolean"||n.wikiServerStatus!=="available"&&n.wikiServerStatus!=="unavailable"&&n.wikiServerStatus!=="unknown")throw new pn(t,"Invalid status response");return{workspaces:n.workspaces,version:n.version,channel:n.channel,updateAvailable:n.updateAvailable,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:void 0,port:n.port,portMode:n.portMode,requestedPort:n.requestedPort,effectivePort:n.effectivePort,portHonored:n.portHonored,wikiServerStatus:n.wikiServerStatus}}function hD(e,t){const n=e;if(!n||n.channel!=="local"||typeof n.version!="string"||typeof n.effectivePort!="number"||typeof n.dataDir!="string"||typeof n.lockFile!="string"||Object.keys(n).length!==5)throw new pn(t,"Invalid environment response");return n}function fD(e,t){const n=e;if(!n||n.status!=="accepted")throw new pn(t,"Invalid update response");return{status:"accepted"}}function pD(e,t){const n=e;if(!n||!Array.isArray(n.notes)||n.sourceRef!=="main"||typeof n.fetchedAt!="number"||typeof n.stale!="boolean"||"url"in n||"token"in n||"path"in n)throw new pn(t,"Invalid release notes response");return{notes:n.notes.map(i=>mD(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function mD(e,t){const n=e;if(!n||typeof n.version!="string"||n.date!==null&&typeof n.date!="string"||!Array.isArray(n.sections)||typeof n.localizationFallback!="boolean")throw new pn(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>gD(i,t)),localizationFallback:n.localizationFallback}}function gD(e,t){const n=e;if(!n||n.heading!=="Added"&&n.heading!=="Changed"&&n.heading!=="Fixed"&&n.heading!=="Removed"&&n.heading!=="Breaking Changes"||!Array.isArray(n.items))throw new pn(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>_D(i,t))}}function _D(e,t){const n=e;if(!n||!Array.isArray(n.packageTags)||!n.packageTags.every(i=>typeof i=="string")||typeof n.text!="string"||"product"in n&&!vD(n.product))throw new pn(t,"Invalid release notes response");return"product"in n?{packageTags:n.packageTags,text:n.text,product:n.product}:{packageTags:n.packageTags,text:n.text}}function vD(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function yD(e,t){const n=e;if(!n||typeof n.path!="string"||n.parentPath!==null&&typeof n.parentPath!="string"||!Array.isArray(n.roots)||!Array.isArray(n.entries)||vd(n))throw new pn(t,"Invalid folder list response");return{path:n.path,parentPath:n.parentPath??null,roots:n.roots.filter(i=>typeof i=="string"),entries:n.entries.map(i=>bD(i,t)),truncated:n.truncated===!0?!0:void 0}}function bD(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||vd(n))throw new pn(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function vd(e){if(!e||typeof e!="object")return!1;const t=e;return QO.some(n=>n in t)}async function pi(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const n=await e.json();typeof n.error=="string"?t=n.error:typeof n.message=="string"&&(t=n.message)}catch{}throw new pn(e.status,t)}const SD=200,wD=.5,xD="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",CD=["monospace","serif","sans-serif"],Yu=new Map;function kD(e,t={}){const n=Zp(e);if(!n)return!1;const i=n.toLocaleLowerCase(),r=Yu.get(i);if(r!==void 0)return r;const o=t.document??globalThis.document;if(!o)return!1;const u=o.createElement("canvas").getContext("2d");if(!u)return!1;const h=CD.some(p=>{const f=XC(u,`${NT(n)}, ${p}`),m=XC(u,p);return Math.abs(f-m)>wD});return ED(i,h,t.maxEntries??SD),h}function NT(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function hp(e,t){const n=Zp(e);return n?`${NT(n)}, ${t}`:t}function Zp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function XC(e,t){return e.font=`28px ${t}`,e.measureText(xD).width}function ED(e,t,n){if(Yu.size>=Math.max(1,n)){const i=Yu.keys().next().value;i&&Yu.delete(i)}Yu.set(e,t)}const nc={min:12,max:18,step:1,defaultValue:14},ld={source:"builtin",id:"manrope",size:nc.defaultValue},fp=[{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 TD(e){if(!e||typeof e!="object")return ld;const t=e,n=AD(t.size);if(t.source==="builtin"&&ND(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=Zp(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return ld}function AD(e){return typeof e!="number"||!Number.isInteger(e)||e<nc.min||e>nc.max?nc.defaultValue:e}function LT(e){return e.source==="system"?hp(e.familyName,fp[0].family):RD(e.id).family}function RD(e){return fp.find(t=>t.id===e)??fp[0]}function ND(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}async function MT(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await jT(t),OT(await t.json(),t.status)}async function LD(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await jT(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new pn(n.status,"Invalid global settings mutation response");return{state:OT(i.state,n.status)}}async function jT(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new pn(e.status,t)}function OT(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!MD(n.consoleStaticPort)||typeof n.reducePanelMotion!="boolean"||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!jD(n.language))throw new pn(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,reducePanelMotion:n.reducePanelMotion,theme:n.theme,uiFont:TD(n.uiFont),language:n.language}}function MD(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function jD(e){return e==="auto"||e==="en"||e==="ko"}const oy=new Set;let yd={loading:!1,state:null,savingField:null,error:null};function Jp(){return v.useSyncExternalStore(DT,hc,hc)}function hc(){return yd}function OD(e){zo({loading:!1,state:e,error:null})}function DT(e){return oy.add(e),()=>{oy.delete(e)}}async function DD(e){zo({loading:!0,error:null});try{const t=await MT(e);zo({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;zo({loading:!1,error:IT(t)})}}async function io(e,t){if(yd.savingField!==null)return!1;const n=yd.state,i=n?{...n,[e]:t}:null;zo({state:i,savingField:e,error:null});try{const r=await LD({[e]:t});return zo({state:r.state,savingField:null,error:null}),!0}catch(r){return zo({state:n,savingField:null,error:IT(r)}),!1}}function zo(e){yd={...yd,...e};for(const t of oy)t()}function IT(e){return e instanceof Error?e.message:String(e)}const ID="fleet-console.canvas.",BT="fleet-console.formation-layout",BD=400,ly=640,cy=400,ZC=40,PD=320,$D=200,zD=8,HD=0,JC=96,FD=.25,UD=1,D_=.2,QC=.5,WD=.001,Xl={x:0,y:0,zoom:1},ic={viewport:Xl,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},uy=new Set,dy=new Set,hy=new Set,fy=new Set,py=new Set,er=new Map,fc=new Map;let qt=null,eo=null,ot=ic,hn=null,PT=0,Ho={},es=!1,A0=fI(),Xa=Xl,Fo=null,pp=0;function R0(e){return uy.add(e),()=>{uy.delete(e)}}function gr(){return ot}function qD(e){return qt===e?ot:D0(e)}function yr(){return hn?.mode==="maximized"?hn.operationId:null}function Ps(){return hn?.mode==="companion"?hn.operationId:null}function ek(){return PT}function GD(e){const t=qt===e?hn:er.get(e)??null;return t?.mode==="companion"?t.operationId:null}function mp(){return es}function tk(){return A0}function $T(){return qt}function N0(){return v.useSyncExternalStore(R0,gr,gr)}function zT(){return v.useSyncExternalStore(XT,yr,yr)}function HT(){return v.useSyncExternalStore(XT,Ps,Ps)}function KD(e){const t=v.useSyncExternalStore(oI,ik,ik);return e===null?{}:t[e]??{}}function VD(e,t,n){const i=Ho[e]??{};i[t]!==n&&(Ho={...Ho,[e]:{...i,[t]:n}},ZT())}function Qp(){return v.useSyncExternalStore(rI,mp,mp)}function FT(){return v.useSyncExternalStore(aI,tk,tk)}function UT(){return v.useSyncExternalStore(R0,sk,sk)}function ts(e){ot={viewport:e.viewport??ot.viewport,operations:e.operations??ot.operations,operationOrder:e.operationOrder??ot.operationOrder,operationAccent:e.operationAccent??ot.operationAccent,minimized:e.minimized??ot.minimized,collapsedGroups:e.collapsedGroups??ot.collapsedGroups},uI(),M0()}function WT(e){const t=ot.collapsedGroups.includes(e)?ot.collapsedGroups.filter(n=>n!==e):[...ot.collapsedGroups,e];ts({collapsedGroups:t})}function YD(e,t){if(qt===e){WT(t);return}const n=D0(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];I0(e,{...n,collapsedGroups:i}),ot={...ot},M0()}function XD(){return v.useSyncExternalStore(R0,rk,rk)}function my(e){j0();const t=B0(e);Xa=t,ts({viewport:t})}function qT(e){const t=B0(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||tA()){my(t);return}Xa=t,Fo===null&&(Fo=window.requestAnimationFrame(eA))}function gy(e,t){const n=Yo();ts({operations:{...ot.operations,[e]:{...P0(t,n),zIndex:n}}})}function ZD(e,t,n=PD,i=$D,r=zD,o=HD,u="grid"){if(!Number.isFinite(t)||t<=0)return[];const h=Math.max(0,e.width-o*2),p=Math.max(0,e.height-o*2);if(u==="columns"){const x=Math.max(0,h-r*(t-1)),C=x/t,D=Math.min(n,C),z=Math.min(Math.max(D,C),x),F=p,N=Math.min(i,F),I=Math.min(Math.max(N,F),p);return Array.from({length:t},(j,U)=>({x:e.x+o+U*(z+r),y:e.y+o,width:z,height:I}))}if(u==="rows"){const x=h,C=Math.min(n,x),D=Math.min(Math.max(C,x),h),z=Math.max(0,p-r*(t-1)),F=z/t,N=Math.min(i,F),I=Math.min(Math.max(N,F),z);return Array.from({length:t},(j,U)=>({x:e.x+o,y:e.y+o+U*(I+r),width:D,height:I}))}const f=Math.ceil(Math.sqrt(t)),m=Math.ceil(t/f),_=Math.max(0,p-r*(m-1)),b=_/m,S=Math.min(i,b),w=Math.min(Math.max(S,b),_);return Array.from({length:t},(x,C)=>{const D=Math.floor(C/f),z=C%f,F=D===m-1?t-(m-1)*f:f,N=Math.max(0,h-r*(F-1)),I=N/F,j=Math.min(n,I),U=Math.min(Math.max(j,I),N);return{x:e.x+o+z*(U+r),y:e.y+o+D*(w+r),width:U,height:w}})}function GT(e){ot.minimized.includes(e)||(yr()===e&&so(),Ps()===e&&tr(),ts({minimized:[...ot.minimized,e]}))}function JD(e){const t=new Set,i=[...ot.minimized.filter(u=>t.has(u)||!(u in ot.operations)?!1:(t.add(u),!0)),...e.filter(u=>t.has(u)||!(u in ot.operations)?!1:(t.add(u),!0))];if(QT(ot.minimized,i))return;const r=yr(),o=Ps();r&&i.includes(r)&&so(),o&&i.includes(o)&&tr(),ts({minimized:i})}function _y(e){if(!ot.minimized.includes(e))return;yr()===e&&so();const t=ot.minimized.filter(r=>r!==e),n=ot.operations[e];if(!n){ts({minimized:t});return}const i=Yo();ts({minimized:t,operations:{...ot.operations,[e]:{...n,zIndex:i}}})}function I_(e){ts({operationOrder:iA(e)})}function Yo(){return pp+=1,pp}function QD(e){const t=ot.operations[e];if(t)return t;const n=Object.keys(ot.operations).length,i={x:n*ZC,y:n*ZC,width:ly,height:cy,zIndex:Yo()};return ts({operations:{...ot.operations,[e]:i}}),i}function eI(e){const t=new Set(e),n={};let i=!1;for(const[b,S]of Object.entries(ot.operations))t.has(b)?n[b]=S:i=!0;const r=ot.minimized.filter(b=>t.has(b)),o=r.length!==ot.minimized.length,u=ot.operationOrder.filter(b=>t.has(b)),h=u.length!==ot.operationOrder.length,p=Object.fromEntries(Object.entries(ot.operationAccent).filter(([b])=>t.has(b))),f=Object.keys(p).length!==Object.keys(ot.operationAccent).length,m=yr(),_=Ps();m&&(!t.has(m)||r.includes(m))&&so(),_&&r.includes(_)&&tr(),(i||o||h||f)&&ts({operations:n,minimized:r,operationOrder:u,operationAccent:p})}function tI(e){dI(),j0(),cI(),qt=e,ot=e?D0(e):ic;const t=e?er.get(e)??null:null,n=!JT(hn,t);hn=t;const i=e?fc.has(e):!1,r=es!==i;es=i,Xa=ot.viewport,pp=Math.max(pp,sA(ot.operations)),M0(),n&&Dd(),r&&pc()}function nI(e,t){const n=ot.operations[e];if(!n)return;const i=Math.max(FD,Math.min(UD,Math.min((t.width-JC)/n.width,(t.height-JC)/n.height))),r={x:t.width/2-(n.x+n.width/2)*i,y:t.height/2-(n.y+n.height/2)*i,zoom:i};j0(),Xa=r;const o=Yo(),u=ot.minimized.includes(e);ts({viewport:r,operations:{...ot.operations,[e]:{...P0(n,o),zIndex:o}},...u?{minimized:ot.minimized.filter(h=>h!==e)}:{}})}function L0(e){const t={mode:"maximized",operationId:e};qt&&er.set(qt,t),VT(t)}function so(){qt&&er.get(qt)?.mode==="maximized"&&er.delete(qt),hn?.mode==="maximized"&&(hn=null,Dd())}function KT(e){em(e);const t=hn?.mode==="companion"?hn.returnTo:hn?.mode==="maximized"?"maximized":"underlay";VT({mode:"companion",operationId:e,returnTo:t})}function VT(e){hn?.mode==="companion"&&!(e.mode==="companion"&&e.operationId===hn.operationId)&&em(hn.operationId);const t=ot.minimized.filter(r=>r!==e.operationId),n=!QT(ot.minimized,t),i=!JT(hn,e);i&&(hn=e),i&&qt&&er.set(qt,e),n&&ts({minimized:t}),i&&Dd()}function iI(){if(hn?.mode!=="companion")return;const e=hn;hn=e.returnTo==="maximized"&&e.operationId in ot.operations&&!ot.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,qt&&(hn?er.set(qt,hn):er.delete(qt)),em(e.operationId),Dd()}function tr(){if(hn?.mode!=="companion")return;const e=hn.operationId;hn=null,qt&&er.delete(qt),em(e),Dd()}function sI(){if(qt){if(Ps()!==null){tr(),es||(fc.set(qt,!0),es=!0,pc());return}if(es){YT();return}so(),tr(),fc.set(qt,!0),es=!0,pc()}}function B_(e){if(qt){if(Ps()!==null){nk(e),tr(),es||(fc.set(qt,!0),es=!0,pc());return}if(es&&A0===e){YT();return}nk(e),es||(so(),tr(),fc.set(qt,!0),es=!0,pc())}}function YT(){qt&&fc.delete(qt),es&&(es=!1,pc())}function nk(e){A0=e,pI(e),lI()}function rI(e){return fy.add(e),()=>{fy.delete(e)}}function aI(e){return py.add(e),()=>{py.delete(e)}}function M0(){for(const e of uy)e()}function XT(e){return dy.add(e),()=>{dy.delete(e)}}function oI(e){return hy.add(e),()=>{hy.delete(e)}}function ik(){return Ho}function ZT(){for(const e of hy)e()}function em(e){if(!(e in Ho))return;const t={...Ho};delete t[e],Ho=t,ZT()}function pc(){for(const e of fy)e()}function lI(){for(const e of py)e()}function sk(){return ot.minimized}function rk(){return ot.collapsedGroups}function Dd(){PT+=1;for(const e of dy)e()}function cI(){qt&&(hn?er.set(qt,hn):er.delete(qt))}function JT(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function QT(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function eA(){const e=ot.viewport,t=Xa.x-e.x,n=Xa.y-e.y,i=Xa.zoom-e.zoom;if(Math.abs(t)<QC&&Math.abs(n)<QC&&Math.abs(i)<WD){Fo=null,ts({viewport:Xa});return}ts({viewport:{x:e.x+t*D_,y:e.y+n*D_,zoom:e.zoom+i*D_}}),Fo=typeof window<"u"?window.requestAnimationFrame(eA):null}function j0(){Fo===null||typeof window>"u"||(window.cancelAnimationFrame(Fo),Fo=null)}function tA(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O0(){return hc().state?.reducePanelMotion===!0||tA()}function uI(){!qt||typeof window>"u"||(hI(),eo=window.setTimeout(()=>{eo=null,I0(qt,ot)},BD))}function dI(){!eo||!qt||typeof window>"u"||(window.clearTimeout(eo),eo=null,I0(qt,ot))}function hI(){!eo||typeof window>"u"||(window.clearTimeout(eo),eo=null)}function D0(e){if(typeof window>"u")return ic;try{const t=window.localStorage.getItem(nA(e));if(!t)return ic;const n=JSON.parse(t);return mI(n)}catch{return ic}}function I0(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(nA(e),JSON.stringify(t))}catch{}}function fI(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(BT);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function pI(e){if(!(typeof window>"u"))try{window.localStorage.setItem(BT,e)}catch{}}function nA(e){return`${ID}${e}`}function mI(e){if(!mc(e))return ic;const t=vI(e.operations);return{viewport:B0(e.viewport),operations:t,operationOrder:iA(e.operationOrder),operationAccent:gI(e.operationAccent),minimized:_I(e.minimized,t),collapsedGroups:bI(e.collapsedGroups)}}function iA(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function gI(e){if(!mc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function _I(e,t){if(!Array.isArray(e))return[];const n=new Set,i=[];for(const r of e)typeof r!="string"||n.has(r)||!(r in t)||(n.add(r),i.push(r));return i}function B0(e){if(!mc(e))return Xl;const t=cd(e.x,Xl.x),n=cd(e.y,Xl.y),i=vy(e.zoom,Xl.zoom);return{x:t,y:n,zoom:i}}function vI(e){if(!mc(e))return{};const t={};for(const[n,i]of Object.entries(e))mc(i)&&(t[n]=P0(i,yI(t)));return t}function P0(e,t){return mc(e)?{x:cd(e.x,0),y:cd(e.y,0),width:vy(e.width,ly),height:vy(e.height,cy),zIndex:cd(e.zIndex,t)}:{x:0,y:0,width:ly,height:cy,zIndex:t}}function yI(e){return sA(e)+1}function sA(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function cd(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function vy(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function mc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bI(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}const SI="__unassigned__";function wI(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(kI(i,t.get(i.theaterId)));return n}function xI(e,t){const n=$0(t);return n.length===0?e:e.filter(i=>{const r=EI(i);return n.every(o=>r.includes(o))})}function CI(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??SI,o=n.get(r);if(o!==void 0){const u=t[o];u&&(t[o]={...u,entries:[...u.entries,i]});continue}n.set(r,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function $0(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function kI(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function EI(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const yy="fleet-console.activeTheaterId",rA="fleet-console.commissioningSeen",aA="fleet-console.whatsNewSeenVersion",oA="fleet-console.notificationPreferences",lA=1,TI="instrument",ef={globalMute:!1,dnd:!1,mutedTheaterIds:{}},by=new Set;let ak=0,Sy=null,Je={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:TI,version:"",updateAvailable:!1,latestVersion:null,portMode:"dynamic",requestedPort:null,effectivePort:0,portHonored:!0,theaters:[],operations:[],operationsHydrated:!1,groups:[],activeTheaterId:null,activeOperationId:null,operationStatus:{},addingTheater:!1,theaterError:null,operationsViewActive:!1,operationSearchOpen:!1,whatsNewOpen:!1,releaseNotes:[],releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:null,releaseNotesFetchedAt:null,releaseNotesStale:!1,automaticWhatsNewVersion:null,selectedReleaseNoteKey:null,onboardingOpen:!1,bootstrapped:!1,pendingOperationFocus:null,keyboardFocusRequest:null,pendingSideBarAddTheater:!1,pendingSideBarTheaterLaunch:null,launchMenuRequest:null,keyboardShortcutsOpen:!1,operationNotifications:{},notificationPreferences:u8(),codexReader:null,codexReaderExpanded:!1};function Xo(){return Je}function cA(e){return by.add(e),()=>{by.delete(e)}}function ht(e){Je={...Je,...e},a8()}function AI(e){Je.operationsViewActive!==e&&ht({operationsViewActive:e})}function gc(e){jI(e),ht({activeTheme:e})}function wy(e){DI(e)}function RI(e){ht({channel:e.channel,version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,..._A({...Je,version:e.version})})}function NI(){ht({releaseNotesLoading:!0,releaseNotesError:null})}function LI(e){const t={...Je,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Je.selectedReleaseNoteKey&&yA(e.notes,Je.selectedReleaseNoteKey)?Je.selectedReleaseNoteKey:vA(e.notes)};ht({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,..._A(t)})}function MI(e){ht({releaseNotesLoading:!1,releaseNotesError:e})}function jI(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function OI(){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 DI(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",LT(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function xy(e){const t=gA(e,Je.activeTheaterId);ht({theaters:e,activeTheaterId:t})}function II(e){xy(e.theaters)}function ms(e){ht({operations:e,operationsHydrated:!0})}function BI(e){const t=new Set(e.map(i=>i.id)),n=Je.operations.filter(i=>!t.has(i.id));ht({operations:[...e,...n],operationsHydrated:!0})}function PI(e){const t=Je.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Je.operations];n[t]=e,ht({operations:n})}function jo(e){ht({groups:e})}function z0(e){nm(e),ht({activeTheaterId:e})}function Bi(e){Je.activeOperationId!==e&&ht({activeOperationId:e})}function $I(e,t){if(t==="idle"){uA(e);return}Je.operationStatus[e]!==t&&ht({operationStatus:{...Je.operationStatus,[e]:t}})}function uA(e){if(!(e in Je.operationStatus))return;const t={...Je.operationStatus};delete t[e],ht({operationStatus:t})}function zI(e){if(!e.operationId)return;const t=Je.operations.find(u=>u.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Je.theaters.find(u=>u.id===n)?.label??n??"Unknown",r=t.title,o=l8(e.kind);ak+=1,ht({operationNotifications:{...Je.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:ak}}})}function dA(){ht({addingTheater:!0,theaterError:null})}function hA(e){const t=[e,...Je.theaters.filter(n=>n.id!==e.id)];nm(e.id),ht({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function HI(){ht({addingTheater:!1,theaterError:null})}function Cy(e){ht({addingTheater:!1,theaterError:e})}function _c(e){const t=Je.operations.find(n=>n.id===e);t&&(nm(t.theaterId),ht({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:mA(Je.operationNotifications,e)}))}function FI(){Je.pendingOperationFocus!==null&&ht({pendingOperationFocus:null})}function UI(){ht({pendingSideBarAddTheater:!0})}function WI(){Je.pendingSideBarAddTheater&&ht({pendingSideBarAddTheater:!1})}function qI(e){ht({pendingSideBarTheaterLaunch:e})}function ok(){Je.pendingSideBarTheaterLaunch!==null&&ht({pendingSideBarTheaterLaunch:null})}function To(e){ht({keyboardFocusRequest:{operationId:e,requestId:(Je.keyboardFocusRequest?.requestId??0)+1}})}function GI(){ht({launchMenuRequest:{requestId:(Je.launchMenuRequest?.requestId??0)+1}})}function KI(){Je.launchMenuRequest!==null&&ht({launchMenuRequest:null})}function VI(){Je.keyboardShortcutsOpen||ht({keyboardShortcutsOpen:!0})}function YI(){Je.keyboardShortcutsOpen&&ht({keyboardShortcutsOpen:!1})}function XI(e,t,n){if(e.length===0)return null;const i=t?e.indexOf(t):-1,r=i===-1?n>0?0:e.length-1:(i+n+e.length)%e.length;return e[r]??null}function tm(e,t){if(t.length===0)return[...e].sort(ky);const n=new Map(t.map((i,r)=>[i,r]));return[...e].sort((i,r)=>{const o=n.get(i.id),u=n.get(r.id);return o!==void 0&&u!==void 0?o-u:o!==void 0?-1:u!==void 0?1:ky(i,r)})}function H0(e,t,n,i=[]){const r=tm(e,n),o=new Set(i),u=[...t].sort((p,f)=>p.order-f.order||p.createdAt-f.createdAt),h=new Map;for(const p of u)h.set(p.id,[]);h.set(null,[]);for(const p of r){const f=p.groupId??null;f!==null&&h.has(f)?h.get(f).push(p):h.get(null).push(p)}return[...u.filter(p=>!o.has(p.id)).flatMap(p=>h.get(p.id)??[]),...h.get(null)??[]]}function ZI(e,t,n,i,r){const o=new Set(r);return H0(e,t,n,i).filter(u=>!o.has(u.id)).map(u=>u.id)}const JI={awaiting:0,running:1,idle:2,dormant:3};function QI(e,t,n,i){const r=new Set(i),o=u=>JI[n[u.id]??"idle"];return[...tm(e,t)].sort((u,h)=>o(u)-o(h)).filter(u=>!r.has(u.id)).map(u=>u.id)}function ky(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function tf(){ht({operationSearchOpen:!1})}function fA(){ht({operationSearchOpen:!Je.operationSearchOpen})}function pA(){Je.releaseNotes.length===0||Je.whatsNewOpen||ht({whatsNewOpen:!0,selectedReleaseNoteKey:Je.selectedReleaseNoteKey??vA(Je.releaseNotes)})}function nf(){Je.whatsNewOpen&&(Je.automaticWhatsNewVersion&&p8(Je.automaticWhatsNewVersion),ht({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function lk(e){yA(Je.releaseNotes,e)&&ht({selectedReleaseNoteKey:e})}function ku(){h8(!0),Je.onboardingOpen&&ht({onboardingOpen:!1})}function mr(e){ht({codexReader:e,codexReaderExpanded:!1})}function $f(){Je.codexReader!==null&&ht({codexReaderExpanded:!0})}function e8(){ht({codexReaderExpanded:!1})}function P_(){ht({codexReader:null,codexReaderExpanded:!1})}function ck(){if(Je.bootstrapped)return;const e=Je.theaters.length===0&&!d8();ht({bootstrapped:!0,onboardingOpen:e?!0:Je.onboardingOpen})}function uk(e){const t=Je.theaters.filter(u=>u.id!==e),n=gA(t,Je.activeTheaterId===e?null:Je.activeTheaterId),i=o8(Je.operationNotifications,e),r=new Set(Je.operations.filter(u=>u.theaterId===e).map(u=>u.id)),o=Je.activeOperationId&&r.has(Je.activeOperationId)?null:Je.activeOperationId;nm(n),ht({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function t8(e){const t=mA(Je.operationNotifications,e);t!==Je.operationNotifications&&ht({operationNotifications:t})}function n8(e){const t={...Je.notificationPreferences,globalMute:e};U0(t),ht({notificationPreferences:t})}function i8(e){const t={...Je.notificationPreferences,dnd:e};U0(t),ht({notificationPreferences:t})}function s8(e){const t={...Je.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Je.notificationPreferences,mutedTheaterIds:t};U0(n),ht({notificationPreferences:n})}function r8(e){return wI(e)}function a8(){for(const e of by)e()}function mA(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function o8(e,t){let n=!1;const i={};for(const[r,o]of Object.entries(e)){if(o.theaterId===t){n=!0;continue}i[r]=o}return n?i:e}function gA(e,t){const n=new Set(e.map(r=>r.id)),i=c8();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function l8(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function _A(e){const t=e.releaseNotes.findIndex(i=>i.version!=="Unreleased"),n=t>=0?e.releaseNotes[t]:void 0;return!n||!e.version||n.version!==e.version||f8()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:F0(n.version,t)}}function vA(e){return e[0]?F0(e[0].version,0):null}function yA(e,t){return e.some((n,i)=>F0(n.version,i)===t)}function F0(e,t){return`${e}:${t}`}function c8(){if(typeof window>"u")return null;try{return window.localStorage.getItem(yy)}catch{return null}}function nm(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(yy,e):window.localStorage.removeItem(yy)}catch{}}function u8(){if(typeof window>"u")return ef;try{const e=window.localStorage.getItem(oA);if(!e)return ef;const t=JSON.parse(e);return m8(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:ef}catch{return ef}}function d8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(rA)==="1"}catch{return!1}}function h8(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(rA,"1")}catch{}}function f8(){if(Sy!==null)return Sy;if(typeof window>"u")return null;try{return window.localStorage.getItem(aA)}catch{return null}}function p8(e){if(Sy=e,!(typeof window>"u"))try{window.localStorage.setItem(aA,e)}catch{}}function U0(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oA,JSON.stringify({version:lA,preferences:e}))}catch{}}function m8(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==lA||!t.preferences||typeof t.preferences!="object")return!1;const n=t.preferences;return typeof n.globalMute=="boolean"&&typeof n.dnd=="boolean"&&!!n.mutedTheaterIds&&typeof n.mutedTheaterIds=="object"}function dk(e,t){return e!==null&&e===t?e:null}function g8(e,t,n,i){return H0(e.filter(r=>r.theaterId===n),t.filter(r=>r.theaterId===n),i)}function _8(e,t,n){if(t===null||n===null)return null;const i=e.find(r=>r.id===t)??null;return i!==null&&i.theaterId===n?i:null}function v8(e,t){return!(t instanceof Node&&e.contains(t))}function y8(e,t,n,i,r=12){const o=i-r-n-t,u=r-t;return Math.max(u,Math.min(e,o))}const b8=288,S8=520,Eu=12;function bA({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:r,renderKindIcon:o,onLaunchKind:u,onClose:h}){const p=v.useRef(null),f=v.useRef(null);return v.useEffect(()=>{const m=b=>{p.current?.contains(b.target)||h()},_=b=>{b.key==="Escape"&&h()};return document.addEventListener("mousedown",m),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",_)}},[h]),v.useEffect(()=>{f.current?.focus()},[]),c.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:p,style:x8(e,t,n),"data-canvas-blocker":!0,children:c.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:f,children:[c.jsxs("div",{className:"canvas-context-menu-head",children:[c.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:c.jsx(w8,{})}),c.jsx("span",{className:"canvas-context-menu-head-text",children:c.jsx("strong",{children:"Canvas controls"})})]}),c.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),i.length>0?i.map((m,_)=>c.jsxs("div",{children:[_>0?c.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,c.jsx("p",{className:"canvas-context-menu-plugin",children:m.title}),m.kinds.map(b=>{const S=b.disabled===!0||!r;return c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:S,title:b.disabledReason,onClick:()=>u(m.id,b),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(m.id,b)??c.jsx(C8,{})}),c.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?c.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${m.id}:${b.id}`)})]},m.id)):c.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function w8(){return c.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),c.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"}),c.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function x8(e,t,n){const i=t?Math.max(Eu,Math.min(e.x,t.width-b8-Eu)):e.x;if(n==="above")return{left:i,bottom:Math.max(Eu,e.y)};const r=t?Math.max(Eu,Math.min(e.y,t.height-S8-Eu)):e.y;return{left:i,top:r}}function C8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function SA(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const sf="directory-browser-sectors";function wA({open:e,onCancel:t,onConfirm:n}){const[i,r]=v.useState(null),[o,u]=v.useState(null),[h,p]=v.useState(null),[f,m]=v.useState(""),[_,b]=v.useState(""),[S,w]=v.useState(0),x=v.useRef(null),C=v.useRef(null),D=async(M,k)=>{u(M),p(null),m(""),w(0);try{const T=await rD(M,k);r(T)}catch(T){if(T instanceof DOMException&&T.name==="AbortError")return;p(T instanceof pn?T.message:String(T))}finally{u(null)}};v.useEffect(()=>{if(!e)return;const M=new AbortController;return D(null,M.signal),()=>M.abort()},[e]),v.useEffect(()=>{e&&x.current?.focus()},[e,i?.path]);const z=i?.entries??[],F=v.useMemo(()=>{const M=f.trim().toLowerCase();return M===""?z:z.filter(k=>k.name.toLowerCase().includes(M))},[z,f]),N=v.useMemo(()=>i?k8(i):[],[i]),I=i?hk(i.path):null,j=i?.roots??[],U=j.length>1,G=F.length===0?-1:Math.min(S,F.length-1);if(v.useEffect(()=>{if(G<0)return;C.current?.querySelector(`[data-index="${G}"]`)?.scrollIntoView({block:"nearest"})},[G,i?.path]),!e)return null;const W=M=>{M.accessible&&o===null&&D(M.path)},Z=()=>{i?.parentPath!=null&&o===null&&D(i.parentPath)},V=()=>{const M=_.trim();M!==""&&o===null&&D(M)},O=i?.path??null,A=G>=0?`${sf}-${G}`:void 0,B=M=>{switch(M.key){case"Escape":f!==""?m(""):t();return;case"ArrowDown":M.preventDefault(),w(k=>Math.min(k+1,Math.max(F.length-1,0)));return;case"ArrowUp":M.preventDefault(),w(k=>Math.max(k-1,0));return;case"Enter":{M.preventDefault();const k=F[G];k&&W(k);return}case"Backspace":f===""&&(M.preventDefault(),Z());return;default:return}};return aa.createPortal(c.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[c.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),c.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:B,children:[c.jsxs("header",{className:"directory-browser-header",children:[c.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:c.jsx(A8,{})}),c.jsxs("div",{className:"directory-browser-heading",children:[c.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),c.jsx("h2",{children:"Add Theater"})]}),c.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),U?c.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[c.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),c.jsx("div",{className:"directory-browser-root-chips",children:j.map(M=>{const k=I!=null&&hk(M)===I;return c.jsx("button",{type:"button",className:`directory-browser-root-chip ${k?"is-active":""}`,"aria-current":k?"location":void 0,disabled:o!==null,title:M,onClick:()=>{o===null&&D(M)},onKeyDown:T=>T.stopPropagation(),children:T8(M)},M)})})]}):null,c.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:N.map((M,k)=>{const T=k===N.length-1;return c.jsxs("span",{className:"directory-browser-course-seg",children:[k>0?c.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,c.jsx("button",{type:"button",className:`directory-browser-crumb ${T?"is-current":""}`,"aria-current":T?"location":void 0,disabled:T||o!==null,title:M.path,onClick:()=>{D(M.path)},children:M.label})]},M.path)})}),c.jsxs("div",{className:"directory-browser-toolbar",children:[c.jsxs("div",{className:"directory-browser-filter",children:[c.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:c.jsx(N8,{})}),c.jsx("input",{ref:x,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":sf,value:f,spellCheck:!1,autoComplete:"off",onChange:M=>{m(M.target.value),w(0)}})]}),c.jsxs("button",{type:"button",className:"directory-browser-up",disabled:i?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:Z,children:[c.jsx(L8,{}),c.jsx("span",{children:"Up"})]})]}),c.jsxs("div",{className:"directory-browser-jump",children:[c.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:_,spellCheck:!1,autoComplete:"off",onChange:M=>b(M.target.value),onKeyDown:M=>{M.stopPropagation(),M.key==="Enter"&&(M.preventDefault(),V())}}),c.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:_.trim()===""||o!==null,onClick:V,onKeyDown:M=>M.stopPropagation(),children:"Go"})]}),h?c.jsx("p",{className:"directory-browser-error",role:"alert",children:h}):null,c.jsx("div",{className:"directory-browser-list",id:sf,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":A,ref:C,children:o!==null?c.jsxs("p",{className:"directory-browser-state is-live",children:[c.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):F.length===0?c.jsx("p",{className:"directory-browser-state",children:f!==""?"No folders match the filter.":"No folders available."}):F.map((M,k)=>c.jsxs("div",{id:`${sf}-${k}`,"data-index":k,role:"option","aria-selected":k===G,"aria-disabled":!M.accessible,className:`directory-browser-sector ${k===G?"is-active":""} ${M.accessible?"":"is-locked"}`,title:M.path,onClick:()=>{w(k),W(M)},children:[c.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:c.jsx(R8,{})}),c.jsx("span",{className:"directory-browser-sector-name",children:M.name}),M.accessible?c.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):c.jsxs("span",{className:"directory-browser-sector-lock",children:[c.jsx(M8,{})," Locked"]})]},M.path))}),i?.truncated?c.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,c.jsxs("footer",{className:"directory-browser-actions",children:[c.jsxs("div",{className:"directory-browser-target",children:[c.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),c.jsx("span",{className:"directory-browser-target-path",title:O??"",children:O??"Loading…"})]}),c.jsxs("div",{className:"directory-browser-buttons",children:[c.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),c.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:O===null||o!==null,onClick:()=>O&&n(O),children:"Add Theater"})]})]})]})]}),document.body)}function k8(e){if(E8(e)==="/"){const u=[{label:"/",path:"/"}];let h="";for(const p of e.path.split("/").filter(Boolean))h+=`/${p}`,u.push({label:p,path:h});return u}const n=/^([A-Za-z]:)\\?/.exec(e.path),i=n?`${n[1]}\\`:e.roots[0]??"C:\\",r=[{label:i,path:i}];let o=i.replace(/\\$/,"");for(const u of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${u}`,r.push({label:u,path:o});return r}function E8(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function hk(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function T8(e){return e.replace(/[\\/]+$/,"")||e}function A8(){return c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),c.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 R8(){return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.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 N8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function L8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 M8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.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"})]})}function ir(){return v.useSyncExternalStore(cA,Xo,Xo)}const W0=[{key:"crimson",label:"Crimson",color:"var(--id-crimson)"},{key:"amber",label:"Amber",color:"var(--id-amber)"},{key:"moss",label:"Moss",color:"var(--id-moss)"},{key:"teal",label:"Teal",color:"var(--id-teal)"},{key:"cerulean",label:"Cerulean",color:"var(--id-cerulean)"},{key:"indigo",label:"Indigo",color:"var(--id-indigo)"},{key:"plum",label:"Plum",color:"var(--id-plum)"},{key:"rose",label:"Rose",color:"var(--id-rose)"}],j8={red:"crimson",orange:"amber",yellow:"amber",lime:"moss",green:"moss",emerald:"teal",cyan:"teal",sky:"cerulean",blue:"cerulean",violet:"plum",purple:"plum",magenta:"rose"};function xA(e){return typeof e!="string"||e.length===0?null:W0.some(t=>t.key===e)?e:j8[e]??null}function Bs(e){const t=xA(e);return t?W0.find(n=>n.key===t)?.color??null:null}function ud(e){return typeof e.accent=="string"?e.accent:null}const fk=8,O8=268;function q0({accentKey:e,includeNone:t,onSelect:n}){const i=xA(e);return c.jsxs(c.Fragment,{children:[t?c.jsxs("button",{type:"button",className:"accent-tone-row accent-tone-row--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>n(null),children:[c.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:"None"})]}):null,W0.map(r=>c.jsxs("button",{type:"button",className:"accent-tone-row",role:"menuitem","aria-label":r.label,"aria-pressed":i===r.key,onClick:()=>n(r.key),children:[c.jsx("span",{className:"accent-tone-flag",style:{background:r.color},"aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:r.label})]},r.key))]})}function D8({anchor:e,accentKey:t,onSelect:n,onClose:i}){const[r,o]=v.useState(void 0);v.useLayoutEffect(()=>{const h=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+fk,f=p+O8>window.innerHeight;o(f?{position:"fixed",left:h,top:"auto",bottom:Math.round(window.innerHeight-e.top+fk)}:{position:"fixed",left:h,top:Math.round(p)})},[e]),v.useEffect(()=>{const h=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",h),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",h),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const u=h=>{n(h),i()};return aa.createPortal(c.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:r?c.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:r,onPointerDown:h=>h.stopPropagation(),children:c.jsx(q0,{accentKey:t,includeNone:!0,onSelect:u})}):null}),document.body)}const pk=8,I8=320;function mk(e){const{anchor:t,onClose:n}=e,[i,r]=v.useState(void 0);return v.useLayoutEffect(()=>{const o=Math.max(8,Math.min(t.left,window.innerWidth-208)),u=t.bottom+pk,h=u+I8>window.innerHeight;r(h?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+pk)}:{position:"fixed",left:o,top:Math.round(u)})},[t]),v.useEffect(()=>{const o=u=>{u.key==="Escape"&&(u.preventDefault(),n())};return window.addEventListener("keydown",o),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("keydown",o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[n]),aa.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:n,children:i?c.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:i,onPointerDown:o=>o.stopPropagation(),children:e.kind==="chip"?c.jsx(B8,{...e}):c.jsx(P8,{...e})}):null}),document.body)}function B8({operation:e,groups:t,accentKey:n,actions:i,onClose:r}){const[o,u]=v.useState(!1),[h,p]=v.useState(`Group ${t.length+1}`),f=v.useRef(!1),m=v.useRef(null);v.useEffect(()=>{o&&m.current?.select()},[o]);const _=()=>{const b=h.trim();b&&(i.onCreateGroup(b),r())};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(b=>{const S=Bs(b.color),w=e.groupId===b.id;return c.jsxs("button",{type:"button",className:`group-context-menu-item${w?" is-selected":""}`,role:"menuitemradio","aria-checked":w,onClick:()=>{i.onSetGroupId(w?null:b.id),r()},children:[c.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),c.jsx("span",{className:"group-context-menu-item__name",children:b.name}),w?c.jsx($8,{}):null]},b.id)}),o?c.jsx("input",{ref:m,className:"group-context-menu-new-input",type:"text",value:h,onChange:b=>p(b.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:b=>{b.key==="Enter"&&!f.current&&(b.preventDefault(),_()),b.key==="Escape"&&(b.preventDefault(),u(!1))},onBlur:()=>u(!1),"aria-label":"New group name",placeholder:"Group name"}):c.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>u(!0),children:c.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),c.jsx(q0,{accentKey:n,includeNone:!0,onSelect:b=>{i.onSetAccent(b),r()}})]})}function P8({group:e,actions:t,onClose:n}){const[i,r]=v.useState(e.name),[o,u]=v.useState(!1),h=v.useRef(!1),p=()=>{const f=i.trim();if(!f||f===e.name){n();return}t.onRename(f),n()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),c.jsx(q0,{accentKey:e.color,includeNone:!1,onSelect:f=>{f&&t.onSetColor(f),n()}}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),c.jsx("input",{className:"group-context-menu-new-input",type:"text",value:i,onChange:f=>r(f.target.value),onCompositionStart:()=>{h.current=!0},onCompositionEnd:()=>{h.current=!1},onKeyDown:f=>{f.key==="Enter"&&!h.current&&(f.preventDefault(),p()),f.key==="Escape"&&(f.preventDefault(),n())},onBlur:p,"aria-label":"Group name"}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${o?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!o){u(!0);return}t.onUngroupAll(),n()},"aria-label":o?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:o?"Confirm ungroup all?":"Ungroup all"})]})}function $8(){return c.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:c.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const z8=[{title:"Console",entries:[{combos:[["Mod","K"]],description:"Search Operations across Theaters"},{combos:[["Mod","B"]],description:"Toggle the left sidebar"},{combos:[["Mod","Alt","B"]],description:"Toggle the right activity rail"},{combos:[["Esc"]],description:"Close the open overlay or menu"}]},{title:"Operations",entries:[{combos:[["Esc"]],description:"Close the carrier job stream"},{combos:[["Shift","Enter"]],description:"Insert a newline in the terminal instead of submitting"},{combos:[["Enter"],["Esc"]],description:"Confirm or cancel a session rename"},{combos:[["↑"],["↓"]],description:"Move between Theater, Theme, and launch menu items"}]},{title:"Map",entries:[{combos:[["Alt","←"],["Alt","→"]],description:"Focus the previous / next Operation"},{combos:[["Alt","F"]],description:"Toggle Formation view"},{combos:[["Alt","S"]],description:"Sort the sidebar by operation status"},{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"}]}],Xu="data-keyboard-shortcuts-open",H8='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function CA(){return document.body.getAttribute(Xu)==="true"}function F8(){return!CA()}function kA({onClose:e}){const t=v.useRef(null);v.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(Xu);return document.body.setAttribute(Xu,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute(Xu):document.body.setAttribute(Xu,o),r&&(r.inert=!1)}},[e]);const n=i=>{if(i.key==="Escape"){i.preventDefault(),e();return}if(i.key!=="Tab")return;const r=[...t.current?.querySelectorAll(H8)??[]];if(r.length===0){i.preventDefault(),t.current?.focus();return}const o=r[0],u=r[r.length-1],h=document.activeElement;(h===t.current||!t.current?.contains(h)||(i.shiftKey?h===o:h===u))&&(i.preventDefault(),(i.shiftKey?u:o)?.focus())};return aa.createPortal(c.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:c.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:n,onMouseDown:i=>i.stopPropagation(),children:[c.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[c.jsx("strong",{children:"Keyboard Shortcuts"}),c.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),z8.map(i=>c.jsxs("section",{className:"keyboard-shortcuts-group",children:[c.jsx("h3",{children:i.title}),c.jsx("dl",{children:i.entries.map(r=>c.jsxs("div",{children:[c.jsx("dt",{children:r.combos.map((o,u)=>c.jsxs("span",{children:[u>0?" or ":null,o.map(h=>c.jsx("kbd",{children:h==="Mod"?"⌘/Ctrl":h},h))]},o.join("+")))}),c.jsx("dd",{children:r.description})]},`${i.title}:${r.description}`))})]},i.title))]})}),document.body)}const U8=1400,W8="https://github.com/sbluemin/fleet-harness",q8="https://github.com/sbluemin/fleet-harness/stargazers",G8="https://api.github.com/repos/sbluemin/fleet-harness",G0="fleet-console.github-stars",K8=360*60*1e3,gk='[role="menuitem"]:not([disabled])';function V8(){const e=ir();return c.jsxs("div",{className:"side-bar-brand-foot",children:[c.jsx(X8,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),c.jsx(Z8,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function Y8({className:e="brand-foot-home"}){return c.jsxs(_d,{className:e,to:"/operations","aria-label":"Operations",children:[c.jsx(l7,{}),c.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function X8({latestVersion:e,updateAvailable:t}){const n=v.useRef(null),i=v.useRef(null),r=v.useRef(null),[o,u]=v.useState(!1),h=Tc();EA(n,i,r,o,u);const p=f=>{u(!1),h(f),window.requestAnimationFrame(()=>{const m=document.querySelector("main h2, h2");m?.focus?.(),m&&document.activeElement!==m&&(m.setAttribute("tabindex","-1"),m.focus())})};return c.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-system-menu",children:[c.jsxs("button",{ref:i,type:"button",className:"brand-foot-system-trigger",onClick:()=>u(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"System Menu",title:"System Menu",children:[c.jsx(_k,{}),c.jsx("span",{children:"System Menu"})]}),o?c.jsxs("div",{ref:r,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>p("/settings"),children:[c.jsx(_k,{}),c.jsx("span",{children:"Settings"})]}),t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(J8,{latestVersion:e})]}):null]}):null]})}function Z8({releaseDisabled:e,version:t}){const n=v.useRef(null),i=v.useRef(null),r=v.useRef(null),[o,u]=v.useState(!1),[h,p]=v.useState(!1);return EA(n,i,r,o,u),c.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-help-menu",children:[c.jsx("button",{ref:i,type:"button",className:"brand-foot-help-trigger",onClick:()=>u(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"Help",title:"Help",children:c.jsx(c7,{})}),o?c.jsxs("div",{ref:r,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[c.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{u(!1),pA()},children:[c.jsx(u7,{}),c.jsx("span",{children:"What's New"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),p(!0)},children:[c.jsx(d7,{}),c.jsx("span",{children:"Keyboard Shortcuts"})]}),c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(Q8,{menuItem:!0,version:t})]}):null,h?c.jsx(kA,{onClose:()=>{p(!1),i.current?.focus()}}):null]})}function EA(e,t,n,i,r){v.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(gk)?.focus()}),u=p=>{p.target instanceof Node&&e.current?.contains(p.target)||r(!1)},h=p=>{if(p.key==="Escape"){r(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(p.key))return;const f=[...n.current?.querySelectorAll(gk)??[]];if(f.length===0)return;p.preventDefault();const m=f.findIndex(b=>b===document.activeElement),_=p.key==="Home"||p.key==="ArrowDown"&&m===f.length-1?0:p.key==="End"||p.key==="ArrowUp"&&m<=0?f.length-1:p.key==="ArrowDown"?m+1:m-1;f[_]?.focus()};return window.addEventListener("pointerdown",u,!0),window.addEventListener("keydown",h,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("keydown",h,!0)}},[n,i,e,r,t])}function J8({latestVersion:e}){const[t,n]=v.useState("idle"),[i,r]=v.useState(null),o=v.useRef(null),u=e7(t,i,e);v.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const h=async()=>{if(!u.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),n("applying"),r(null);try{if((await iD()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},U8)}catch(p){const f=p instanceof pn?p.message:"network_error";r(f),n(n7(f)?"blocked":"error")}}};return c.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${u.tone}`,onClick:h,disabled:u.disabled,title:u.title,"aria-live":"polite",children:u.label})}function Q8({menuItem:e=!1,version:t}){const n=i7(),i=n.count!==null;return c.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[c.jsx("a",{className:"brand-foot-github-link",href:W8,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:c.jsx(h7,{})}),c.jsxs("a",{className:"brand-foot-github-stars",href:q8,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":i?`GitHub stars ${n.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[c.jsx(f7,{}),i?c.jsx("span",{className:"brand-foot-github-stars-count",children:o7(n.count)}):null]}),c.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function e7(e,t,n){const i=n?`Latest version ${n}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?t7(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:i,tone:"warn",disabled:!1}}function t7(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",tone:"blocked",disabled:!0}:e==="managed_runtime_update_requires_relaunch"?{label:"Update and Restart",title:"This managed Console installation updates through Fleet Console Desktop. Use Desktop Update and Restart.",tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:"Busy",title:"Another update is already in progress.",tone:"blocked",disabled:!0}:e==="update_not_available"?{label:"Current",title:"The server re-check found no update to apply.",tone:"blocked",disabled:!0}:{label:"Blocked",title:"The console is not ready to start an update. Try again shortly.",tone:"error",disabled:!1}}function n7(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function i7(){const[e,t]=v.useState(()=>{const n=s7();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return v.useEffect(()=>{if(r7())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(G8,{headers:{Accept:"application/vnd.github+json"}}).then(i=>i.ok?i.json():Promise.reject(new Error(`status ${i.status}`))).then(i=>{if(n)return;const r=typeof i.stargazers_count=="number"?i.stargazers_count:null;if(r===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}a7(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function s7(){try{const e=window.localStorage.getItem(G0);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function r7(){try{const e=window.localStorage.getItem(G0);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<K8}catch{return!1}}function a7(e){try{window.localStorage.setItem(G0,JSON.stringify({count:e,at:Date.now()}))}catch{}}function o7(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function l7(){return c.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),c.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),c.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),c.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),c.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),c.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function _k(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function c7(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.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"}),c.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function u7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function d7(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function h7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 f7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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"})})}function p7(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const u=o.groupId??"__ungrouped__",h=n.querySelector(`[data-drop-zone-group-id="${u}"]`);if(!h)continue;const p=h.getBoundingClientRect();if(e<p.top||e>p.bottom)continue;const f=h.querySelector(`[data-group-section-id="${u}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const m=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const _ of m){const b=_.dataset.sideBarChipId;if(!b||b===i)continue;const S=_.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const r=t[t.length-1];return{groupId:r?.groupId??null,index:r?.entryIds.length??0}}function m7(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-drop-zone-group-id]"));for(const o of r){const u=o.dataset.dropZoneGroupId;if(!u||u==="__ungrouped__"||u===i)continue;const h=t.indexOf(u);if(h===-1)continue;const p=o.getBoundingClientRect();if(e<=p.top+p.height/2)return h}return t.length}function g7(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-theater-id]"));for(const o of r){const u=o.dataset.theaterId;if(!u||u===i)continue;const h=t.indexOf(u);if(h===-1)continue;const p=o.getBoundingClientRect();if(e<=p.top+p.height/2)return h}return t.length}function _7(e,t,n,i){const r=e.filter(m=>m!==t),o=new Set(i),u=r.filter(m=>o.has(m)),h=Math.max(0,Math.min(n,u.length));if(u.length===0)return[...r,t];if(h<u.length){const m=r.indexOf(u[h]),_=[...r];return _.splice(m,0,t),_}const p=r.indexOf(u[u.length-1]),f=[...r];return f.splice(p+1,0,t),f}function v7(e,t,n,i){const r=new Set(i),o=e.filter(_=>r.has(_)),u=o.indexOf(t),h=o.filter(_=>_!==t),p=n>u?n-1:n,f=Math.max(0,Math.min(p,h.length));h.splice(f,0,t);let m=0;return e.map(_=>r.has(_)?h[m++]??_:_)}function y7(e,t,n){if(n.length!==t.length)return[...e];const i=new Set(t);let r=0;return e.map(o=>i.has(o)?n[r++]??o:o)}function b7(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(h=>h!==t),o=n>i?n-1:n,u=Math.max(0,Math.min(o,r.length));return r.splice(u,0,t),r}function S7(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(h=>h!==t),o=n>i?n-1:n,u=Math.max(0,Math.min(o,r.length));return r.splice(u,0,t),r}function w7(e,t,n){if(e.indexOf(t)===-1)return[...e];const r=e.filter(u=>u!==t),o=Math.max(0,Math.min(n,r.length));return r.splice(o,0,t),r}function im(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function x7(e){const t=im(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function K0(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,r=v.useRef(null),o=v.useRef(!1),u=v.useRef(!1),[h,p]=v.useState(!1),[f,m]=v.useState("");v.useEffect(()=>{h&&(r.current?.focus(),r.current?.select())},[h]);const _=()=>{i?.(),u.current=!1,m(t),p(!0)},b=()=>{u.current=!0,p(!1),m("")},S=()=>{if(!o.current){o.current=!0;try{n(f)}finally{o.current=!1,u.current=!0,p(!1)}}};return{renaming:h,draftTitle:f,inputRef:r,begin:_,cancel:b,commit:S,setDraftTitle:m,handleKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),S();return}C.key==="Escape"&&(C.preventDefault(),b())},handleBlur:()=>{if(u.current){u.current=!1;return}S()}}}function gp({entry:e,index:t,isCloseArmed:n,accentValue:i,groupMark:r=null,statusLanded:o=!1,reorderEnabled:u=!0,dragging:h,dragOffsetY:p,dropTarget:f,preview:m=!1,onArmClose:_,onDisarmClose:b,onClose:S,onMinimize:w,onFocus:x,onKeyboardMove:C,onPointerDragStart:D,onOpenAccent:z,onRename:F}){const N=v.useRef(!1),{operation:I,active:j,minimized:U,notificationCount:G,status:W}=e,Z=C7(I),V=K0({currentTitle:Z,onCommit:$=>F(I.id,$),onBegin:b}),O=["side-bar-chip",j?"side-bar-chip--active":"",U?"side-bar-chip--minimized":"",o?"side-bar-chip--status-landed":"",h?"side-bar-chip--dragging":"",f?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),A=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),B={"--i":t,...i?{"--user-accent":i}:{},...h?{"--drag-dy":`${Math.round(p)}px`}:{}},M=()=>{if(b(),N.current){N.current=!1;return}x(I.id)},k=$=>{$.stopPropagation()},T=$=>{if($.stopPropagation(),!n){_(I.id);return}b(),S(I.id)},R=$=>{$.preventDefault(),b(),z(I.id,$.currentTarget.getBoundingClientRect())};return c.jsxs("li",{"data-side-bar-chip-id":I.id,"data-reorder-enabled":u?"true":"false",className:O,role:"button",tabIndex:0,"aria-label":j?`${Z} (focused)`:`Focus operation ${Z}`,"aria-current":j?"true":void 0,title:m?"Click to open in its Theater":j?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:B,onClick:M,onContextMenu:m?void 0:R,onFocus:()=>{n||b()},onPointerDown:u?$=>D($,I.id):void 0,onPointerUp:()=>{h&&(N.current=!0)},onKeyDown:$=>{if($.target===$.currentTarget){if(!m&&u&&$.altKey&&$.shiftKey&&($.key==="ArrowUp"||$.key==="ArrowDown")){$.preventDefault(),C(I.id,$.key==="ArrowUp"?-1:1);return}($.key==="Enter"||$.key===" ")&&($.preventDefault(),M())}},children:[c.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:c.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??c.jsx(A7,{})})}),V.renaming?c.jsx("input",{className:"side-bar-chip-rename-input",ref:V.inputRef,value:V.draftTitle,"aria-label":`Rename operation ${Z}`,onChange:$=>V.setDraftTitle($.target.value),onKeyDown:V.handleKeyDown,onBlur:V.handleBlur,onPointerDown:$=>$.stopPropagation(),onClick:$=>$.stopPropagation()}):c.jsx("span",{className:"side-bar-chip-name",onDoubleClick:m?void 0:V.begin,children:Z}),G>0?c.jsx("span",{className:"side-bar-chip-count",children:G}):null,r?c.jsx("span",{className:"side-bar-chip-group-mark",title:r.name,"aria-label":`Group ${r.name}`,style:{"--group-mark":r.color}}):null,c.jsx("span",{className:`side-bar-chip-status ${k7(W)}`,role:"img","aria-label":vk(W),title:vk(W)}),!m&&!U?c.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:k,onClick:$=>{$.stopPropagation(),b(),w(I.id)},"aria-label":`Minimize operation ${Z}`,title:"Minimize operation",children:c.jsx(T7,{})}):null,m?null:c.jsx("button",{type:"button",className:A,onPointerDown:k,onClick:T,"aria-label":n?`Confirm close operation ${Z}`:`Close operation ${Z}`,title:n?"Confirm close":"Close operation",children:n?"Close?":c.jsx(E7,{})})]})}function C7(e){return e.title}function k7(e){const t=im(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 vk(e){return x7(e)}function E7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 T7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function A7(){return c.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function TA({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:u,onContextMenu:h,onPointerDragStart:p}){const f=v.useRef(!1),m=Bs(e.color),_=["side-bar-group-header",n?"side-bar-group-header--collapsed":"",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={...m?{"--grp-color":m}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=C=>{C.preventDefault(),h(e.id,C.currentTarget.getBoundingClientRect())},w=C=>{C.target instanceof Element&&C.target.closest("button")||p(C,e.id)},x=()=>{i&&(f.current=!0)};return c.jsxs("div",{className:_,style:b,onContextMenu:S,onPointerDown:w,onPointerUp:x,role:"group","aria-label":e.name,children:[c.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>u(e.id),"aria-expanded":!n,"aria-label":n?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:n?"Expand":"Collapse",children:c.jsx(R7,{collapsed:n})}),c.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-group-header__name",children:e.name}),c.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function R7({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:c.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const AA="fleet-console.operations.side-width",RA="fleet-console.operations.side-collapsed",NA="fleet-console.operations.theater-collapsed",sm=280,yk=sm,Ey=new Set,Ty=new Set,Ay=new Set;let Uo={width:I7(),collapsed:B7()},zf=P7(),_p=!1;function LA(){return v.useSyncExternalStore($7,vp,vp)}function N7(){return v.useSyncExternalStore(H7,bk,bk)}function L7(){return v.useSyncExternalStore(D7,Ny,Ny)}function M7(e){const t=Math.max(sm,Math.min(MA(),e));if(Uo.width!==t){Uo={...Uo,width:t};try{typeof window<"u"&&localStorage.setItem(AA,String(t))}catch{}jA()}}function sc(e){if(Uo.collapsed!==e){Uo={...Uo,collapsed:e};try{typeof window<"u"&&localStorage.setItem(RA,e?"1":"0")}catch{}jA()}}function j7(e,t){const n=new Set(zf);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==zf.join("\0")){zf=i;try{typeof window<"u"&&localStorage.setItem(NA,JSON.stringify(i))}catch{}z7()}}function O7(e){if(_p!==e){_p=e;for(const t of Ay)t()}}function Ry(){O7(!_p)}function Ny(){return _p}function D7(e){return Ay.add(e),()=>Ay.delete(e)}function MA(){return typeof window<"u"?Math.max(sm,window.innerWidth-480):800}function I7(){try{if(typeof window>"u")return yk;const e=localStorage.getItem(AA);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(sm,Math.min(MA(),t))}}catch{}return yk}function B7(){try{return typeof window<"u"&&localStorage.getItem(RA)==="1"}catch{return!1}}function P7(){try{if(typeof window>"u")return[];const e=localStorage.getItem(NA),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function jA(){for(const e of Ey)e()}function vp(){return Uo}function $7(e){return Ey.add(e),()=>Ey.delete(e)}function z7(){for(const e of Ty)e()}function bk(){return zf}function H7(e){return Ty.add(e),()=>Ty.delete(e)}function OA(e,t){const n=e.find(r=>r.id===t.pluginId)?.kinds.filter(r=>r.type===t.type)??[],i=t.payload.launchKindId;if(typeof i=="string"){const r=n.find(o=>o.id===i);if(r)return r}return n.length===1?n[0]:null}const F7=1500,U7=6,Sk=34,wk=18,W7=500,q7=[{status:"awaiting",label:"AWAITING INPUT"},{status:"running",label:"RUNNING"},{status:"idle",label:"IDLE"},{status:"dormant",label:"DORMANT"}];function G7({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:u,catalog:h,canLaunch:p,addingTheater:f,theaterError:m,renderKindIcon:_,onLaunchKind:b,onClose:S,onMinimize:w,onFocus:x,onSetAccent:C,onRename:D,onSetGroupId:z,onCreateGroup:F,onSetGroupColor:N,onRenameGroup:I,onReorderGroups:j,onReorderTheaters:U,onUngroupAll:G,onSelectTheater:W,onAddTheater:Z,onCancelAddTheater:V,onForgetTheater:O}){const A=v.useRef(null),B=v.useRef(null),M=LA(),{width:k,collapsed:T}=M,R=L7(),$=v.useRef(T),K=N0(),L=v.useRef(null),q=v.useRef(new Set),H=v.useRef(new Map),[ne,oe]=v.useState(null),[Se,xe]=v.useState(new Set),[fe,De]=v.useState(null),rt=v.useRef(null),Ie=v.useRef([]),Ce=v.useRef([]),Me=v.useRef([]),je=v.useRef([]),ze=v.useRef([]),bt=v.useRef(z),pt=v.useRef(j),vt=v.useRef(U),[lt,de]=v.useState(null),[ut,tt]=v.useState(null),[Vt,st]=v.useState(!1),[zt,Ft]=v.useState(!1),we=XD(),Oe=N7(),{operationStatus:cn,pendingSideBarAddTheater:ti,pendingSideBarTheaterLaunch:ni,launchMenuRequest:We}=ir();v.useLayoutEffect(()=>{!$.current&&T&&SA(A.current,".command-band-sidebar-toggle"),$.current=T},[T]);const gt=n.filter(Q=>Q.theaterId===t),xt=i.filter(Q=>Q.theaterId===t),Tt=new Set(r),$t=new Set(we),Cn=tm(gt,K.operationOrder).map(Q=>{const Ee=OA(h,Q),Qe=Ee?_(Q.pluginId,Ee):null;return{operation:Q,active:o===Q.id,minimized:Tt.has(Q.id),notificationCount:u[Q.id]?1:0,status:cn[Q.id],icon:Qe}}),ee=DA(Cn,xt,K.operationOrder),le=IA(Cn),Be=new Map(Cn.map((Q,Ee)=>[Q.operation.id,Ee])),Le=new Map(xt.map(Q=>{const Ee=Bs(Q.color);return[Q.id,Ee?{name:Q.name,color:Ee}:null]})),Fe=ee.some(Q=>Q.group!==null),it=ee.flatMap(Q=>Q.groupId?[Q.groupId]:[]),X=ee.flatMap(Q=>$t.has(Q.groupId??"")?[]:Q.entries),ue=Cn.map(Q=>Q.operation.id),be=n.map(Q=>`${Q.id}:${Ly(cn[Q.id])}`).join("\0"),Ge=v.useCallback(()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)},[]),At=v.useCallback(()=>{Ge(),oe(null)},[Ge]),jt=v.useCallback(Q=>{Ge(),oe(Q),L.current=window.setTimeout(()=>{L.current=null,oe(null)},F7)},[Ge]);v.useEffect(()=>Ge,[Ge]),v.useEffect(()=>{ne!==null&&(Cn.some(Q=>Q.operation.id===ne)||At())},[ne,Cn,At]),v.useEffect(()=>{const Q=new Map(n.map(Ne=>[Ne.id,Ly(cn[Ne.id])])),Ee=H.current;if(H.current=Q,!R){for(const Ne of q.current)window.clearTimeout(Ne);q.current.clear(),xe(Ne=>Ne.size===0?Ne:new Set);return}const Qe=n.filter(Ne=>{const dt=Ee.get(Ne.id);return dt!==void 0&&dt!==Q.get(Ne.id)}).map(Ne=>Ne.id);if(Qe.length===0)return;xe(Ne=>{const dt=new Set(Ne);for(const pe of Qe)dt.add(pe);return dt});const Ze=window.setTimeout(()=>{q.current.delete(Ze),xe(Ne=>{const dt=new Set(Ne);for(const pe of Qe)dt.delete(pe);return dt.size===Ne.size?Ne:dt})},W7);q.current.add(Ze)},[R,be]),v.useEffect(()=>()=>{for(const Q of q.current)window.clearTimeout(Q);q.current.clear()},[]),v.useEffect(()=>{if(!We)return;KI();const Ee=A.current?.querySelector('.side-bar-theater-section--active .side-bar-theater-row-btn[aria-label^="New Operation in"]')?.getBoundingClientRect();de(null),tt({anchor:Ee?{x:Ee.right+8,y:Ee.top}:{x:16,y:64},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},[We]);const Re=lt?.kind==="chip"?Cn.find(Q=>Q.operation.id===lt.operationId)?.operation??null:null,Ae=lt?.kind==="group"?i.find(Q=>Q.id===lt.groupId)??null:null,et=lt?.kind==="theater"?e.find(Q=>Q.id===lt.theaterId)??null:null,fn=(Q,Ee)=>{if(R)return;const Qe=X.findIndex(pe=>pe.operation.id===Q);if(Qe===-1)return;const Ze=Math.max(0,Math.min(X.length-1,Qe+Ee));if(Ze===Qe)return;const Ne=X.map(pe=>pe.operation.id),dt=w7(Ne,Q,Ze);I_(y7(ue,Ne,dt))},Rt=ee.map(Q=>({groupId:Q.groupId,entryIds:Q.entries.map(Ee=>Ee.operation.id)}));v.useEffect(()=>{Ie.current=Cn,Ce.current=ue,Me.current=Rt,je.current=it,ze.current=e.map(Q=>Q.id),bt.current=z,pt.current=j,vt.current=U});const Qt=Q=>{rt.current=Q,De(Q)};v.useEffect(()=>{R&&rt.current?.kind==="chip"&&Qt(null)},[R]);const Li=fe?.pointerId??null;v.useEffect(()=>{if(Li===null)return;const Q=Ze=>{if(Ze.pointerId!==Li)return;const Ne=rt.current;if(!Ne)return;if(Ze.buttons===0){Qt(null);return}const dt=Math.hypot(Ze.clientX-Ne.startX,Ze.clientY-Ne.startY);if(!Ne.dragging&&dt<U7)return;if(Ne.dragging&&Ze.preventDefault(),J7(Ze.clientY,B.current),Ne.kind==="chip"){const Pe=p7(Ze.clientY,Me.current,B.current,Ne.sourceId);Qt({...Ne,currentY:Ze.clientY,dragging:!0,dropIndex:Pe.index,dropGroupId:Pe.groupId});return}if(Ne.kind==="theater"){const Pe=g7(Ze.clientY,ze.current,B.current,Ne.sourceTheaterId);Qt({...Ne,currentY:Ze.clientY,dragging:!0,dropIndex:Pe});return}const pe=m7(Ze.clientY,je.current,B.current,Ne.sourceGroupId);Qt({...Ne,currentY:Ze.clientY,dragging:!0,dropIndex:pe})},Ee=Ze=>{if(Ze.pointerId!==Li)return;const Ne=rt.current;if(Qt(null),!Ne?.dragging)return;if(Ne.kind==="theater"){const un=S7(ze.current,Ne.sourceTheaterId,Ne.dropIndex);if(un.join("\0")===ze.current.join("\0"))return;vt.current(un);return}if(Ne.kind==="group"){const un=b7(je.current,Ne.sourceGroupId,Ne.dropIndex);if(un.join("\0")===je.current.join("\0"))return;pt.current(un);return}const{sourceId:dt,sourceGroupId:pe,dropIndex:Pe,dropGroupId:qe}=Ne,Ct=Me.current,Yt=Ce.current;if(qe!==pe){const qs=Ct.find(is=>is.groupId===qe)?.entryIds??[];I_(_7(Yt,dt,Pe,qs)),bt.current(dt,qe);return}const Ht=Ct.find(un=>un.groupId===pe)?.entryIds??[],nn=Ht.indexOf(dt);if(nn===-1||Pe===nn)return;const Bt=v7(Yt,dt,Pe,Ht);I_(Bt)},Qe=Ze=>{Ze.pointerId===Li&&Qt(null)};return window.addEventListener("pointermove",Q),window.addEventListener("pointerup",Ee),window.addEventListener("pointercancel",Qe),()=>{window.removeEventListener("pointermove",Q),window.removeEventListener("pointerup",Ee),window.removeEventListener("pointercancel",Qe)}},[Li]);const ys=(Q,Ee)=>{if(R||Q.button!==0||Q.target instanceof Element&&Q.target.closest("button"))return;de(null),At();const Ze=Cn.find(Ne=>Ne.operation.id===Ee)?.operation.groupId??null;Qt({kind:"chip",sourceId:Ee,sourceGroupId:Ze,pointerId:Q.pointerId,startX:Q.clientX,startY:Q.clientY,currentY:Q.clientY,dragging:!1,dropIndex:ue.indexOf(Ee),dropGroupId:Ze})},Ci=(Q,Ee)=>{Q.button===0&&(Q.target instanceof Element&&Q.target.closest("button")||it.includes(Ee)&&(de(null),At(),Qt({kind:"group",sourceGroupId:Ee,pointerId:Q.pointerId,startX:Q.clientX,startY:Q.clientY,currentY:Q.clientY,dragging:!1,dropIndex:it.indexOf(Ee)})))},en=(Q,Ee)=>{if(Q.button!==0||Q.target instanceof Element&&Q.target.closest("button"))return;const Qe=e.map(Ze=>Ze.id);Qe.includes(Ee)&&(de(null),At(),Qt({kind:"theater",sourceTheaterId:Ee,pointerId:Q.pointerId,startX:Q.clientX,startY:Q.clientY,currentY:Q.clientY,dragging:!1,dropIndex:Qe.indexOf(Ee)}))},tn=v.useCallback(Q=>{Q.preventDefault();const Ee=Q.clientX,Qe=M.width;Ft(!0);const Ze=dt=>{const pe=dt.clientX-Ee;M7(Qe+pe)},Ne=()=>{Ft(!1),document.removeEventListener("pointermove",Ze),document.removeEventListener("pointerup",Ne),document.removeEventListener("pointercancel",Ne)};document.addEventListener("pointermove",Ze),document.addEventListener("pointerup",Ne),document.addEventListener("pointercancel",Ne)},[M.width]),ns=()=>{sc(!T)},Us=()=>{tt(null),de(null),st(!0)},ua=()=>{st(!1),V()},Ws=Q=>{st(!1),Z(Q)},Tr=Q=>{Q.defaultPrevented||(Q.preventDefault(),de(null),tt({anchor:{x:Q.clientX,y:Q.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Ui=v.useCallback(()=>{const Q=lt?.kind==="theater"?lt.returnFocus:null;de(null),Q?.focus()},[lt]),Ve=(Q,Ee)=>{Ee!==t&&W(Ee),de(null),tt({anchor:{x:Q.right+8,y:Q.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Y=(Q,Ee)=>{Q.stopPropagation(),Ve(Q.currentTarget.getBoundingClientRect(),Ee)};v.useEffect(()=>{ti&&(WI(),T&&sc(!1),Us())},[ti]),v.useEffect(()=>{const Q=ni;if(Q===null)return;if(T){sc(!1);return}if(!e.some(Ne=>Ne.id===Q)){ok();return}const Ee=()=>{ok();const dt=Array.from(A.current?.querySelectorAll("[data-theater-id]")??[]).find(pe=>pe.dataset.theaterId===Q)?.querySelector(".side-bar-theater-launch-btn");dt&&Ve(dt.getBoundingClientRect(),Q)};if(A.current!==null&&Math.abs(A.current.getBoundingClientRect().width-k)<=1){Ee();return}const Ze=window.setTimeout(Ee,220);return()=>window.clearTimeout(Ze)},[ni,T]);const _e=Q=>{j7(Q,!Oe.includes(Q))};return c.jsxs("aside",{className:`operations-side-bar ${T?"is-closed":"is-expanded"}`,ref:A,"data-sidebar-state":T?"closed":"expanded","data-resizing":zt?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${k}px`},inert:T,onContextMenu:Tr,children:[!T&&m?c.jsx("p",{className:"side-bar-theater-error",children:m}):null,c.jsxs("ol",{className:"operations-side-bar-chips",ref:B,"aria-label":"Theaters and operations",children:[e.map((Q,Ee)=>{const Qe=Q.id===t,Ze=n.filter(Ke=>Ke.theaterId===Q.id),Ne=!R&&K7(Ze,cn),dt=lt?.kind==="theater"&&lt.theaterId===Q.id,pe=Oe.includes(Q.id),Pe=fe?.kind==="theater"&&fe.sourceTheaterId===Q.id&&fe.dragging,qe=Pe&&fe?.kind==="theater"?fe.currentY-fe.startY:0,Ct=fe?.kind==="theater"&&fe.dragging&&fe.sourceTheaterId!==Q.id&&fe.dropIndex===Ee,Yt=fe?.kind==="theater"&&fe.dragging&&fe.sourceTheaterId!==Q.id&&Ee===e.length-1&&fe.dropIndex===e.length;if(!Qe){const Ke=qD(Q.id),Ht=Y7({theaterId:Q.id,operations:n,operationOrder:Ke.operationOrder,minimizedSet:new Set(Ke.minimized),activeOperationId:null,operationNotifications:u,operationStatus:cn,catalog:h,renderKindIcon:_});return c.jsx(X7,{theater:Q,entries:pe?[]:Ht,groups:i.filter(nn=>nn.theaterId===Q.id),collapsedGroups:new Set(Ke.collapsedGroups),operationAccent:Ke.operationAccent,collapsed:pe,statusAxis:R,statusActionsOpen:dt,showStatusLiveTick:Ne,statusLandingIds:Se,dragging:Pe,dropBefore:Ct,dropAfter:Yt,dragOffsetY:qe,onSelectTheater:W,onFocus:x,onToggleCollapsed:_e,onToggleStatusAxis:Ry,onOpenActions:(nn,Bt)=>{tt(null),de({kind:"theater",theaterId:Q.id,anchor:nn,returnFocus:Bt})},onOpenLaunch:Y,onContextMenu:nn=>{tt(null),de({kind:"theater",theaterId:Q.id,anchor:nn})},onPointerDragStart:en},Q.id)}return c.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",Ct?"side-bar-theater-section--drop-before":"",Yt?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":Q.id,children:[c.jsx(BA,{theater:Q,active:!0,collapsed:pe,statusAxis:R,statusActionsOpen:dt,showStatusLiveTick:Ne,dragging:Pe,dropTarget:Ct,dragOffsetY:qe,onSelectTheater:W,onToggleCollapsed:_e,onToggleStatusAxis:Ry,onOpenActions:(Ke,Ht)=>{tt(null),de({kind:"theater",theaterId:Q.id,anchor:Ke,returnFocus:Ht})},onOpenLaunch:Y,onContextMenu:Ke=>{tt(null),de({kind:"theater",theaterId:Q.id,anchor:Ke})},onPointerDragStart:en}),pe?null:c.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${Q.label} operations`,children:R?le.map(Ke=>c.jsxs("li",{className:`side-bar-status-section side-bar-status-section--${Ke.status}`,children:[c.jsxs("div",{className:`side-bar-status-header side-bar-status-header--${Ke.status}`,children:[c.jsx("span",{className:"side-bar-status-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-status-header__label",children:Ke.label}),c.jsx("span",{className:"side-bar-status-header__count",children:Ke.entries.length})]}),c.jsx("ol",{className:"side-bar-group-chips","aria-label":`${Ke.label} operations`,children:Ke.entries.map(Ht=>{const nn=Be.get(Ht.operation.id)??0,Bt=K.operationAccent[Ht.operation.id]??ud(Ht.operation),un=Bt?Bs(Bt):null,qs=Ht.operation.groupId?Le.get(Ht.operation.groupId)??null:null;return c.jsx(gp,{entry:Ht,index:nn,isCloseArmed:ne===Ht.operation.id,accentValue:un,groupMark:qs,statusLanded:Se.has(Ht.operation.id),reorderEnabled:!1,dragging:!1,dragOffsetY:0,dropTarget:!1,onArmClose:jt,onDisarmClose:At,onClose:S,onMinimize:w,onFocus:x,onKeyboardMove:fn,onPointerDragStart:ys,onOpenAccent:(is,Ar)=>de({kind:"chip",operationId:is,anchor:Ar}),onRename:D},Ht.operation.id)})})]},Ke.status)):ee.map(Ke=>{const Ht=Ke.groupId!==null&&$t.has(Ke.groupId),nn=Ke.group?Bs(Ke.group.color):null,Bt=nn?{"--grp-color":nn}:void 0,un=Ke.groupId?it.indexOf(Ke.groupId):-1,qs=fe?.kind==="group"&&fe.sourceGroupId===Ke.groupId&&fe.dragging,is=fe?.kind==="group"&&fe.dragging&&Ke.groupId!==null&&fe.sourceGroupId!==Ke.groupId&&fe.dropIndex===un,Ar=fe?.kind==="group"&&fe.dragging&&Ke.groupId!==null&&fe.sourceGroupId!==Ke.groupId&&un===it.length-1&&fe.dropIndex===it.length,da=[Ke.groupId?"side-bar-group-section":"side-bar-ungrouped-section",is?"side-bar-group-section--drop-before":"",Ar?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return c.jsxs("li",{"data-drop-zone-group-id":Ke.groupId??"__ungrouped__",className:da,style:Bt,children:[Ke.group?c.jsx(TA,{group:Ke.group,count:Ke.entries.length,collapsed:Ht,dragging:qs,dragOffsetY:qs?fe.currentY-fe.startY:0,dropTarget:is,onToggle:WT,onContextMenu:(ki,ii)=>de({kind:"group",groupId:ki,anchor:ii}),onPointerDragStart:Ci}):Fe&&Ke.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:c.jsx("span",{children:"Ungrouped"})}):null,Ht?null:c.jsx("ol",{className:["side-bar-group-chips",fe?.kind==="chip"&&fe.dragging&&fe.dropGroupId===Ke.groupId&&fe.dropGroupId!==fe.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":Ke.groupId??"__ungrouped__","aria-label":Ke.group?Ke.group.name:"Ungrouped",children:Ke.entries.map(ki=>{const ii=Cn.indexOf(ki),co=Ke.entries.indexOf(ki),rr=K.operationAccent[ki.operation.id]??ud(ki.operation),ha=rr?Bs(rr):null;return c.jsx(gp,{entry:ki,index:ii,isCloseArmed:ne===ki.operation.id,accentValue:ha,dragging:fe?.kind==="chip"&&fe.sourceId===ki.operation.id&&fe.dragging,dragOffsetY:fe?.kind==="chip"&&fe.sourceId===ki.operation.id&&fe.dragging?fe.currentY-fe.startY:0,dropTarget:fe?.kind==="chip"&&fe.dragging===!0&&fe.dropGroupId===Ke.groupId&&fe.dropGroupId===fe.sourceGroupId&&fe.dropIndex===co&&fe.sourceId!==ki.operation.id,onArmClose:jt,onDisarmClose:At,onClose:S,onMinimize:w,onFocus:x,onKeyboardMove:fn,onPointerDragStart:ys,onOpenAccent:(Yn,il)=>de({kind:"chip",operationId:Yn,anchor:il}),onRename:D},ki.operation.id)})})]},Ke.groupId??"__ungrouped__")})})]},Q.id)}),c.jsx("li",{children:c.jsxs("button",{type:"button",className:"side-bar-ghost-theater-row",onClick:Us,disabled:f,children:[c.jsx("span",{className:"side-bar-ghost-theater-anchor","aria-hidden":"true",children:c.jsx(V0,{})}),c.jsx("span",{className:"side-bar-ghost-theater-label",children:"New Theater"})]})})]}),c.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:tn,onDoubleClick:ns,"aria-hidden":"true"}),ut?aa.createPortal(c.jsx(bA,{anchor:ut.anchor,viewportBounds:ut.viewportBounds,placement:"cursor",catalog:h,canLaunch:p,renderKindIcon:_,onLaunchKind:(Q,Ee)=>{tt(null),b(Q,Ee)},onClose:()=>tt(null)},`${ut.anchor.x}:${ut.anchor.y}`),document.body):null,lt?.kind==="chip"&&Re?c.jsx(mk,{kind:"chip",operation:Re,groups:i.filter(Q=>Q.theaterId===Re.theaterId),accentKey:K.operationAccent[Re.id]??ud(Re),anchor:lt.anchor,actions:{onSetAccent:Q=>C(Re.id,Q),onSetGroupId:Q=>z(Re.id,Q),onCreateGroup:Q=>F(Re.theaterId,Q,Re.id)},onClose:()=>de(null)}):lt?.kind==="group"&&Ae?c.jsx(mk,{kind:"group-header",group:Ae,anchor:lt.anchor,actions:{onSetColor:Q=>N(Ae.id,Q),onRename:Q=>I(Ae.id,Q),onUngroupAll:()=>G(Ae.id)},onClose:()=>de(null)}):lt?.kind==="theater"&&et?c.jsx(Z7,{theater:et,groupCount:i.filter(Q=>Q.theaterId===et.id).length,anchor:lt.anchor,onCreateGroup:Q=>{F(et.id,Q),Ui()},onForgetTheater:()=>{O(et.id),Ui()},onClose:Ui}):null,c.jsx(wA,{open:Vt,onCancel:ua,onConfirm:Ws}),T?null:c.jsx(V8,{})]})}function DA(e,t,n){const i=[...t].sort((h,p)=>h.order-p.order||h.createdAt-p.createdAt),r=i.map(h=>({groupId:h.id,group:h,entries:[]})),o={groupId:null,group:null,entries:[]},u=new Map(i.map(h=>[h.id,h]));for(const h of e){const p=h.operation.groupId??null;p!==null&&u.has(p)?r.find(m=>m.groupId===p)?.entries.push(h):o.entries.push(h)}return[...r,o]}function IA(e){return q7.flatMap(({status:t,label:n})=>{const i=e.filter(r=>Ly(r.status)===t);return i.length>0?[{status:t,label:n,entries:i}]:[]})}function K7(e,t){return e.some(n=>t[n.id]==="awaiting")}function Ly(e){return e??"idle"}function V7(e,t){const n=e.operation.groupId;if(!n)return null;const i=t.find(o=>o.id===n);if(!i)return null;const r=Bs(i.color);return r?{name:i.name,color:r}:null}function Y7({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:r,operationNotifications:o,operationStatus:u,catalog:h,renderKindIcon:p}){return tm(t.filter(f=>f.theaterId===e),n).map(f=>{const m=OA(h,f),_=m?p(f.pluginId,m):null;return{operation:f,active:r===f.id,minimized:i.has(f.id),notificationCount:o[f.id]?1:0,status:u[f.id],icon:_}})}function BA({theater:e,active:t,collapsed:n,statusAxis:i,statusActionsOpen:r,showStatusLiveTick:o,dragging:u,dropTarget:h,dragOffsetY:p,onSelectTheater:f,onToggleCollapsed:m,onToggleStatusAxis:_,onOpenActions:b,onOpenLaunch:S,onContextMenu:w,onPointerDragStart:x}){const C=v.useRef(!1),D=["side-bar-theater-header",t?"is-active":"",u?"side-bar-theater-header--dragging":"",h?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),z=u?{"--drag-dy":`${Math.round(p)}px`}:void 0,F=W=>{W.preventDefault(),w(W.currentTarget.getBoundingClientRect())},N=W=>{W.target===W.currentTarget&&(W.key!=="Enter"&&W.key!==" "||(W.preventDefault(),U()))},I=W=>{W.target instanceof Element&&W.target.closest("button")||x(W,e.id)},j=()=>{u&&(C.current=!0)},U=()=>{if(!t){f(e.id);return}m(e.id)},G=()=>{if(C.current){C.current=!1;return}U()};return c.jsxs("div",{role:"button",tabIndex:0,className:D,style:z,onClick:G,onKeyDown:N,onContextMenu:F,onPointerDown:I,onPointerUp:j,"aria-current":t?"true":void 0,"aria-expanded":!n,title:t?n?`Expand ${e.label}`:`Collapse ${e.label}`:`Switch to ${e.label}`,children:[c.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:Y0(e.label)}),c.jsx("span",{className:"side-bar-theater-name",children:e.label}),c.jsx(Q7,{collapsed:n}),c.jsxs("span",{className:"side-bar-theater-row-controls",role:"group","aria-label":`${e.label} controls`,children:[c.jsxs("button",{type:"button",className:"side-bar-status-axis-toggle","aria-label":"Sort by status","aria-pressed":i,title:"Sort by status (Alt+S)",onClick:W=>{W.stopPropagation(),_()},children:[c.jsx(eB,{}),o?c.jsx("span",{className:"side-bar-status-axis-live-tick","aria-hidden":"true"}):null]}),c.jsxs("span",{className:"side-bar-theater-split-control",role:"group","aria-label":`${e.label} operation controls`,children:[c.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-launch-btn side-bar-theater-split-plus","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:W=>S(W,e.id),children:c.jsx(V0,{})}),c.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-split-caret","aria-label":"Theater actions","aria-haspopup":"menu","aria-expanded":r,title:"Theater actions",onClick:W=>{W.stopPropagation(),b(W.currentTarget.getBoundingClientRect(),W.currentTarget)},children:c.jsx(tB,{})})]})]})]})}function X7({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,collapsed:o,statusAxis:u,statusActionsOpen:h,showStatusLiveTick:p,statusLandingIds:f,dragging:m,dropBefore:_,dropAfter:b,dragOffsetY:S,onSelectTheater:w,onFocus:x,onToggleCollapsed:C,onToggleStatusAxis:D,onOpenActions:z,onOpenLaunch:F,onContextMenu:N,onPointerDragStart:I}){const j=DA(t,n),U=IA(t),G=j.some(W=>W.group!==null);return c.jsxs("li",{className:["side-bar-theater-section",_?"side-bar-theater-section--drop-before":"",b?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[c.jsx(BA,{theater:e,active:!1,collapsed:o,statusAxis:u,statusActionsOpen:h,showStatusLiveTick:p,dragging:m,dropTarget:_,dragOffsetY:S,onSelectTheater:w,onToggleCollapsed:C,onToggleStatusAxis:D,onOpenActions:z,onOpenLaunch:F,onContextMenu:N,onPointerDragStart:I}),!o&&(u?U.length:j.length)>0?c.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:u?U.map(W=>c.jsxs("li",{className:`side-bar-status-section side-bar-status-section--${W.status}`,children:[c.jsxs("div",{className:`side-bar-status-header side-bar-status-header--${W.status}`,children:[c.jsx("span",{className:"side-bar-status-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-status-header__label",children:W.label}),c.jsx("span",{className:"side-bar-status-header__count",children:W.entries.length})]}),c.jsx("ol",{className:"side-bar-group-chips","aria-label":`${W.label} operations`,children:W.entries.map((Z,V)=>{const O=r[Z.operation.id]??ud(Z.operation),A=O?Bs(O):null;return c.jsx(gp,{entry:Z,index:V,isCloseArmed:!1,accentValue:A,groupMark:V7(Z,n),statusLanded:f.has(Z.operation.id),reorderEnabled:!1,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:x,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},Z.operation.id)})})]},W.status)):j.map(W=>{const Z=W.groupId!==null&&i.has(W.groupId),V=W.group?Bs(W.group.color):null;return c.jsxs("li",{className:W.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:V?{"--grp-color":V}:void 0,children:[W.group?c.jsx(TA,{group:W.group,count:W.entries.length,collapsed:Z,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:O=>YD(e.id,O),onContextMenu:()=>{},onPointerDragStart:()=>{}}):G&&W.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:c.jsx("span",{children:"Ungrouped"})}):null,Z?null:c.jsx("ol",{className:"side-bar-group-chips","aria-label":W.group?W.group.name:"Ungrouped",children:W.entries.map((O,A)=>{const B=r[O.operation.id]??ud(O.operation),M=B?Bs(B):null;return c.jsx(gp,{entry:O,index:A,isCloseArmed:!1,accentValue:M,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:x,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},O.operation.id)})})]},W.groupId??"__ungrouped__")})}):null]})}function Z7({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:r,onClose:o}){const[u,h]=v.useState(!1),[p,f]=v.useState(`Group ${t+1}`),m=v.useRef(!1),_=v.useRef(null),b=v.useRef(null),[S,w]=v.useState(n.bottom+6);v.useLayoutEffect(()=>{const C=b.current?.getBoundingClientRect().height??0,D=window.innerHeight-C-8;w(Math.max(8,Math.min(n.bottom+6,D)))},[n,u]),v.useEffect(()=>{u&&_.current?.select()},[u]),v.useEffect(()=>{const C=D=>{D.key==="Escape"&&(D.preventDefault(),o())};return window.addEventListener("keydown",C),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",C),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const x=()=>{const C=p.trim();C&&i(C)};return aa.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:c.jsxs("div",{ref:b,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:n.left,top:S},onPointerDown:C=>C.stopPropagation(),children:[u?c.jsx("input",{ref:_,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:C=>f(C.target.value),onCompositionStart:()=>{m.current=!0},onCompositionEnd:()=>{m.current=!1},onKeyDown:C=>{C.key==="Enter"&&!m.current&&(C.preventDefault(),x()),C.key==="Escape"&&(C.preventDefault(),h(!1))},onBlur:()=>h(!1),"aria-label":"New group name",placeholder:"Group name"}):c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>h(!0),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(V0,{})}),c.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),c.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:r,children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(iB,{})}),c.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function J7(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+Sk?t.scrollTop-=wk:e>n.bottom-Sk&&(t.scrollTop+=wk)}function Q7({collapsed:e}){return c.jsx("svg",{className:`side-bar-theater-chevron${e?" is-collapsed":""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function eB(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"4",cy:"4",r:"1.5",fill:"currentColor"}),c.jsx("path",{d:"M8 4h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),c.jsx("circle",{cx:"4",cy:"8",r:"1.5",fill:"currentColor"}),c.jsx("path",{d:"M8 8h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),c.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),c.jsx("path",{d:"M8 12h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function tB(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m5.2 6.6 2.8 2.8 2.8-2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function V0(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function Y0(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>nB(i)):PA(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function nB(e){return PA(e).slice(0,1)}function PA(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function iB(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.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 sB({theaters:e,operations:t,activeTheaterId:n,addingTheater:i,onSelectTheater:r,onAddTheater:o,style:u,containerRef:h}){const p=[e.map(f=>{const m=t.filter(_=>_.theaterId===f.id).length;return{key:f.id,role:"menuitemradio",label:f.label,checked:f.id===n,mark:Y0(f.label),meta:`${m} ${m===1?"op":"ops"}`,onSelect:()=>r(f.id)}}),[{key:"__add-theater__",role:"menuitem",label:"Add Theater…",action:!0,disabled:i,onSelect:o}]];return c.jsx($A,{menuLabel:"Switch Theater",sections:p,style:u,containerRef:h})}function rB({operations:e,activeOperationId:t,theaterLabel:n,onSelectOperation:i,onRenameOperation:r,onNewOperation:o,style:u,containerRef:h}){const p=[e.map(f=>({key:f.id,role:"menuitemradio",label:f.title,checked:f.id===t,meta:oB(f),onSelect:()=>i(f.id)})),[...r!==null?[{key:"__rename-operation__",role:"menuitem",label:"Rename current operation…",onSelect:r}]:[],{key:"__new-operation__",role:"menuitem",label:`New Operation in ${n}…`,action:!0,onSelect:o}]];return c.jsx($A,{menuLabel:"Switch operation",sections:p,emptyNote:e.length===0?"No operations in this Theater":null,style:u,containerRef:h})}function $A({menuLabel:e,sections:t,emptyNote:n,style:i,containerRef:r}){const o=()=>Array.from(r.current?.querySelectorAll(".command-band-menu-item:not(:disabled)")??[]);v.useEffect(()=>{const p=o();(p.find(f=>f.getAttribute("aria-checked")==="true")??p[0])?.focus()},[]);const u=p=>{if(p.key!=="ArrowDown"&&p.key!=="ArrowUp"&&p.key!=="Home"&&p.key!=="End")return;const f=o();if(f.length===0)return;p.preventDefault();const m=f.findIndex(b=>b===document.activeElement),_=p.key==="Home"?0:p.key==="End"?f.length-1:p.key==="ArrowDown"?(m+1)%f.length:m<=0?f.length-1:m-1;f[_]?.focus()},h=t.filter(p=>p.length>0);return c.jsxs("div",{ref:r,className:"command-band-menu",role:"menu","aria-label":e,style:i,onKeyDown:u,children:[n?c.jsx("p",{className:"command-band-menu-empty",children:n}):null,h.map((p,f)=>c.jsxs(v.Fragment,{children:[f>0||n?c.jsx("div",{className:"command-band-menu-divider","aria-hidden":"true"}):null,p.map(m=>c.jsxs("button",{type:"button",role:m.role,"aria-checked":m.role==="menuitemradio"?m.checked===!0:void 0,className:`command-band-menu-item${m.checked?" is-active":""}${m.action?" command-band-menu-action":""}`,disabled:m.disabled,onClick:m.onSelect,children:[c.jsx("span",{className:"command-band-menu-check","aria-hidden":"true",children:m.checked?c.jsx(aB,{}):null}),m.mark!==void 0?c.jsx("span",{className:"command-band-theater-mark","aria-hidden":"true",children:m.mark}):null,c.jsx("span",{className:"command-band-menu-label",children:m.label}),m.meta?c.jsx("span",{className:"command-band-menu-meta",children:m.meta}):null]},m.key))]},p[0]?.key??f))]})}function $_(){return c.jsx("span",{className:"command-band-trigger-caret","aria-hidden":"true",children:c.jsx("svg",{viewBox:"0 0 10 10",children:c.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})}function aB(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function oB(e){const t=e.payload.cliLabel;if(typeof t=="string")return t;const n=e.payload.cliId;return typeof n=="string"?n:null}const yp="fleet-console.rail.activePanelId",zA="fleet-console.rail.chromeExpanded",HA="fleet-console.rail.panelBehavior",lB="fleet-console.repository.source",My=new Set;let xi={activeRailPanelId:vB(),railChromeExpanded:yB(),panelExtraWidth:0,panelBehavior:bB()};function rm(e){return My.add(e),()=>{My.delete(e)}}function am(){return xi}function cB(e){xi.activeRailPanelId!==e&&(Ac({...xi,activeRailPanelId:e,panelExtraWidth:0}),Z0(e))}function uB(e){const t=xi.activeRailPanelId===e?null:e;Ac({...xi,activeRailPanelId:t,panelExtraWidth:0}),Z0(t)}function dB(e){cB(e)}function hB(){xi.activeRailPanelId!==null&&(Ac({...xi,activeRailPanelId:null,panelExtraWidth:0}),Z0(null))}function FA(e){xi.railChromeExpanded!==e&&(Ac({...xi,railChromeExpanded:e}),SB(e))}function X0(){FA(!xi.railChromeExpanded)}function fB(e){xi.panelBehavior!==e&&(Ac({...xi,panelBehavior:e}),wB(e))}function pB(){fB(xi.panelBehavior==="push"?"overlay":"push")}function mB(e,t){if(e!==xi.activeRailPanelId)return;const n=t===null||!Number.isFinite(t)?0:t,i=Math.max(0,Math.round(n)),r=typeof window<"u"?Math.min(i,Math.max(0,window.innerWidth-548)):i;r!==xi.panelExtraWidth&&Ac({...xi,panelExtraWidth:r})}function UA(){return v.useSyncExternalStore(rm,am).activeRailPanelId}function WA(){return v.useSyncExternalStore(rm,am).railChromeExpanded}function gB(){return v.useSyncExternalStore(rm,am).panelExtraWidth}function _B(){return v.useSyncExternalStore(rm,am).panelBehavior}function vB(){try{const e=localStorage.getItem(yp);if(e==="diff"||e==="history"){try{localStorage.setItem(yp,"repository"),e==="history"&&localStorage.setItem(lB,"history")}catch{}return"repository"}return e}catch{return null}}function yB(){try{return localStorage.getItem(zA)!=="0"}catch{return!0}}function bB(){try{const e=localStorage.getItem(HA);return e==="overlay"||e==="push"?e:"push"}catch{return"push"}}function Z0(e){try{e===null?localStorage.removeItem(yp):localStorage.setItem(yp,e)}catch{}}function SB(e){try{localStorage.setItem(zA,e?"1":"0")}catch{}}function wB(e){try{localStorage.setItem(HA,e)}catch{}}function Ac(e){xi=e;for(const t of My)t()}function qA(e){const{sizeRange:t}=e,[n,i]=v.useState(""),[r,o]=v.useState(e.size),u=v.useRef(Promise.resolve()),h=v.useId(),p=v.useMemo(()=>xB(e),[e]),f=v.useMemo(()=>CB(p,n),[p,n]),m=v.useMemo(()=>f.map((j,U)=>({row:j,index:U})),[f]),[_,b]=v.useState(()=>kB(p,e.selected)),S=p.find(j=>bp(j.selection,e.selected))??null,w=m[Math.min(_,Math.max(0,m.length-1))]?.row??null,x=`${h}-built-ins`,C=`${h}-installed`;v.useEffect(()=>{o(e.size)},[e.size]),v.useEffect(()=>{_>=m.length&&b(Math.max(0,m.length-1))},[_,m.length]);const D=v.useCallback(j=>{const U=Ck(j,t);o(U),u.current=u.current.catch(()=>{}).then(()=>e.onSizeCommit(U))},[e.onSizeCommit,t]),z=v.useCallback(j=>{f.length&&b(U=>(U+j+f.length)%f.length)},[f.length]),F=v.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),N=v.useCallback((j,U)=>{b(j),e.onSelectionChange(U)},[e]),I=j=>{j.key==="ArrowDown"?(j.preventDefault(),z(1)):j.key==="ArrowUp"?(j.preventDefault(),z(-1)):j.key==="Home"?(j.preventDefault(),b(0)):j.key==="End"?(j.preventDefault(),b(Math.max(0,f.length-1))):(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),F())};return c.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:c.jsxs("div",{className:"fc-font-browser__panes",children:[c.jsxs("div",{className:"fc-font-browser__chooser",children:[c.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${h}-search`,children:"Search fonts"}),c.jsx("input",{id:`${h}-search`,className:"fc-font-browser__search",type:"search",value:n,disabled:e.disabled,placeholder:"Search installed fonts",onChange:j=>{i(j.currentTarget.value),b(0)}}),e.loading?c.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?c.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,c.jsxs("div",{id:h,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":w?GA(h,_):void 0,"aria-busy":e.loading||void 0,onKeyDown:I,children:[c.jsx(xk,{groupId:x,label:"Built-in",rows:m.filter(({row:j})=>j.source==="builtin"),activeRow:w,selected:e.selected,listboxId:h,disabled:e.disabled,onSelect:N}),c.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),c.jsx(xk,{groupId:C,label:"Installed on this machine",rows:m.filter(({row:j})=>j.source==="system"),activeRow:w,selected:e.selected,listboxId:h,disabled:e.disabled,onSelect:N}),!e.loading&&!m.length?c.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),c.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[c.jsxs("div",{className:"fc-font-browser__preview-head",children:[c.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),c.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?"Unavailable":"Available"})]}),c.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${r}px`},children:e.previewText}),c.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r<=t.min,onClick:()=>D(r-t.step),"aria-label":"Decrease font size",children:"−"}),c.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[r,"px"]}),c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r>=t.max,onClick:()=>D(r+t.step),"aria-label":"Increase font size",children:"+"})]}),c.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:r,disabled:e.disabled,"aria-label":"Font size slider",onChange:j=>o(Ck(Number(j.currentTarget.value),t)),onPointerUp:j=>D(Number(j.currentTarget.value)),onKeyUp:j=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(j.key)&&D(Number(j.currentTarget.value))}})]})]})})}function xk({groupId:e,label:t,rows:n,activeRow:i,selected:r,listboxId:o,disabled:u,onSelect:h}){return c.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[c.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),n.map(({row:p,index:f})=>c.jsxs("button",{id:GA(o,f),type:"button",className:`fc-font-browser__row${bp(p.selection,i?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":bp(p.selection,r),disabled:u||p.unavailable,onClick:()=>h(f,p.selection),children:[c.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:p.previewFamily},children:p.label}),p.description?c.jsx("span",{className:"fc-font-browser__row-meta",children:p.description}):null,p.unavailable?c.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},p.id))]})}function xB(e){const t=new Set,n=e.builtIns.flatMap(o=>{const u=[o.id,o.label,...o.aliases??[]].map(dd);return u.some(h=>t.has(h))?[]:(u.forEach(h=>t.add(h)),[{id:`builtin-${o.id}`,label:o.label,family:o.family,previewFamily:o.family,source:"builtin",selection:{source:"builtin",id:o.id},description:o.description,unavailable:!1}])}),i=e.installedFonts.map(o=>({id:`system-${dd(o.family)}`,label:o.family,family:o.family,previewFamily:hp(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!kD(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${dd(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:hp(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function CB(e,t){const n=dd(t);return n?e.filter(i=>dd(`${i.label} ${i.description??""}`).includes(n)):e}function dd(e){return e.trim().toLocaleLowerCase()}function GA(e,t){return`${e}-option-${t}`}function kB(e,t){const n=e.findIndex(i=>bp(i.selection,t));return n>=0?n:0}function bp(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function Ck(e,t){if(!Number.isFinite(e))return t.defaultValue;const n=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,n))}const EB="/api/v1/settings/fonts/system";class Zl extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function TB(e){if(!VA(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new Zl("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(AB)}}async function KA(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new Zl("System font fetching is unavailable in this environment.");let n;try{n=await t(EB,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new Zl("System fonts could not be loaded.")}if(!n.ok)throw new Zl("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new Zl("System font response is not valid JSON.",n.status)}return TB(i)}function AB(e){if(!VA(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new Zl("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function RB(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function VA(e,t){return RB(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const kk=250,NB=5e3,Ek=1,LB=1013,MB=4e3,jB=4001;function OB(e){const t=new AbortController,n=new TextEncoder;let i=kk,r=null,o=null,u=null,h=!1;const p=()=>{o?.dispose(),o=null},f=(b,S)=>{u={cols:b,rows:S},r?.readyState===Ek&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},m=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await IB(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await _(DB(b,e.location,e.wsPath),e),i=kk}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await PB(i,t.signal),i=Math.min(i*2,NB)}},_=async(b,S)=>{await new Promise((w,x)=>{const C=(S.webSocketFactory??BB)(b);r=C,C.binaryType="arraybuffer",C.onopen=()=>{S.onStatus?.("live"),p(),o=S.terminal.onData(D=>{C.readyState===Ek&&C.send(n.encode(D))}),u&&f(u.cols,u.rows)},C.onmessage=D=>{D.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(D.data))},C.onerror=()=>{x(new Error("Terminal WebSocket error"))},C.onclose=D=>{p(),r===C&&(r=null);const z=D?.code;z===MB?(t.abort(),S.onStatus?.("closed","terminal_replaced")):z===jB?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):z===LB&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{h||(h=!0,m())},resize:f,dispose:()=>{t.abort(),p(),e.onStatus?.("closed"),r?.close(),r=null}}}function DB(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function IB(e,t,n){const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:n});if(!i.ok)throw new Error(`Terminal ticket request failed: ${i.status}`);const r=await i.json();if(typeof r.ticket!="string"||typeof r.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:r.ticket,ttlMs:r.ttlMs}}function BB(e){return new WebSocket(e)}async function PB(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var $B=2,zB=1,HB=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),r=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),u={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},h=u.top+u.bottom,p=u.right+u.left,f=i-h,m=r-p-t;return{cols:Math.max($B,Math.floor(m/e.css.cell.width)),rows:Math.max(zB,Math.floor(f/e.css.cell.height))}}};var z_=[[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]],FB=[[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]],Zn;function UB(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var WB=class{constructor(){if(this.version="6",!Zn){Zn=new Uint8Array(65536),Zn.fill(1),Zn[0]=0,Zn.fill(0,1,32),Zn.fill(0,127,160),Zn.fill(2,4352,4448),Zn[9001]=2,Zn[9002]=2,Zn.fill(2,11904,42192),Zn[12351]=1,Zn.fill(2,44032,55204),Zn.fill(2,63744,64256),Zn.fill(2,65040,65050),Zn.fill(2,65072,65136),Zn.fill(2,65280,65377),Zn.fill(2,65504,65511);for(let t=0;t<z_.length;++t)Zn.fill(0,z_[t][0],z_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Zn[t]:UB(t,FB)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=wp.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return wp.createPropertyValue(0,i,r)}},qB=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Tk.isErrorNoTelemetry(t)?new Tk(t.message+`
12
+
13
+ `+t.stack):new Error(t.message+`
14
+
15
+ `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(n=>{n(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},GB=new qB;function H_(e){KB(e)||GB.onUnexpectedError(e)}var jy="Canceled";function KB(e){return e instanceof VB?!0:e instanceof Error&&e.name===jy&&e.message===jy}var VB=class extends Error{constructor(){super(jy),this.name=this.message}},Tk=class Oy extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Oy)return t;let n=new Oy;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function YB(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var XB;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(XB||={});var YA;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(N){yield N}e.single=r;function o(N){return t(N)?N:r(N)}e.wrap=o;function u(N){return N||n}e.from=u;function*h(N){for(let I=N.length-1;I>=0;I--)yield N[I]}e.reverse=h;function p(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(N){return N[Symbol.iterator]().next().value}e.first=f;function m(N,I){let j=0;for(let U of N)if(I(U,j++))return!0;return!1}e.some=m;function _(N,I){for(let j of N)if(I(j))return j}e.find=_;function*b(N,I){for(let j of N)I(j)&&(yield j)}e.filter=b;function*S(N,I){let j=0;for(let U of N)yield I(U,j++)}e.map=S;function*w(N,I){let j=0;for(let U of N)yield*I(U,j++)}e.flatMap=w;function*x(...N){for(let I of N)yield*I}e.concat=x;function C(N,I,j){let U=j;for(let G of N)U=I(U,G);return U}e.reduce=C;function*D(N,I,j=N.length){for(I<0&&(I+=N.length),j<0?j+=N.length:j>N.length&&(j=N.length);I<j;I++)yield N[I]}e.slice=D;function z(N,I=Number.POSITIVE_INFINITY){let j=[];if(I===0)return[j,N];let U=N[Symbol.iterator]();for(let G=0;G<I;G++){let W=U.next();if(W.done)return[j,e.empty()];j.push(W.value)}return[j,{[Symbol.iterator](){return U}}]}e.consume=z;async function F(N){let I=[];for await(let j of N)I.push(j);return Promise.resolve(I)}e.asyncToArray=F})(YA||={});function XA(e){if(YA.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function ZB(...e){return ZA(()=>XA(e))}function ZA(e){return{dispose:YB(()=>{e()})}}var JA=class QA{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{XA(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?QA.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)}};JA.DISABLE_DISPOSED_WARNING=!1;var J0=JA,Sp=class{constructor(){this._store=new J0,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)}};Sp.None=Object.freeze({dispose(){}});var JB=globalThis.performance&&typeof globalThis.performance.now=="function",QB=class eR{static create(t){return new eR(t)}constructor(t){this._now=JB&&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}},eP;(e=>{e.None=()=>Sp.None;function t(O,A){return _(O,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(O){return(A,B=null,M)=>{let k=!1,T;return T=O(R=>{if(!k)return T?T.dispose():k=!0,A.call(B,R)},null,M),k&&T.dispose(),T}}e.once=n;function i(O,A,B){return f((M,k=null,T)=>O(R=>M.call(k,A(R)),null,T),B)}e.map=i;function r(O,A,B){return f((M,k=null,T)=>O(R=>{A(R),M.call(k,R)},null,T),B)}e.forEach=r;function o(O,A,B){return f((M,k=null,T)=>O(R=>A(R)&&M.call(k,R),null,T),B)}e.filter=o;function u(O){return O}e.signal=u;function h(...O){return(A,B=null,M)=>{let k=ZB(...O.map(T=>T(R=>A.call(B,R))));return m(k,M)}}e.any=h;function p(O,A,B,M){let k=B;return i(O,T=>(k=A(k,T),k),M)}e.reduce=p;function f(O,A){let B,M={onWillAddFirstListener(){B=O(k.fire,k)},onDidRemoveLastListener(){B?.dispose()}},k=new Ua(M);return A?.add(k),k.event}function m(O,A){return A instanceof Array?A.push(O):A&&A.add(O),O}function _(O,A,B=100,M=!1,k=!1,T,R){let $,K,L,q=0,H,ne={leakWarningThreshold:T,onWillAddFirstListener(){$=O(Se=>{q++,K=A(K,Se),M&&!L&&(oe.fire(K),K=void 0),H=()=>{let xe=K;K=void 0,L=void 0,(!M||q>1)&&oe.fire(xe),q=0},typeof B=="number"?(clearTimeout(L),L=setTimeout(H,B)):L===void 0&&(L=0,queueMicrotask(H))})},onWillRemoveListener(){k&&q>0&&H?.()},onDidRemoveLastListener(){H=void 0,$.dispose()}},oe=new Ua(ne);return R?.add(oe),oe.event}e.debounce=_;function b(O,A=0,B){return e.debounce(O,(M,k)=>M?(M.push(k),M):[k],A,void 0,!0,void 0,B)}e.accumulate=b;function S(O,A=(M,k)=>M===k,B){let M=!0,k;return o(O,T=>{let R=M||!A(T,k);return M=!1,k=T,R},B)}e.latch=S;function w(O,A,B){return[e.filter(O,A,B),e.filter(O,M=>!A(M),B)]}e.split=w;function x(O,A=!1,B=[],M){let k=B.slice(),T=O(K=>{k?k.push(K):$.fire(K)});M&&M.add(T);let R=()=>{k?.forEach(K=>$.fire(K)),k=null},$=new Ua({onWillAddFirstListener(){T||(T=O(K=>$.fire(K)),M&&M.add(T))},onDidAddFirstListener(){k&&(A?setTimeout(R):R())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return M&&M.add($),$.event}e.buffer=x;function C(O,A){return(B,M,k)=>{let T=A(new z);return O(function(R){let $=T.evaluate(R);$!==D&&B.call(M,$)},void 0,k)}}e.chain=C;let D=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(B=>(A(B),B)),this}filter(A){return this.steps.push(B=>A(B)?B:D),this}reduce(A,B){let M=B;return this.steps.push(k=>(M=A(M,k),M)),this}latch(A=(B,M)=>B===M){let B=!0,M;return this.steps.push(k=>{let T=B||!A(k,M);return B=!1,M=k,T?k:D}),this}evaluate(A){for(let B of this.steps)if(A=B(A),A===D)break;return A}}function F(O,A,B=M=>M){let M=(...$)=>R.fire(B(...$)),k=()=>O.on(A,M),T=()=>O.removeListener(A,M),R=new Ua({onWillAddFirstListener:k,onDidRemoveLastListener:T});return R.event}e.fromNodeEventEmitter=F;function N(O,A,B=M=>M){let M=(...$)=>R.fire(B(...$)),k=()=>O.addEventListener(A,M),T=()=>O.removeEventListener(A,M),R=new Ua({onWillAddFirstListener:k,onDidRemoveLastListener:T});return R.event}e.fromDOMEventEmitter=N;function I(O){return new Promise(A=>n(O)(A))}e.toPromise=I;function j(O){let A=new Ua;return O.then(B=>{A.fire(B)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=j;function U(O,A){return O(B=>A.fire(B))}e.forward=U;function G(O,A,B){return A(B),O(M=>A(M))}e.runAndSubscribe=G;class W{constructor(A,B){this._observable=A,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new Ua(M),B&&B.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,B){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(O,A){return new W(O,A).emitter.event}e.fromObservable=Z;function V(O){return(A,B,M)=>{let k=0,T=!1,R={beginUpdate(){k++},endUpdate(){k--,k===0&&(O.reportChanges(),T&&(T=!1,A.call(B)))},handlePossibleChange(){},handleChange(){T=!0}};O.addObserver(R),O.reportChanges();let $={dispose(){O.removeObserver(R)}};return M instanceof J0?M.add($):Array.isArray(M)&&M.push($),$}}e.fromObservableLight=V})(eP||={});var Dy=class Iy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Iy._idPool++}`,Iy.all.add(this)}start(t){this._stopWatch=new QB,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}}};Dy.all=new Set,Dy._idPool=0;var tP=Dy,nP=-1,tR=class nR{constructor(t,n,i=(nR._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(o);let p=new rP(h,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};tR._idPool=1;var iP=tR,sP=class iR{constructor(t){this.value=t}static create(){let t=new Error;return new iR(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},rP=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},aP=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},oP=0,F_=class{constructor(t){this.value=t,this.id=oP++}},lP=2,cP,Ua=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new iP(t?.onListenerError??H_,this._options?.leakWarningThreshold??nP):void 0,this._perfMon=this._options?._profName?new tP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new aP(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||H_)(f),Sp.None}if(this._disposed)return Sp.None;n&&(t=t.bind(n));let r=new F_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=sP.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof F_?(this._deliveryQueue??=new uP,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=ZA(()=>{o?.(),this._removeListener(r)});return i instanceof J0?i.add(u):Array.isArray(i)&&i.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*lP<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||H_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof F_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},uP=class{constructor(){this.i=-1,this.end=0}enqueue(t,n,i){this.i=0,this.end=i,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wp=class Hf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ua,this.onChange=this._onChange.event;let t=new WB;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return n+this.wcwidth(u);let f=t.charCodeAt(o);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let h=this.charProperties(u,i),p=Hf.extractWidth(h);Hf.extractShouldJoin(h)&&(p-=Hf.extractWidth(i)),n+=p,i=h}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},U_=[[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]],dP=[[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]],W_=[[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]],hP=[[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]],Gr;function Ak(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var fP=class{constructor(){if(this.version="11",!Gr){Gr=new Uint8Array(65536),Gr.fill(1),Gr[0]=0,Gr.fill(0,1,32),Gr.fill(0,127,160);for(let t=0;t<U_.length;++t)Gr.fill(0,U_[t][0],U_[t][1]+1);for(let t=0;t<W_.length;++t)Gr.fill(2,W_[t][0],W_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Gr[t]:Ak(t,dP)?0:Ak(t,hP)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=wp.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return wp.createPropertyValue(0,i,r)}},pP=class{activate(t){t.unicode.register(new fP)}dispose(){}};var mP=(e,t,n,i)=>{for(var r=t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(r=u(r)||r);return r},gP=(e,t)=>(n,i)=>t(n,i,e),_P=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Rk.isErrorNoTelemetry(e)?new Rk(e.message+`
18
+
19
+ `+e.stack):new Error(e.message+`
20
+
21
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},vP=new _P;function q_(e){yP(e)||vP.onUnexpectedError(e)}var By="Canceled";function yP(e){return e instanceof bP?!0:e instanceof Error&&e.name===By&&e.message===By}var bP=class extends Error{constructor(){super(By),this.name=this.message}},Rk=class Py extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Py)return t;let n=new Py;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},SP;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(SP||={});function wP(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var sR;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(N){yield N}e.single=r;function o(N){return t(N)?N:r(N)}e.wrap=o;function u(N){return N||n}e.from=u;function*h(N){for(let I=N.length-1;I>=0;I--)yield N[I]}e.reverse=h;function p(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(N){return N[Symbol.iterator]().next().value}e.first=f;function m(N,I){let j=0;for(let U of N)if(I(U,j++))return!0;return!1}e.some=m;function _(N,I){for(let j of N)if(I(j))return j}e.find=_;function*b(N,I){for(let j of N)I(j)&&(yield j)}e.filter=b;function*S(N,I){let j=0;for(let U of N)yield I(U,j++)}e.map=S;function*w(N,I){let j=0;for(let U of N)yield*I(U,j++)}e.flatMap=w;function*x(...N){for(let I of N)yield*I}e.concat=x;function C(N,I,j){let U=j;for(let G of N)U=I(U,G);return U}e.reduce=C;function*D(N,I,j=N.length){for(I<0&&(I+=N.length),j<0?j+=N.length:j>N.length&&(j=N.length);I<j;I++)yield N[I]}e.slice=D;function z(N,I=Number.POSITIVE_INFINITY){let j=[];if(I===0)return[j,N];let U=N[Symbol.iterator]();for(let G=0;G<I;G++){let W=U.next();if(W.done)return[j,e.empty()];j.push(W.value)}return[j,{[Symbol.iterator](){return U}}]}e.consume=z;async function F(N){let I=[];for await(let j of N)I.push(j);return Promise.resolve(I)}e.asyncToArray=F})(sR||={});function rR(e){if(sR.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function aR(...e){return Ri(()=>rR(e))}function Ri(e){return{dispose:wP(()=>{e()})}}var oR=class lR{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{rR(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?lR.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)}};oR.DISABLE_DISPOSED_WARNING=!1;var rc=oR,nr=class{constructor(){this._store=new rc,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)}};nr.None=Object.freeze({dispose(){}});var Tu=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}},Q0=typeof process<"u"&&"title"in process,om=Q0?"node":navigator.userAgent,xP=Q0?"node":navigator.platform,CP=om.includes("Firefox"),kP=om.includes("Edge"),cR=/^((?!chrome|android).)*safari/i.test(om);function EP(){if(!cR)return 0;let e=om.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}xP.indexOf("Linux")>=0;var TP="",oi=0,li=0,ci=0,jn=0,Ls={css:"#00000000",rgba:0},Ii;(e=>{function t(r,o,u,h){return h!==void 0?`#${Ao(r)}${Ao(o)}${Ao(u)}${Ao(h)}`:`#${Ao(r)}${Ao(o)}${Ao(u)}`}e.toCss=t;function n(r,o,u,h=255){return(r<<24|o<<16|u<<8|h)>>>0}e.toRgba=n;function i(r,o,u,h){return{css:e.toCss(r,o,u,h),rgba:e.toRgba(r,o,u,h)}}e.toColor=i})(Ii||={});var Zu;(e=>{function t(p,f){if(jn=(f.rgba&255)/255,jn===1)return{css:f.css,rgba:f.rgba};let m=f.rgba>>24&255,_=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;oi=S+Math.round((m-S)*jn),li=w+Math.round((_-w)*jn),ci=x+Math.round((b-x)*jn);let C=Ii.toCss(oi,li,ci),D=Ii.toRgba(oi,li,ci);return{css:C,rgba:D}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,m){let _=Wo.ensureContrastRatio(p.rgba,f.rgba,m);if(_)return Ii.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[oi,li,ci]=Wo.toChannels(f),{css:Ii.toCss(oi,li,ci),rgba:f}}e.opaque=r;function o(p,f){return jn=Math.round(f*255),[oi,li,ci]=Wo.toChannels(p.rgba),{css:Ii.toCss(oi,li,ci,jn),rgba:Ii.toRgba(oi,li,ci,jn)}}e.opacity=o;function u(p,f){return jn=p.rgba&255,o(p,jn*f/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Zu||={});var AP;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return oi=parseInt(r.slice(1,2).repeat(2),16),li=parseInt(r.slice(2,3).repeat(2),16),ci=parseInt(r.slice(3,4).repeat(2),16),Ii.toColor(oi,li,ci);case 5:return oi=parseInt(r.slice(1,2).repeat(2),16),li=parseInt(r.slice(2,3).repeat(2),16),ci=parseInt(r.slice(3,4).repeat(2),16),jn=parseInt(r.slice(4,5).repeat(2),16),Ii.toColor(oi,li,ci,jn);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return oi=parseInt(o[1]),li=parseInt(o[2]),ci=parseInt(o[3]),jn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Ii.toColor(oi,li,ci,jn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[oi,li,ci,jn]=t.getImageData(0,0,1,1).data,jn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ii.toRgba(oi,li,ci,jn),css:r}}e.toColor=i})(AP||={});var ji;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let u=i/255,h=r/255,p=o/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+m*.7152+_*.0722}e.relativeLuminance2=n})(ji||={});var Wo;(e=>{function t(u,h){if(jn=(h&255)/255,jn===1)return h;let p=h>>24&255,f=h>>16&255,m=h>>8&255,_=u>>24&255,b=u>>16&255,S=u>>8&255;return oi=_+Math.round((p-_)*jn),li=b+Math.round((f-b)*jn),ci=S+Math.round((m-S)*jn),Ii.toRgba(oi,li,ci)}e.blend=t;function n(u,h,p){let f=ji.relativeLuminance(u>>8),m=ji.relativeLuminance(h>>8);if(Kr(f,m)<p){if(m<f){let S=i(u,h,p),w=Kr(f,ji.relativeLuminance(S>>8));if(w<p){let x=r(u,h,p),C=Kr(f,ji.relativeLuminance(x>>8));return w>C?S:x}return S}let _=r(u,h,p),b=Kr(f,ji.relativeLuminance(_>>8));if(b<p){let S=i(u,h,p),w=Kr(f,ji.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(u,h,p){let f=u>>24&255,m=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,x=Kr(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,m,_));for(;x<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Kr(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(u,h,p){let f=u>>24&255,m=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,x=Kr(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,m,_));for(;x<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Kr(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(Wo||={});function Ao(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Kr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function qn(e){if(!e)throw new Error("value must not be falsy");return e}function e1(e){return 57508<=e&&e<=57558}function RP(e){return 57520<=e&&e<=57527}function NP(e){return 57344<=e&&e<=63743}function LP(e){return 9472<=e&&e<=9631}function MP(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 jP(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!MP(e)&&!e1(e)&&!NP(e)}function uR(e){return e1(e)||LP(e)}function OP(){return{css:{canvas:rf(),cell:rf()},device:{canvas:rf(),cell:rf(),char:{width:0,height:0,left:0,top:0}}}}function rf(){return{width:0,height:0}}function DP(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var bi=0,ri=0,ur=!1,Vr=!1,af=!1,Xi,G_=0,IP=class{constructor(e,t,n,i,r,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=i,this._coreBrowserService=r,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,ri=0,bi=0,Vr=!1,ur=!1,af=!1,Xi=this._themeService.colors,G_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));G_=t*i%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",r=>{r.backgroundColorRGB&&(ri=r.backgroundColorRGB.rgba>>8&16777215,Vr=!0),r.foregroundColorRGB&&(bi=r.foregroundColorRGB.rgba>>8&16777215,ur=!0)}),af=this._selectionRenderModel.isCellSelected(this._terminal,t,n),af){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ri=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ri=(this.result.fg&16777215)<<8|255;break;default:ri=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ri=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ri=(this.result.bg&16777215)<<8|255;break}ri=Wo.blend(ri,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ri=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Vr=!0,Xi.selectionForeground&&(bi=Xi.selectionForeground.rgba>>8&16777215,ur=!0),uR(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)bi=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:bi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:bi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:bi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:bi=(this.result.fg&16777215)<<8|255;break;default:bi=this._themeService.colors.foreground.rgba}bi=Wo.blend(bi,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ur=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(ri=r.backgroundColorRGB.rgba>>8&16777215,Vr=!0),r.foregroundColorRGB&&(bi=r.foregroundColorRGB.rgba>>8&16777215,ur=!0)}),Vr&&(af?ri=e.bg&-16777216&-134217729|ri|50331648:ri=e.bg&-16777216|ri|50331648),ur&&(bi=e.fg&-16777216&-67108865|bi|50331648),this.result.fg&67108864&&(Vr&&!ur&&((this.result.bg&50331648)===0?bi=this.result.fg&-134217728|Xi.background.rgba>>8&16777215&16777215|50331648:bi=this.result.fg&-134217728|this.result.bg&67108863,ur=!0),!Vr&&ur&&((this.result.fg&50331648)===0?ri=this.result.bg&-67108864|Xi.foreground.rgba>>8&16777215&16777215|50331648:ri=this.result.bg&-67108864|this.result.fg&67108863,Vr=!0)),Xi=void 0,this.result.bg=Vr?ri:this.result.bg,this.result.fg=ur?bi:this.result.fg,this.result.ext&=536870911,this.result.ext|=G_<<29&3758096384}},BP=.5,dR=CP||kP?"bottom":"ideographic",PP={"▀":[{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}]},$P={"░":[[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]]},zP={"─":{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`}},bd={"":{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}};bd[""]=bd[""];bd[""]=bd[""];function HP(e,t,n,i,r,o,u,h){let p=PP[t];if(p)return FP(e,p,n,i,r,o),!0;let f=$P[t];if(f)return UP(e,f,n,i,r,o),!0;let m=zP[t];if(m)return WP(e,m,n,i,r,o,h),!0;let _=bd[t];return _?(qP(e,_,n,i,r,o,u,h),!0):!1}function FP(e,t,n,i,r,o){for(let u=0;u<t.length;u++){let h=t[u],p=r/8,f=o/8;e.fillRect(n+h.x*p,i+h.y*f,h.w*p,h.h*f)}}var Nk=new Map;function UP(e,t,n,i,r,o){let u=Nk.get(t);u||(u=new Map,Nk.set(t,u));let h=e.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let p=u.get(h);if(!p){let f=t[0].length,m=t.length,_=e.canvas.ownerDocument.createElement("canvas");_.width=f,_.height=m;let b=qn(_.getContext("2d")),S=new ImageData(f,m),w,x,C,D;if(h.startsWith("#"))w=parseInt(h.slice(1,3),16),x=parseInt(h.slice(3,5),16),C=parseInt(h.slice(5,7),16),D=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[w,x,C,D]=h.substring(5,h.length-1).split(",").map(z=>parseFloat(z));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let z=0;z<m;z++)for(let F=0;F<f;F++)S.data[(z*f+F)*4]=w,S.data[(z*f+F)*4+1]=x,S.data[(z*f+F)*4+2]=C,S.data[(z*f+F)*4+3]=t[z][F]*(D*255);b.putImageData(S,0,0),p=qn(e.createPattern(_,null)),u.set(h,p)}e.fillStyle=p,e.fillRect(n,i,r,o)}function WP(e,t,n,i,r,o,u){e.strokeStyle=e.fillStyle;for(let[h,p]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(h);let f;if(typeof p=="function"){let m=.15/o*r;f=p(.15,m)}else f=p;for(let m of f.split(" ")){let _=m[0],b=hR[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=m.substring(1).split(",");!S[0]||!S[1]||b(e,fR(S,r,o,n,i,!0,u))}e.stroke(),e.closePath()}}function qP(e,t,n,i,r,o,u,h){let p=new Path2D;p.rect(n,i,r,o),e.clip(p),e.beginPath();let f=u/12;e.lineWidth=h*f;for(let m of t.d.split(" ")){let _=m[0],b=hR[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=m.substring(1).split(",");!S[0]||!S[1]||b(e,fR(S,r,o,n,i,!1,h,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Lk(e,t,n=0){return Math.max(Math.min(e,t),n)}var hR={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 fR(e,t,n,i,r,o,u,h=0,p=0){let f=e.map(m=>parseFloat(m)||parseInt(m));if(f.length<2)throw new Error("Too few arguments for instruction");for(let m=0;m<f.length;m+=2)f[m]*=t-h*u-p*u,o&&f[m]!==0&&(f[m]=Lk(Math.round(f[m]+.5)-.5,t,0)),f[m]+=i+h*u;for(let m=1;m<f.length;m+=2)f[m]*=n,o&&f[m]!==0&&(f[m]=Lk(Math.round(f[m]+.5)-.5,n,0)),f[m]+=r;return f}var Mk=class{constructor(){this._data={}}set(t,n,i){this._data[t]||(this._data[t]={}),this._data[t][n]=i}get(t,n){return this._data[t]?this._data[t][n]:void 0}clear(){this._data={}}},jk=class{constructor(){this._data=new Mk}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new Mk),this._data.get(e,t).set(n,i,r)}get(e,t,n,i){return this._data.get(e,t)?.get(n,i)}clear(){this._data.clear()}},pR=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},GP=class extends pR{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let n=performance.now()+t;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},KP=class extends pR{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},VP=!Q0&&"requestIdleCallback"in window?KP:GP,Jl=class mR{constructor(){this.fg=0,this.bg=0,this.extended=new gR}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 mR;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}},gR=class _R{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new _R(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},YP=globalThis.performance&&typeof globalThis.performance.now=="function",XP=class vR{static create(t){return new vR(t)}constructor(t){this._now=YP&&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}},ea;(e=>{e.None=()=>nr.None;function t(O,A){return _(O,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(O){return(A,B=null,M)=>{let k=!1,T;return T=O(R=>{if(!k)return T?T.dispose():k=!0,A.call(B,R)},null,M),k&&T.dispose(),T}}e.once=n;function i(O,A,B){return f((M,k=null,T)=>O(R=>M.call(k,A(R)),null,T),B)}e.map=i;function r(O,A,B){return f((M,k=null,T)=>O(R=>{A(R),M.call(k,R)},null,T),B)}e.forEach=r;function o(O,A,B){return f((M,k=null,T)=>O(R=>A(R)&&M.call(k,R),null,T),B)}e.filter=o;function u(O){return O}e.signal=u;function h(...O){return(A,B=null,M)=>{let k=aR(...O.map(T=>T(R=>A.call(B,R))));return m(k,M)}}e.any=h;function p(O,A,B,M){let k=B;return i(O,T=>(k=A(k,T),k),M)}e.reduce=p;function f(O,A){let B,M={onWillAddFirstListener(){B=O(k.fire,k)},onDidRemoveLastListener(){B?.dispose()}},k=new yn(M);return A?.add(k),k.event}function m(O,A){return A instanceof Array?A.push(O):A&&A.add(O),O}function _(O,A,B=100,M=!1,k=!1,T,R){let $,K,L,q=0,H,ne={leakWarningThreshold:T,onWillAddFirstListener(){$=O(Se=>{q++,K=A(K,Se),M&&!L&&(oe.fire(K),K=void 0),H=()=>{let xe=K;K=void 0,L=void 0,(!M||q>1)&&oe.fire(xe),q=0},typeof B=="number"?(clearTimeout(L),L=setTimeout(H,B)):L===void 0&&(L=0,queueMicrotask(H))})},onWillRemoveListener(){k&&q>0&&H?.()},onDidRemoveLastListener(){H=void 0,$.dispose()}},oe=new yn(ne);return R?.add(oe),oe.event}e.debounce=_;function b(O,A=0,B){return e.debounce(O,(M,k)=>M?(M.push(k),M):[k],A,void 0,!0,void 0,B)}e.accumulate=b;function S(O,A=(M,k)=>M===k,B){let M=!0,k;return o(O,T=>{let R=M||!A(T,k);return M=!1,k=T,R},B)}e.latch=S;function w(O,A,B){return[e.filter(O,A,B),e.filter(O,M=>!A(M),B)]}e.split=w;function x(O,A=!1,B=[],M){let k=B.slice(),T=O(K=>{k?k.push(K):$.fire(K)});M&&M.add(T);let R=()=>{k?.forEach(K=>$.fire(K)),k=null},$=new yn({onWillAddFirstListener(){T||(T=O(K=>$.fire(K)),M&&M.add(T))},onDidAddFirstListener(){k&&(A?setTimeout(R):R())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return M&&M.add($),$.event}e.buffer=x;function C(O,A){return(B,M,k)=>{let T=A(new z);return O(function(R){let $=T.evaluate(R);$!==D&&B.call(M,$)},void 0,k)}}e.chain=C;let D=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(B=>(A(B),B)),this}filter(A){return this.steps.push(B=>A(B)?B:D),this}reduce(A,B){let M=B;return this.steps.push(k=>(M=A(M,k),M)),this}latch(A=(B,M)=>B===M){let B=!0,M;return this.steps.push(k=>{let T=B||!A(k,M);return B=!1,M=k,T?k:D}),this}evaluate(A){for(let B of this.steps)if(A=B(A),A===D)break;return A}}function F(O,A,B=M=>M){let M=(...$)=>R.fire(B(...$)),k=()=>O.on(A,M),T=()=>O.removeListener(A,M),R=new yn({onWillAddFirstListener:k,onDidRemoveLastListener:T});return R.event}e.fromNodeEventEmitter=F;function N(O,A,B=M=>M){let M=(...$)=>R.fire(B(...$)),k=()=>O.addEventListener(A,M),T=()=>O.removeEventListener(A,M),R=new yn({onWillAddFirstListener:k,onDidRemoveLastListener:T});return R.event}e.fromDOMEventEmitter=N;function I(O){return new Promise(A=>n(O)(A))}e.toPromise=I;function j(O){let A=new yn;return O.then(B=>{A.fire(B)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=j;function U(O,A){return O(B=>A.fire(B))}e.forward=U;function G(O,A,B){return A(B),O(M=>A(M))}e.runAndSubscribe=G;class W{constructor(A,B){this._observable=A,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new yn(M),B&&B.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,B){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(O,A){return new W(O,A).emitter.event}e.fromObservable=Z;function V(O){return(A,B,M)=>{let k=0,T=!1,R={beginUpdate(){k++},endUpdate(){k--,k===0&&(O.reportChanges(),T&&(T=!1,A.call(B)))},handlePossibleChange(){},handleChange(){T=!0}};O.addObserver(R),O.reportChanges();let $={dispose(){O.removeObserver(R)}};return M instanceof rc?M.add($):Array.isArray(M)&&M.push($),$}}e.fromObservableLight=V})(ea||={});var $y=class zy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${zy._idPool++}`,zy.all.add(this)}start(t){this._stopWatch=new XP,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}}};$y.all=new Set,$y._idPool=0;var ZP=$y,JP=-1,yR=class bR{constructor(t,n,i=(bR._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(o);let p=new t$(h,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};yR._idPool=1;var QP=yR,e$=class SR{constructor(t){this.value=t}static create(){let t=new Error;return new SR(t.stack??"")}print(){console.warn(this.value.split(`
22
+ `).slice(2).join(`
23
+ `))}},t$=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},n$=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},i$=0,K_=class{constructor(t){this.value=t,this.id=i$++}},s$=2,r$,yn=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new QP(t?.onListenerError??q_,this._options?.leakWarningThreshold??JP):void 0,this._perfMon=this._options?._profName?new ZP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new n$(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||q_)(f),nr.None}if(this._disposed)return nr.None;n&&(t=t.bind(n));let r=new K_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=e$.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof K_?(this._deliveryQueue??=new a$,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=Ri(()=>{o?.(),this._removeListener(r)});return i instanceof rc?i.add(u):Array.isArray(i)&&i.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*s$<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||q_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof K_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},a$=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ok={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}},Au=2,Ru,Wa=class Ul{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new jk,this._cacheMapCombined=new jk,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Jl,this._textureSize=512,this._onAddTextureAtlasCanvas=new yn,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new yn,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=wR(t,this._config.deviceCellWidth*4+Au*2,this._config.deviceCellHeight+Au*2),this._tmpCtx=qn(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 VP;for(let n=33;n<126;n++)t.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let i=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ul.maxAtlasPages&&this._pages.length>=Math.max(4,Ul.maxAtlasPages)){let n=this._pages.filter(f=>f.canvas.width*2<=(Ul.maxTextureSize||4096)).sort((f,m)=>m.canvas.width!==f.canvas.width?m.canvas.width-f.canvas.width:m.percentageUsed-f.percentageUsed),i=-1,r=0;for(let f=0;f<n.length;f++)if(n[f].canvas.width!==r)i=f,r=n[f].canvas.width;else if(f-i===3)break;let o=n.slice(i,i+4),u=o.map(f=>f.glyphs[0].texturePage).sort((f,m)=>f>m?1:-1),h=this.pages.length-o.length,p=this._mergePages(o,h);p.version++;for(let f=u.length-1;f>=0;f--)this._deletePage(u[f]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new V_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,n){let i=t[0].canvas.width*2,r=new V_(this._document,i,t);for(let[o,u]of t.entries()){let h=o*u.canvas.width%i,p=Math.floor(o/2)*u.canvas.height;r.ctx.drawImage(u.canvas,h,p);for(let m of u.glyphs)m.texturePage=n,m.sizeClipSpace.x=m.size.x/i,m.sizeClipSpace.y=m.size.y/i,m.texturePosition.x+=h,m.texturePosition.y+=p,m.texturePositionClipSpace.x=m.texturePosition.x/i,m.texturePositionClipSpace.y=m.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let f=this._activePages.indexOf(u);f!==-1&&this._activePages.splice(f,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let i=this._pages[n];for(let r of i.glyphs)r.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,n,i,r,o,u){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,r,o,u)}getRasterizedGlyph(t,n,i,r,o,u){return this._getFromCacheMap(this._cacheMap,t,n,i,r,o,u)}_getFromCacheMap(t,n,i,r,o,u,h){return Ru=t.get(n,i,r,o),Ru||(Ru=this._drawToCache(n,i,r,o,u,h),t.set(n,i,r,o,Ru)),Ru}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Ls;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let u=Jl.toColorRGB(n);o=Ii.toColor(u[0],u[1],u[2]);break;default:i?o=Zu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Zu.opaque(o)),o}_getForegroundColor(t,n,i,r,o,u,h,p,f,m){let _=this._getMinimumContrastColor(t,n,i,r,o,u,h,f,p,m);if(_)return _;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&u<8&&(u+=8),b=this._getColorFromAnsiIndex(u);break;case 50331648:let S=Jl.toColorRGB(u);b=Ii.toColor(S[0],S[1],S[2]);break;default:h?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=Zu.opaque(b)),p&&(b=Zu.multiplyOpacity(b,BP)),b}_resolveBackgroundRgba(t,n,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,n,i,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,n,i,r,o,u,h,p,f,m){if(this._config.minimumContrastRatio===1||m)return;let _=this._getContrastCache(f),b=_.getColor(t,r);if(b!==void 0)return b||void 0;let S=this._resolveBackgroundRgba(n,i,h),w=this._resolveForegroundRgba(o,u,h,p),x=Wo.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(f?2:1));if(!x){_.setColor(t,r,null);return}let C=Ii.toColor(x>>24&255,x>>16&255,x>>8&255);return _.setColor(t,r,C),C}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,r,o,u){let h=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+Au*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let f=Math.min(this._config.deviceCellHeight+Au*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return Ok;let m=!!this._workAttributeData.isBold(),_=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),C=!!this._workAttributeData.isOverline(),D=this._workAttributeData.getFgColor(),z=this._workAttributeData.getFgColorMode(),F=this._workAttributeData.getBgColor(),N=this._workAttributeData.getBgColorMode();if(_){let K=D;D=F,F=K;let L=z;z=N,N=L}let I=this._getBackgroundColor(N,F,_,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=I.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let j=m?this._config.fontWeightBold:this._config.fontWeight,U=S?"italic":"";this._tmpCtx.font=`${U} ${j} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=dR;let G=h.length===1&&e1(h.charCodeAt(0)),W=h.length===1&&RP(h.charCodeAt(0)),Z=this._getForegroundColor(n,N,F,i,z,D,_,b,m,uR(h.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;let V=W?0:Au*2,O=!1;this._config.customGlyphs!==!1&&(O=HP(this._tmpCtx,h,V,V,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let A=!G,B;if(typeof t=="number"?B=this._unicodeService.wcwidth(t):B=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let K=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),L=K%2===1?.5:0;if(this._tmpCtx.lineWidth=K,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())A=!1,this._tmpCtx.strokeStyle=`rgb(${Jl.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{A=!1;let xe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&xe<8&&(xe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(xe).css}this._tmpCtx.beginPath();let q=V,H=Math.ceil(V+this._config.deviceCharHeight)-L-(o?K*2:0),ne=H+K,oe=H+K*2,Se=this._workAttributeData.getUnderlineVariantOffset();for(let xe=0;xe<B;xe++){this._tmpCtx.save();let fe=q+xe*this._config.deviceCellWidth,De=q+(xe+1)*this._config.deviceCellWidth,rt=fe+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(fe,H),this._tmpCtx.lineTo(De,H),this._tmpCtx.moveTo(fe,oe),this._tmpCtx.lineTo(De,oe);break;case 3:let Ie=K<=1?oe:Math.ceil(V+this._config.deviceCharHeight-K/2)-L,Ce=K<=1?H:Math.ceil(V+this._config.deviceCharHeight+K/2)-L,Me=new Path2D;Me.rect(fe,H,this._config.deviceCellWidth,oe-H),this._tmpCtx.clip(Me),this._tmpCtx.moveTo(fe-this._config.deviceCellWidth/2,ne),this._tmpCtx.bezierCurveTo(fe-this._config.deviceCellWidth/2,Ce,fe,Ce,fe,ne),this._tmpCtx.bezierCurveTo(fe,Ie,rt,Ie,rt,ne),this._tmpCtx.bezierCurveTo(rt,Ce,De,Ce,De,ne),this._tmpCtx.bezierCurveTo(De,Ie,De+this._config.deviceCellWidth/2,Ie,De+this._config.deviceCellWidth/2,ne);break;case 4:let je=Se===0?0:Se>=K?K*2-Se:K-Se;Se>=K||je===0?(this._tmpCtx.setLineDash([Math.round(K),Math.round(K)]),this._tmpCtx.moveTo(fe+je,H),this._tmpCtx.lineTo(De,H)):(this._tmpCtx.setLineDash([Math.round(K),Math.round(K)]),this._tmpCtx.moveTo(fe,H),this._tmpCtx.lineTo(fe+je,H),this._tmpCtx.moveTo(fe+je+K,H),this._tmpCtx.lineTo(De,H)),Se=DP(De-fe,K,Se);break;case 5:let ze=.6,bt=.3,pt=De-fe,vt=Math.floor(ze*pt),lt=Math.floor(bt*pt),de=pt-vt-lt;this._tmpCtx.setLineDash([vt,lt,de]),this._tmpCtx.moveTo(fe,H),this._tmpCtx.lineTo(De,H);break;default:this._tmpCtx.moveTo(fe,H),this._tmpCtx.lineTo(De,H);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!O&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let xe=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in xe&&xe.actualBoundingBoxDescent>0){this._tmpCtx.save();let fe=new Path2D;fe.rect(q,H-Math.ceil(K/2),this._config.deviceCellWidth*B,oe-H+Math.ceil(K/2)),this._tmpCtx.clip(fe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=I.css,this._tmpCtx.strokeText(h,V,V+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(C){let K=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),L=K%2===1?.5:0;this._tmpCtx.lineWidth=K,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+L),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*B,V+L),this._tmpCtx.stroke()}if(O||this._tmpCtx.fillText(h,V,V+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let K=Y_(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),I,Z,A);if(K)for(let L=1;L<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=I.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,V,V+this._config.deviceCharHeight-L),K=Y_(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),I,Z,A),!!K);L++);}if(x){let K=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),L=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=K,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+Math.floor(this._config.deviceCharHeight/2)-L),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*B,V+Math.floor(this._config.deviceCharHeight/2)-L),this._tmpCtx.stroke()}this._tmpCtx.restore();let M=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),k;if(this._config.allowTransparency?k=o$(M):k=Y_(M,I,Z,A),k)return Ok;let T=this._findGlyphBoundingBox(M,this._workBoundingBox,p,W,O,V),R,$;for(;;){if(this._activePages.length===0){let K=this._createNewPage();R=K,$=K.currentRow,$.height=T.size.y;break}R=this._activePages[this._activePages.length-1],$=R.currentRow;for(let K of this._activePages)T.size.y<=K.currentRow.height&&(R=K,$=K.currentRow);for(let K=this._activePages.length-1;K>=0;K--)for(let L of this._activePages[K].fixedRows)L.height<=$.height&&T.size.y<=L.height&&(R=this._activePages[K],$=L);if(T.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new V_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),R=this._overflowSizePage,$=this._overflowSizePage.currentRow,$.x+T.size.x>=R.canvas.width&&($.x=0,$.y+=$.height,$.height=0);break}if($.y+T.size.y>=R.canvas.height||$.height>T.size.y+2){let K=!1;if(R.currentRow.y+R.currentRow.height+T.size.y>=R.canvas.height){let L;for(let q of this._activePages)if(q.currentRow.y+q.currentRow.height+T.size.y<q.canvas.height){L=q;break}if(L)R=L;else if(Ul.maxAtlasPages&&this._pages.length>=Ul.maxAtlasPages&&$.y+T.size.y<=R.canvas.height&&$.height>=T.size.y&&$.x+T.size.x<=R.canvas.width)K=!0;else{let q=this._createNewPage();R=q,$=q.currentRow,$.height=T.size.y,K=!0}}K||(R.currentRow.height>0&&R.fixedRows.push(R.currentRow),$={x:0,y:R.currentRow.y+R.currentRow.height,height:T.size.y},R.fixedRows.push($),R.currentRow={x:0,y:$.y+$.height,height:0})}if($.x+T.size.x<=R.canvas.width)break;$===R.currentRow?($.x=0,$.y+=$.height,$.height=0):R.fixedRows.splice(R.fixedRows.indexOf($),1)}return T.texturePage=this._pages.indexOf(R),T.texturePosition.x=$.x,T.texturePosition.y=$.y,T.texturePositionClipSpace.x=$.x/R.canvas.width,T.texturePositionClipSpace.y=$.y/R.canvas.height,T.sizeClipSpace.x/=R.canvas.width,T.sizeClipSpace.y/=R.canvas.height,$.height=Math.max($.height,T.size.y),$.x+=T.size.x,R.ctx.putImageData(M,T.texturePosition.x-this._workBoundingBox.left,T.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,T.size.x,T.size.y),R.addGlyph(T),R.version++,T}_findGlyphBoundingBox(t,n,i,r,o,u){n.top=0;let h=r?this._config.deviceCellHeight:this._tmpCanvas.height,p=r?this._config.deviceCellWidth:i,f=!1;for(let m=0;m<h;m++){for(let _=0;_<p;_++){let b=m*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.top=m,f=!0;break}}if(f)break}n.left=0,f=!1;for(let m=0;m<u+p;m++){for(let _=0;_<h;_++){let b=_*this._tmpCanvas.width*4+m*4+3;if(t.data[b]!==0){n.left=m,f=!0;break}}if(f)break}n.right=p,f=!1;for(let m=u+p-1;m>=u;m--){for(let _=0;_<h;_++){let b=_*this._tmpCanvas.width*4+m*4+3;if(t.data[b]!==0){n.right=m,f=!0;break}}if(f)break}n.bottom=h,f=!1;for(let m=h-1;m>=0;m--){for(let _=0;_<p;_++){let b=m*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.bottom=m,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+u+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+u+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},V_=class{constructor(t,n,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=wR(t,n,n),this.ctx=qn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Y_(e,t,n,i){let r=t.rgba>>>24,o=t.rgba>>>16&255,u=t.rgba>>>8&255,h=n.rgba>>>24,p=n.rgba>>>16&255,f=n.rgba>>>8&255,m=Math.floor((Math.abs(r-h)+Math.abs(o-p)+Math.abs(u-f))/12),_=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===r&&e.data[b+1]===o&&e.data[b+2]===u||i&&Math.abs(e.data[b]-r)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-u)<m?e.data[b+3]=0:_=!1;return _}function o$(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function wR(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function l$(e,t,n,i,r,o,u,h){let p={foreground:o.foreground,background:o.background,cursor:Ls,cursorAccent:Ls,selectionForeground:Ls,selectionBackgroundTransparent:Ls,selectionBackgroundOpaque:Ls,selectionInactiveBackgroundTransparent:Ls,selectionInactiveBackgroundOpaque:Ls,overviewRulerBorder:Ls,scrollbarSliderBackground:Ls,scrollbarSliderHoverBackground:Ls,scrollbarSliderActiveBackground:Ls,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:h,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:p}}function Dk(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function c$(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Is=[];function xR(e,t,n,i,r,o,u,h,p){let f=l$(i,r,o,u,t,n,h,p);for(let b=0;b<Is.length;b++){let S=Is[b],w=S.ownedBy.indexOf(e);if(w>=0){if(Dk(S.config,f))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Is.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<Is.length;b++){let S=Is[b];if(Dk(S.config,f))return S.ownedBy.push(e),S.atlas}let m=e._core,_={atlas:new Wa(document,f,m.unicodeService),config:f,ownedBy:[e]};return Is.push(_),_.atlas}function Ik(e){for(let t=0;t<Is.length;t++){let n=Is[t].ownedBy.indexOf(e);if(n!==-1){Is[t].ownedBy.length===1?(Is[t].atlas.dispose(),Is.splice(t,1)):Is[t].ownedBy.splice(n,1);break}}}var of=600,u$=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=of){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=of-(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=of-(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})},of)},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 Bk(e,t,n){let i=new t.ResizeObserver(r=>{let o=r.find(p=>p.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let u=o.devicePixelContentBoxSize[0].inlineSize,h=o.devicePixelContentBoxSize[0].blockSize;u>0&&h>0&&n(u,h)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ri(()=>i?.disconnect())}function d$(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Pk=class CR extends Jl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new gR,this.combinedData=""}static fromCharData(t){let n=new CR;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?d$(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},kR=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function ER(e,t,n){let i=qn(e.createProgram());if(e.attachShader(i,qn($k(e,e.VERTEX_SHADER,t))),e.attachShader(i,qn($k(e,e.FRAGMENT_SHADER,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function $k(e,t,n){let i=qn(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function h$(e,t){let n=Math.min(e.length*2,t),i=new Float32Array(n);for(let r=0;r<e.length;r++)i[r]=e[r];return i}var f$=class{constructor(t){this.texture=t,this.version=-1}},p$=`#version 300 es
24
+ layout (location = 0) in vec2 a_unitquad;
25
+ layout (location = 1) in vec2 a_cellpos;
26
+ layout (location = 2) in vec2 a_offset;
27
+ layout (location = 3) in vec2 a_size;
28
+ layout (location = 4) in float a_texpage;
29
+ layout (location = 5) in vec2 a_texcoord;
30
+ layout (location = 6) in vec2 a_texsize;
31
+
32
+ uniform mat4 u_projection;
33
+ uniform vec2 u_resolution;
34
+
35
+ out vec2 v_texcoord;
36
+ flat out int v_texpage;
37
+
38
+ void main() {
39
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
40
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
41
+ v_texpage = int(a_texpage);
42
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
43
+ }`;function m$(e){let t="";for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
44
+ precision lowp float;
45
+
46
+ in vec2 v_texcoord;
47
+ flat in int v_texpage;
48
+
49
+ uniform sampler2D u_texture[${e}];
50
+
51
+ out vec4 outColor;
52
+
53
+ void main() {
54
+ if (v_texpage == 0) {
55
+ outColor = texture(u_texture[0], v_texcoord);
56
+ } ${t}
57
+ }`}var qa=11,Ol=qa*Float32Array.BYTES_PER_ELEMENT,g$=2,Nn=0,_n,X_=0,Nu=0,_$=class extends nr{constructor(t,n,i,r){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;Wa.maxAtlasPages===void 0&&(Wa.maxAtlasPages=Math.min(32,qn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Wa.maxTextureSize=qn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=qn(ER(o,p$,m$(Wa.maxAtlasPages))),this._register(Ri(()=>o.deleteProgram(this._program))),this._projectionLocation=qn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=qn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=qn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),h=o.createBuffer();this._register(Ri(()=>o.deleteBuffer(h))),o.bindBuffer(o.ARRAY_BUFFER,h),o.bufferData(o.ARRAY_BUFFER,u,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let p=new Uint8Array([0,1,2,3]),f=o.createBuffer();this._register(Ri(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,p,o.STATIC_DRAW),this._attributesBuffer=qn(o.createBuffer()),this._register(Ri(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Ol,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Ol,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Ol,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Ol,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Ol,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Ol,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let m=new Int32Array(Wa.maxAtlasPages);for(let _=0;_<Wa.maxAtlasPages;_++)m[_]=_;o.uniform1iv(this._textureLocation,m),o.uniformMatrix4fv(this._projectionLocation,!1,kR),this._atlasTextures=[];for(let _=0;_<Wa.maxAtlasPages;_++){let b=new f$(qn(o.createTexture()));this._register(Ri(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+_),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,i,r,o,u,h,p,f){this._updateCell(this._vertices.attributes,t,n,i,r,o,u,h,p,f)}_updateCell(t,n,i,r,o,u,h,p,f,m){if(Nn=(i*this._terminal.cols+n)*qa,r===0||r===void 0){t.fill(0,Nn,Nn+qa-1-g$);return}this._atlas&&(p&&p.length>1?_n=this._atlas.getRasterizedGlyphCombinedChar(p,o,u,h,!1,this._terminal.element):_n=this._atlas.getRasterizedGlyph(r,o,u,h,!1,this._terminal.element),X_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==m&&_n.offset.x>X_?(Nu=_n.offset.x-X_,t[Nn]=-(_n.offset.x-Nu)+this._dimensions.device.char.left,t[Nn+1]=-_n.offset.y+this._dimensions.device.char.top,t[Nn+2]=(_n.size.x-Nu)/this._dimensions.device.canvas.width,t[Nn+3]=_n.size.y/this._dimensions.device.canvas.height,t[Nn+4]=_n.texturePage,t[Nn+5]=_n.texturePositionClipSpace.x+Nu/this._atlas.pages[_n.texturePage].canvas.width,t[Nn+6]=_n.texturePositionClipSpace.y,t[Nn+7]=_n.sizeClipSpace.x-Nu/this._atlas.pages[_n.texturePage].canvas.width,t[Nn+8]=_n.sizeClipSpace.y):(t[Nn]=-_n.offset.x+this._dimensions.device.char.left,t[Nn+1]=-_n.offset.y+this._dimensions.device.char.top,t[Nn+2]=_n.size.x/this._dimensions.device.canvas.width,t[Nn+3]=_n.size.y/this._dimensions.device.canvas.height,t[Nn+4]=_n.texturePage,t[Nn+5]=_n.texturePositionClipSpace.x,t[Nn+6]=_n.texturePositionClipSpace.y,t[Nn+7]=_n.sizeClipSpace.x,t[Nn+8]=_n.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&jP(r,f,_n.size.x,this._dimensions.device.cell.width)&&(t[Nn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*qa;this._vertices.count!==n?this._vertices.attributes=new Float32Array(n):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==n?this._vertices.attributesBuffers[i]=new Float32Array(n):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=n,i=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=qa}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let o=0;o<t.lineLengths.length;o++){let u=o*this._terminal.cols*qa,h=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*qa);i.set(h,r),r+=h.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,i.subarray(0,r),n.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(n,this._atlas,o);n.drawElementsInstanced(n.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,r/qa)}setAtlas(t){this._atlas=t;for(let n of this._atlasTextures)n.version=-1}_bindAtlasPageTexture(t,n,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=n.pages[i].version}setDimensions(t){this._dimensions=t}},v$=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,n,i,r=!1){if(this.selectionStart=n,this.selectionEnd=i,!n||!i||n[0]===i[0]&&n[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,u=n[1]-o,h=i[1]-o,p=Math.max(u,0),f=Math.min(h,t.rows-1);if(p>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=u,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=f,this.startCol=n[0],this.endCol=i[0]}isCellSelected(t,n,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&i>=this.viewportCappedStartRow&&n<this.endCol&&i<=this.viewportCappedEndRow:n<this.startCol&&i>=this.viewportCappedStartRow&&n>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol):!1}};function y$(){return new v$}var xp=4,Ff=1,Uf=2,Z_=3,b$=2147483648,S$=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=y$()}resize(t,n){let i=t*n*xp;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},w$=`#version 300 es
58
+ layout (location = 0) in vec2 a_position;
59
+ layout (location = 1) in vec2 a_size;
60
+ layout (location = 2) in vec4 a_color;
61
+ layout (location = 3) in vec2 a_unitquad;
62
+
63
+ uniform mat4 u_projection;
64
+
65
+ out vec4 v_color;
66
+
67
+ void main() {
68
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
69
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
70
+ v_color = a_color;
71
+ }`,x$=`#version 300 es
72
+ precision lowp float;
73
+
74
+ in vec4 v_color;
75
+
76
+ out vec4 outColor;
77
+
78
+ void main() {
79
+ outColor = v_color;
80
+ }`,Qr=8,J_=Qr*Float32Array.BYTES_PER_ELEMENT,C$=20*Qr,zk=class{constructor(){this.attributes=new Float32Array(C$),this.count=0}},Yr=0,Hk=0,Fk=0,Uk=0,Wk=0,qk=0,Gk=0,k$=class extends nr{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new zk,this._verticesCursor=new zk;let r=this._gl;this._program=qn(ER(r,w$,x$)),this._register(Ri(()=>r.deleteProgram(this._program))),this._projectionLocation=qn(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),u=r.createBuffer();this._register(Ri(()=>r.deleteBuffer(u))),r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,o,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),p=r.createBuffer();this._register(Ri(()=>r.deleteBuffer(p))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,p),r.bufferData(r.ELEMENT_ARRAY_BUFFER,h,r.STATIC_DRAW),this._attributesBuffer=qn(r.createBuffer()),this._register(Ri(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,J_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,J_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,J_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),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,kR),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,i=1,r,o,u,h,p,f,m,_,b,S,w;for(r=0;r<t.rows;r++){for(u=-1,h=0,p=0,f=!1,o=0;o<t.cols;o++)m=(r*t.cols+o)*xp,_=e.cells[m+Ff],b=e.cells[m+Uf],S=!!(b&67108864),(_!==h||b!==p&&(f||S))&&((h!==0||f&&p!==0)&&(w=i++*Qr,this._updateRectangle(n,w,p,h,u,o,r)),u=o,h=_,p=b,f=S);(h!==0||f&&p!==0)&&(w=i++*Qr,this._updateRectangle(n,w,p,h,u,t.cols,r))}n.count=i}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style==="block"){t.count=0;return}let i,r=0;(n.style==="bar"||n.style==="outline")&&(i=r++*Qr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=r++*Qr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=r++*Qr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=r++*Qr,this._addRectangleFloat(t.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,n,i,r,o,u){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Yr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Yr=(n&16777215)<<8;break;default:Yr=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Yr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Yr=(i&16777215)<<8;break;default:Yr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=h$(e.attributes,this._terminal.rows*this._terminal.cols*Qr)),Hk=r*this._dimensions.device.cell.width,Fk=u*this._dimensions.device.cell.height,Uk=(Yr>>24&255)/255,Wk=(Yr>>16&255)/255,qk=(Yr>>8&255)/255,Gk=1,this._addRectangle(e.attributes,t,Hk,Fk,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Uk,Wk,qk,Gk)}_addRectangle(e,t,n,i,r,o,u,h,p,f){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u,e[t+5]=h,e[t+6]=p,e[t+7]=f}_addRectangleFloat(e,t,n,i,r,o,u){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u[0],e[t+5]=u[1],e[t+6]=u[2],e[t+7]=u[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])}},E$=class extends nr{constructor(t,n,i,r,o,u,h,p){super(),this._container=n,this._alpha=o,this._coreBrowserService=u,this._optionsService=h,this._themeService=p,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(Ri(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=qn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,i){}handleSelectionChanged(t,n,i,r=!1){}_setTransparency(t,n){if(n===this._alpha)return;let i=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=xR(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,n,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=dR,this._clipCell(i,r,n.getWidth()),this._ctx.fillText(n.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,i){let r=n?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},T$=class extends E${constructor(t,n,i,r,o,u,h){super(i,t,"link",n,!0,o,u,h),this._register(r.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(r.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,n){super.resize(t,n),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&c$(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let n=t.y1+1;n<t.y2;n++)this._fillBottomLineAtCells(0,n,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Io=typeof window=="object"?window:globalThis,Hy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new yn,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new yn,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Hy.INSTANCE=new Hy;var TR=Hy;function A$(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}TR.INSTANCE.onDidChangeZoomLevel;TR.INSTANCE.onDidChangeFullscreen;var Rc=typeof navigator=="object"?navigator.userAgent:"";Rc.indexOf("Firefox")>=0;Rc.indexOf("AppleWebKit")>=0;var R$=Rc.indexOf("Chrome")>=0;!R$&&Rc.indexOf("Safari")>=0;Rc.indexOf("Electron/")>=0;Rc.indexOf("Android")>=0;var Q_=!1;if(typeof Io.matchMedia=="function"){let e=Io.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Io.matchMedia("(display-mode: fullscreen)");Q_=e.matches,A$(Io,e,({matches:n})=>{Q_&&t.matches||(Q_=n)})}var Ql="en",ev=!1,AR=!1,lf,Wf=Ql,Kk=Ql,N$,Zr,qo=globalThis,fs;typeof qo.vscode<"u"&&typeof qo.vscode.process<"u"?fs=qo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(fs=process);var L$=typeof fs?.versions?.electron=="string",M$=L$&&fs?.type==="renderer";if(typeof fs=="object"){fs.platform,fs.platform,ev=fs.platform==="linux",ev&&fs.env.SNAP&&fs.env.SNAP_REVISION,fs.env.CI||fs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lf=Ql,Wf=Ql;let e=fs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);lf=t.userLocale,Kk=t.osLocale,Wf=t.resolvedLanguage||Ql,N$=t.languagePack?.translationsConfigFile}catch{}AR=!0}else typeof navigator=="object"&&!M$?(Zr=navigator.userAgent,Zr.indexOf("Windows")>=0,Zr.indexOf("Macintosh")>=0,(Zr.indexOf("Macintosh")>=0||Zr.indexOf("iPad")>=0||Zr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ev=Zr.indexOf("Linux")>=0,Zr?.indexOf("Mobi")>=0,Wf=globalThis._VSCODE_NLS_LANGUAGE||Ql,lf=navigator.language.toLowerCase(),Kk=lf):console.error("Unable to resolve platform.");var Vk=AR,br=Zr,Pa=Wf,j$;(e=>{function t(){return Pa}e.value=t;function n(){return Pa.length===2?Pa==="en":Pa.length>=3?Pa[0]==="e"&&Pa[1]==="n"&&Pa[2]==="-":!1}e.isDefaultVariant=n;function i(){return Pa==="en"}e.isDefault=i})(j$||={});var O$=typeof qo.postMessage=="function"&&!qo.importScripts;(()=>{if(O$){let e=[];qo.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),qo.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var D$=!!(br&&br.indexOf("Chrome")>=0);br&&br.indexOf("Firefox")>=0;!D$&&br&&br.indexOf("Safari")>=0;br&&br.indexOf("Edg/")>=0;br&&br.indexOf("Android")>=0;var Dl=typeof navigator=="object"?navigator:{};Vk||document.queryCommandSupported&&document.queryCommandSupported("copy")||Dl&&Dl.clipboard&&Dl.clipboard.writeText,Vk||Dl&&Dl.clipboard&&Dl.clipboard.readText;var t1=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}},tv=new t1,Yk=new t1,Xk=new t1;new Array(230);var I$;(e=>{function t(h){return tv.keyCodeToStr(h)}e.toString=t;function n(h){return tv.strToKeyCode(h)}e.fromString=n;function i(h){return Yk.keyCodeToStr(h)}e.toUserSettingsUS=i;function r(h){return Xk.keyCodeToStr(h)}e.toUserSettingsGeneral=r;function o(h){return Yk.strToKeyCode(h)||Xk.strToKeyCode(h)}e.fromUserSettings=o;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return tv.keyCodeToStr(h)}e.toElectronAccelerator=u})(I$||={});var RR=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),B$;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof P$?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ea.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:RR})})(B$||={});var P$=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?RR:(this._emitter||(this._emitter=new yn),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},$$;(e=>{async function t(i){let r,o=await Promise.all(i.map(u=>u.then(h=>h,h=>{r||(r=h)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(u){o(u)}})}e.withAsyncBody=n})($$||={});var Zk=class Ms{static fromArray(t){return new Ms(n=>{n.emitMany(t)})}static fromPromise(t){return new Ms(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ms(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ms(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new yn,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ea.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ms(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ms.map(this,t)}static filter(t,n){return new Ms(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ms.filter(this,t)}static coalesce(t){return Ms.filter(t,n=>!!n)}coalesce(){return Ms.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ms.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Zk.EMPTY=Zk.fromArray([]);var{getWindow:z$}=(function(){let e=new Map,t={window:Io,disposables:new rc};e.set(Io.vscodeWindowId,t);let n=new yn,i=new yn,r=new yn;function o(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return nr.None;let h=new rc,p={window:u,disposables:h.add(new rc)};return e.set(u.vscodeWindowId,p),h.add(Ri(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),h.add(Fy(u,F$.BEFORE_UNLOAD,()=>{r.fire(u)})),n.fire(p),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let p=u;return p?.view?p.view.window:Io},getDocument(u){return z$(u).document}}})(),H$=class{constructor(t,n,i,r){this._node=t,this._type=n,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Fy(e,t,n,i){return new H$(e,t,n,i)}var F$={BEFORE_UNLOAD:"beforeunload"},U$=class extends nr{constructor(t,n,i,r,o,u,h,p,f){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=r,this._coreService=o,this._decorationService=u,this._optionsService=h,this._themeService=p,this._cursorBlinkStateManager=new Tu,this._charAtlasDisposable=this._register(new Tu),this._observerDisposable=this._register(new Tu),this._model=new S$,this._workCell=new Pk,this._workCell2=new Pk,this._rectangleRenderer=this._register(new Tu),this._glyphRenderer=this._register(new Tu),this._onChangeTextureAtlas=this._register(new yn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new yn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new yn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new yn),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new yn),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let m={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",m),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new IP(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new T$(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=OP(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Fy(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(Fy(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ik(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Bk(this._canvas,this._coreBrowserService.window,(_,b)=>this._setCanvasDevicePixelDimensions(_,b)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=Bk(this._canvas,_,(b,S)=>this._setCanvasDevicePixelDimensions(b,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ri(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),Ik(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,n,i);this._model.selection.update(this._core,t,n,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new k$(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _$(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=xR(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=aR(ea.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ea.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,n){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new u$(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,r=this._workCell,o,u,h,p,f,m,_=0,b=!0,S,w,x,C,D,z,F,N,I;t=Jk(t,i.rows-1,0),n=Jk(n,i.rows-1,0);let j=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",U=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,G=U-i.buffer.ydisp,W=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Z=-1,V=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let O=!1;for(u=t;u<=n;u++)for(h=u+i.buffer.ydisp,p=i.buffer.lines.get(h),this._model.lineLengths[u]=0,x=U===h,_=0,f=this._characterJoinerService.getJoinedCharacters(h),N=0;N<i.cols;N++){if(o=this._cellColorResolver.result.bg,p.loadCell(N,r),N===0&&(o=this._cellColorResolver.result.bg),m=!1,b=N>=_,S=N,f.length>0&&N===f[0][0]&&b){w=f.shift();let A=this._model.selection.isCellSelected(this._terminal,w[0],h);for(F=w[0]+1;F<w[1];F++)b&&=A===this._model.selection.isCellSelected(this._terminal,F,h);b&&=!x||W<w[0]||W>=w[1],b?(m=!0,r=new W$(r,p.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):_=w[1]}if(C=r.getChars(),D=r.getCode(),F=(u*i.cols+N)*xp,this._cellColorResolver.resolve(r,N,h,this.dimensions.device.cell.width),V&&h===U&&(N===W&&(this._model.cursor={x:W,y:G,width:r.getWidth(),style:this._coreBrowserService.isFocused?j:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Z=W+r.getWidth()-1),N>=W&&N<=Z&&(this._coreBrowserService.isFocused&&j==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),D!==0&&(this._model.lineLengths[u]=N+1),!(this._model.cells[F]===D&&this._model.cells[F+Ff]===this._cellColorResolver.result.bg&&this._model.cells[F+Uf]===this._cellColorResolver.result.fg&&this._model.cells[F+Z_]===this._cellColorResolver.result.ext)&&(O=!0,C.length>1&&(D|=b$),this._model.cells[F]=D,this._model.cells[F+Ff]=this._cellColorResolver.result.bg,this._model.cells[F+Uf]=this._cellColorResolver.result.fg,this._model.cells[F+Z_]=this._cellColorResolver.result.ext,z=r.getWidth(),this._glyphRenderer.value.updateCell(N,u,D,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,C,z,o),m)){for(r=this._workCell,N++;N<=S;N++)I=(u*i.cols+N)*xp,this._glyphRenderer.value.updateCell(N,u,0,0,0,0,TP,0,0),this._model.cells[I]=0,this._model.cells[I+Ff]=this._cellColorResolver.result.bg,this._model.cells[I+Uf]=this._cellColorResolver.result.fg,this._model.cells[I+Z_]=this._cellColorResolver.result.ext;N--}}O&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},W$=class extends Jl{constructor(t,n,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Jk(e,t,n=0){return Math.max(Math.min(e,t),n)}var Qk="di$target",eE="di$dependencies",nv=new Map;function Er(e){if(nv.has(e))return nv.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");q$(t,n,r)};return t._id=e,nv.set(e,t),t}function q$(e,t,n){t[Qk]===t?t[eE].push({id:e,index:n}):(t[eE]=[{id:e,index:n}],t[Qk]=t)}Er("BufferService");Er("CoreMouseService");Er("CoreService");Er("CharsetService");Er("InstantiationService");Er("LogService");var G$=Er("OptionsService");Er("OscLinkService");Er("UnicodeService");Er("DecorationService");var K$={trace:0,debug:1,info:2,warn:3,error:4,off:5},V$="xterm.js: ",tE=class extends nr{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=K$[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":V$)+n,...i)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};tE=mP([gP(0,G$)],tE);var Y$=class extends nr{constructor(t){if(cR&&EP()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new yn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new yn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new yn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new yn),this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=n.coreService,r=n.optionsService,o=n,u=o._renderService,h=o._characterJoinerService,p=o._charSizeService,f=o._coreBrowserService,m=o._decorationService;o._logService;let _=o._themeService;this._renderer=this._register(new U$(t,h,p,f,i,m,r,_,this._preserveDrawingBuffer)),this._register(ea.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ea.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ea.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ea.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(Ri(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var NR=Object.defineProperty,X$=Object.getOwnPropertyDescriptor,Z$=(e,t)=>{for(var n in t)NR(e,n,{get:t[n],enumerable:!0})},Dn=(e,t,n,i)=>{for(var r=i>1?void 0:i?X$(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(r=(i?u(t,n,r):u(r))||r);return i&&r&&NR(t,n,r),r},He=(e,t)=>(n,i)=>t(n,i,e),nE="Terminal input",Uy={get:()=>nE,set:e=>nE=e},iE="Too much output to announce, navigate to rows manually to read",Wy={get:()=>iE,set:e=>iE=e};function J$(e){return e.replace(/\r?\n/g,"\r")}function Q$(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function e9(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function t9(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");LR(r,t,n,i)}}function LR(e,t,n,i){e=J$(e),e=Q$(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function MR(e,t,n){let i=n.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function sE(e,t,n,i,r){MR(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Ka(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function lm(e,t=0,n=e.length){let i="";for(let r=t;r<n;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var n9=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<n;++o){let u=e.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=n)return this._interim=u,i;let h=e.charCodeAt(o);56320<=h&&h<=57343?t[i++]=(u-55296)*1024+h-56320+65536:(t[i++]=u,t[i++]=h);continue}u!==65279&&(t[i++]=u)}return i}},i9=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r,o,u,h,p=0,f=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,x;for(;(x=this.interim[++w]&63)&&w<4;)S<<=6,S|=x;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=C-w;for(;f<D;){if(f>=n)return 0;if(x=e[f++],(x&192)!==128){f--,b=!0;break}else this.interim[w++]=x,S<<=6,S|=x&63}b||(C===2?S<128?f--:t[i++]=S:C===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let m=n-4,_=f;for(;_<n;){for(;_<m&&!((r=e[_])&128)&&!((o=e[_+1])&128)&&!((u=e[_+2])&128)&&!((h=e[_+3])&128);)t[i++]=r,t[i++]=o,t[i++]=u,t[i++]=h,_+=4;if(r=e[_++],r<128)t[i++]=r;else if((r&224)===192){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(r&31)<<6|o&63,p<128){_--;continue}t[i++]=p}else if((r&240)===224){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(u=e[_++],(u&192)!==128){_--;continue}if(p=(r&15)<<12|(o&63)<<6|u&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[i++]=p}else if((r&248)===240){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(u=e[_++],(u&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=u,i;if(h=e[_++],(h&192)!==128){_--;continue}if(p=(r&7)<<18|(o&63)<<12|(u&63)<<6|h&63,p<65536||p>1114111)continue;t[i++]=p}}return i}},jR="",Za=" ",Id=class OR{constructor(){this.fg=0,this.bg=0,this.extended=new Cp}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 OR;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}},Cp=class DR{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new DR(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},$s=class IR extends Id{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Cp,this.combinedData=""}static fromCharData(t){let n=new IR;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ka(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},rE="di$target",qy="di$dependencies",iv=new Map;function s9(e){return e[qy]||[]}function mi(e){if(iv.has(e))return iv.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r9(t,n,r)};return t._id=e,iv.set(e,t),t}function r9(e,t,n){t[rE]===t?t[qy].push({id:e,index:n}):(t[qy]=[{id:e,index:n}],t[rE]=t)}var Hi=mi("BufferService"),BR=mi("CoreMouseService"),tl=mi("CoreService"),a9=mi("CharsetService"),n1=mi("InstantiationService"),PR=mi("LogService"),Fi=mi("OptionsService"),$R=mi("OscLinkService"),o9=mi("UnicodeService"),Bd=mi("DecorationService"),Gy=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new $s,u=n.getTrimmedLength(),h=-1,p=-1,f=!1;for(let m=0;m<u;m++)if(!(p===-1&&!n.hasContent(m))){if(n.loadCell(m,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=m,h=o.extended.urlId;continue}else f=o.extended.urlId!==h;else p!==-1&&(f=!0);if(f||p!==-1&&m===u-1){let _=this._oscLinkService.getLinkData(h)?.uri;if(_){let b={start:{x:p+1,y:e},end:{x:m+(!f&&m===u-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(_);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:_,range:b,activate:(w,x)=>r?r.activate(w,x,b):l9(w,x),hover:(w,x)=>r?.hover?.(w,x,b),leave:(w,x)=>r?.leave?.(w,x,b)})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=m,h=o.extended.urlId):(p=-1,h=-1)}}t(i)}};Gy=Dn([He(0,Hi),He(1,Fi),He(2,$R)],Gy);function l9(e,t){if(confirm(`Do you want to navigate to ${t}?
81
+
82
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var cm=mi("CharSizeService"),oa=mi("CoreBrowserService"),i1=mi("MouseService"),la=mi("RenderService"),c9=mi("SelectionService"),zR=mi("CharacterJoinerService"),Nc=mi("ThemeService"),HR=mi("LinkProviderService"),u9=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?aE.isErrorNoTelemetry(e)?new aE(e.message+`
83
+
84
+ `+e.stack):new Error(e.message+`
85
+
86
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},d9=new u9;function qf(e){h9(e)||d9.onUnexpectedError(e)}var Ky="Canceled";function h9(e){return e instanceof f9?!0:e instanceof Error&&e.name===Ky&&e.message===Ky}var f9=class extends Error{constructor(){super(Ky),this.name=this.message}};function p9(e){return new Error(`Illegal argument: ${e}`)}var aE=class Vy extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Vy)return t;let n=new Vy;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Yy=class FR extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,FR.prototype)}};function ds(e,t=0){return e[e.length-(1+t)]}var m9;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(m9||={});function g9(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var UR;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(N){yield N}e.single=r;function o(N){return t(N)?N:r(N)}e.wrap=o;function u(N){return N||n}e.from=u;function*h(N){for(let I=N.length-1;I>=0;I--)yield N[I]}e.reverse=h;function p(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(N){return N[Symbol.iterator]().next().value}e.first=f;function m(N,I){let j=0;for(let U of N)if(I(U,j++))return!0;return!1}e.some=m;function _(N,I){for(let j of N)if(I(j))return j}e.find=_;function*b(N,I){for(let j of N)I(j)&&(yield j)}e.filter=b;function*S(N,I){let j=0;for(let U of N)yield I(U,j++)}e.map=S;function*w(N,I){let j=0;for(let U of N)yield*I(U,j++)}e.flatMap=w;function*x(...N){for(let I of N)yield*I}e.concat=x;function C(N,I,j){let U=j;for(let G of N)U=I(U,G);return U}e.reduce=C;function*D(N,I,j=N.length){for(I<0&&(I+=N.length),j<0?j+=N.length:j>N.length&&(j=N.length);I<j;I++)yield N[I]}e.slice=D;function z(N,I=Number.POSITIVE_INFINITY){let j=[];if(I===0)return[j,N];let U=N[Symbol.iterator]();for(let G=0;G<I;G++){let W=U.next();if(W.done)return[j,e.empty()];j.push(W.value)}return[j,{[Symbol.iterator](){return U}}]}e.consume=z;async function F(N){let I=[];for await(let j of N)I.push(j);return Promise.resolve(I)}e.asyncToArray=F})(UR||={});function Zo(e){if(UR.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function _9(...e){return xn(()=>Zo(e))}function xn(e){return{dispose:g9(()=>{e()})}}var WR=class qR{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{Zo(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?qR.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)}};WR.DISABLE_DISPOSED_WARNING=!1;var to=WR,Et=class{constructor(){this._store=new to,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)}};Et.None=Object.freeze({dispose(){}});var vc=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}},ta=typeof window=="object"?window:globalThis,Xy=class Zy{constructor(t){this.element=t,this.next=Zy.Undefined,this.prev=Zy.Undefined}};Xy.Undefined=new Xy(void 0);var En=Xy,oE=class{constructor(){this._first=En.Undefined,this._last=En.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===En.Undefined}clear(){let e=this._first;for(;e!==En.Undefined;){let t=e.next;e.prev=En.Undefined,e.next=En.Undefined,e=t}this._first=En.Undefined,this._last=En.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new En(e);if(this._first===En.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==En.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==En.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==En.Undefined&&e.next!==En.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===En.Undefined&&e.next===En.Undefined?(this._first=En.Undefined,this._last=En.Undefined):e.next===En.Undefined?(this._last=this._last.prev,this._last.next=En.Undefined):e.prev===En.Undefined&&(this._first=this._first.next,this._first.prev=En.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==En.Undefined;)yield e.element,e=e.next}},v9=globalThis.performance&&typeof globalThis.performance.now=="function",y9=class GR{static create(t){return new GR(t)}constructor(t){this._now=v9&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},wi;(e=>{e.None=()=>Et.None;function t(O,A){return _(O,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(O){return(A,B=null,M)=>{let k=!1,T;return T=O(R=>{if(!k)return T?T.dispose():k=!0,A.call(B,R)},null,M),k&&T.dispose(),T}}e.once=n;function i(O,A,B){return f((M,k=null,T)=>O(R=>M.call(k,A(R)),null,T),B)}e.map=i;function r(O,A,B){return f((M,k=null,T)=>O(R=>{A(R),M.call(k,R)},null,T),B)}e.forEach=r;function o(O,A,B){return f((M,k=null,T)=>O(R=>A(R)&&M.call(k,R),null,T),B)}e.filter=o;function u(O){return O}e.signal=u;function h(...O){return(A,B=null,M)=>{let k=_9(...O.map(T=>T(R=>A.call(B,R))));return m(k,M)}}e.any=h;function p(O,A,B,M){let k=B;return i(O,T=>(k=A(k,T),k),M)}e.reduce=p;function f(O,A){let B,M={onWillAddFirstListener(){B=O(k.fire,k)},onDidRemoveLastListener(){B?.dispose()}},k=new ke(M);return A?.add(k),k.event}function m(O,A){return A instanceof Array?A.push(O):A&&A.add(O),O}function _(O,A,B=100,M=!1,k=!1,T,R){let $,K,L,q=0,H,ne={leakWarningThreshold:T,onWillAddFirstListener(){$=O(Se=>{q++,K=A(K,Se),M&&!L&&(oe.fire(K),K=void 0),H=()=>{let xe=K;K=void 0,L=void 0,(!M||q>1)&&oe.fire(xe),q=0},typeof B=="number"?(clearTimeout(L),L=setTimeout(H,B)):L===void 0&&(L=0,queueMicrotask(H))})},onWillRemoveListener(){k&&q>0&&H?.()},onDidRemoveLastListener(){H=void 0,$.dispose()}},oe=new ke(ne);return R?.add(oe),oe.event}e.debounce=_;function b(O,A=0,B){return e.debounce(O,(M,k)=>M?(M.push(k),M):[k],A,void 0,!0,void 0,B)}e.accumulate=b;function S(O,A=(M,k)=>M===k,B){let M=!0,k;return o(O,T=>{let R=M||!A(T,k);return M=!1,k=T,R},B)}e.latch=S;function w(O,A,B){return[e.filter(O,A,B),e.filter(O,M=>!A(M),B)]}e.split=w;function x(O,A=!1,B=[],M){let k=B.slice(),T=O(K=>{k?k.push(K):$.fire(K)});M&&M.add(T);let R=()=>{k?.forEach(K=>$.fire(K)),k=null},$=new ke({onWillAddFirstListener(){T||(T=O(K=>$.fire(K)),M&&M.add(T))},onDidAddFirstListener(){k&&(A?setTimeout(R):R())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return M&&M.add($),$.event}e.buffer=x;function C(O,A){return(B,M,k)=>{let T=A(new z);return O(function(R){let $=T.evaluate(R);$!==D&&B.call(M,$)},void 0,k)}}e.chain=C;let D=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(B=>(A(B),B)),this}filter(A){return this.steps.push(B=>A(B)?B:D),this}reduce(A,B){let M=B;return this.steps.push(k=>(M=A(M,k),M)),this}latch(A=(B,M)=>B===M){let B=!0,M;return this.steps.push(k=>{let T=B||!A(k,M);return B=!1,M=k,T?k:D}),this}evaluate(A){for(let B of this.steps)if(A=B(A),A===D)break;return A}}function F(O,A,B=M=>M){let M=(...$)=>R.fire(B(...$)),k=()=>O.on(A,M),T=()=>O.removeListener(A,M),R=new ke({onWillAddFirstListener:k,onDidRemoveLastListener:T});return R.event}e.fromNodeEventEmitter=F;function N(O,A,B=M=>M){let M=(...$)=>R.fire(B(...$)),k=()=>O.addEventListener(A,M),T=()=>O.removeEventListener(A,M),R=new ke({onWillAddFirstListener:k,onDidRemoveLastListener:T});return R.event}e.fromDOMEventEmitter=N;function I(O){return new Promise(A=>n(O)(A))}e.toPromise=I;function j(O){let A=new ke;return O.then(B=>{A.fire(B)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=j;function U(O,A){return O(B=>A.fire(B))}e.forward=U;function G(O,A,B){return A(B),O(M=>A(M))}e.runAndSubscribe=G;class W{constructor(A,B){this._observable=A,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new ke(M),B&&B.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,B){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(O,A){return new W(O,A).emitter.event}e.fromObservable=Z;function V(O){return(A,B,M)=>{let k=0,T=!1,R={beginUpdate(){k++},endUpdate(){k--,k===0&&(O.reportChanges(),T&&(T=!1,A.call(B)))},handlePossibleChange(){},handleChange(){T=!0}};O.addObserver(R),O.reportChanges();let $={dispose(){O.removeObserver(R)}};return M instanceof to?M.add($):Array.isArray(M)&&M.push($),$}}e.fromObservableLight=V})(wi||={});var Jy=class Qy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Qy._idPool++}`,Qy.all.add(this)}start(t){this._stopWatch=new y9,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}}};Jy.all=new Set,Jy._idPool=0;var b9=Jy,S9=-1,KR=class VR{constructor(t,n,i=(VR._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(o);let p=new C9(h,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};KR._idPool=1;var w9=KR,x9=class YR{constructor(t){this.value=t}static create(){let t=new Error;return new YR(t.stack??"")}print(){console.warn(this.value.split(`
87
+ `).slice(2).join(`
88
+ `))}},C9=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},k9=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},E9=0,sv=class{constructor(e){this.value=e,this.id=E9++}},T9=2,A9,ke=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new w9(t?.onListenerError??qf,this._options?.leakWarningThreshold??S9):void 0,this._perfMon=this._options?._profName?new b9(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new k9(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||qf)(f),Et.None}if(this._disposed)return Et.None;n&&(t=t.bind(n));let r=new sv(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=x9.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof sv?(this._deliveryQueue??=new R9,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=xn(()=>{o?.(),this._removeListener(r)});return i instanceof to?i.add(u):Array.isArray(i)&&i.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*T9<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||qf;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof sv)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},R9=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eb=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ke,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ke,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};eb.INSTANCE=new eb;var s1=eb;function N9(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}s1.INSTANCE.onDidChangeZoomLevel;function L9(e){return s1.INSTANCE.getZoomFactor(e)}s1.INSTANCE.onDidChangeFullscreen;var Lc=typeof navigator=="object"?navigator.userAgent:"",tb=Lc.indexOf("Firefox")>=0,M9=Lc.indexOf("AppleWebKit")>=0,r1=Lc.indexOf("Chrome")>=0,j9=!r1&&Lc.indexOf("Safari")>=0;Lc.indexOf("Electron/")>=0;Lc.indexOf("Android")>=0;var rv=!1;if(typeof ta.matchMedia=="function"){let e=ta.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ta.matchMedia("(display-mode: fullscreen)");rv=e.matches,N9(ta,e,({matches:n})=>{rv&&t.matches||(rv=n)})}var ec="en",nb=!1,ib=!1,Gf=!1,XR=!1,cf,Kf=ec,lE=ec,O9,Jr,Go=globalThis,ps;typeof Go.vscode<"u"&&typeof Go.vscode.process<"u"?ps=Go.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ps=process);var D9=typeof ps?.versions?.electron=="string",I9=D9&&ps?.type==="renderer";if(typeof ps=="object"){nb=ps.platform==="win32",ib=ps.platform==="darwin",Gf=ps.platform==="linux",Gf&&ps.env.SNAP&&ps.env.SNAP_REVISION,ps.env.CI||ps.env.BUILD_ARTIFACTSTAGINGDIRECTORY,cf=ec,Kf=ec;let e=ps.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);cf=t.userLocale,lE=t.osLocale,Kf=t.resolvedLanguage||ec,O9=t.languagePack?.translationsConfigFile}catch{}XR=!0}else typeof navigator=="object"&&!I9?(Jr=navigator.userAgent,nb=Jr.indexOf("Windows")>=0,ib=Jr.indexOf("Macintosh")>=0,(Jr.indexOf("Macintosh")>=0||Jr.indexOf("iPad")>=0||Jr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Gf=Jr.indexOf("Linux")>=0,Jr?.indexOf("Mobi")>=0,Kf=globalThis._VSCODE_NLS_LANGUAGE||ec,cf=navigator.language.toLowerCase(),lE=cf):console.error("Unable to resolve platform.");var ZR=nb,vr=ib,B9=Gf,cE=XR,Sr=Jr,$a=Kf,P9;(e=>{function t(){return $a}e.value=t;function n(){return $a.length===2?$a==="en":$a.length>=3?$a[0]==="e"&&$a[1]==="n"&&$a[2]==="-":!1}e.isDefaultVariant=n;function i(){return $a==="en"}e.isDefault=i})(P9||={});var $9=typeof Go.postMessage=="function"&&!Go.importScripts;(()=>{if($9){let e=[];Go.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),Go.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var z9=!!(Sr&&Sr.indexOf("Chrome")>=0);Sr&&Sr.indexOf("Firefox")>=0;!z9&&Sr&&Sr.indexOf("Safari")>=0;Sr&&Sr.indexOf("Edg/")>=0;Sr&&Sr.indexOf("Android")>=0;var Il=typeof navigator=="object"?navigator:{};cE||document.queryCommandSupported&&document.queryCommandSupported("copy")||Il&&Il.clipboard&&Il.clipboard.writeText,cE||Il&&Il.clipboard&&Il.clipboard.readText;var a1=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}},av=new a1,uE=new a1,dE=new a1,H9=new Array(230),JR;(e=>{function t(h){return av.keyCodeToStr(h)}e.toString=t;function n(h){return av.strToKeyCode(h)}e.fromString=n;function i(h){return uE.keyCodeToStr(h)}e.toUserSettingsUS=i;function r(h){return dE.keyCodeToStr(h)}e.toUserSettingsGeneral=r;function o(h){return uE.strToKeyCode(h)||dE.strToKeyCode(h)}e.fromUserSettings=o;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return av.keyCodeToStr(h)}e.toElectronAccelerator=u})(JR||={});var F9=class QR{constructor(t,n,i,r,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof QR&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new U9([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},U9=class{constructor(e){if(e.length===0)throw p9("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function W9(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return JR.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(tb)switch(t){case 59:return 85;case 60:if(B9)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(vr)return 57;break}else if(M9&&(vr&&t===93||!vr&&t===92))return 57;return H9[t]||0}var q9=vr?256:2048,G9=512,K9=1024,V9=vr?2048:256,hE=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=W9(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=q9),this.altKey&&(t|=G9),this.shiftKey&&(t|=K9),this.metaKey&&(t|=V9),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new F9(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},fE=new WeakMap;function Y9(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var X9=class{static getSameOriginWindowChain(e){let t=fE.get(e);if(!t){t=[],fE.set(e,t);let n=e,i;do i=Y9(n),i?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=i;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let u=o.window.deref();if(n+=u?.scrollY??0,i+=u?.scrollX??0,u===t||!o.iframeElement)break;let h=o.iframeElement.getBoundingClientRect();n+=h.top,i+=h.left}return{top:n,left:i}}},uf=class{constructor(t,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=X9.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},pE=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let i=!1;if(r1){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,u=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*u):this.deltaY=r.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?tb&&!vr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")j9&&ZR?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*u):this.deltaX=r.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?tb&&!vr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},eN=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Z9;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof J9?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:wi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:eN})})(Z9||={});var J9=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?eN:(this._emitter||(this._emitter=new ke),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},o1=class{constructor(t,n){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof n=="number"&&this.setIfNotSet(t,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,n){if(this._isDisposed)throw new Yy("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new Yy("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},Q9=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Yy("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=xn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},ez;(e=>{async function t(i){let r,o=await Promise.all(i.map(u=>u.then(h=>h,h=>{r||(r=h)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(u){o(u)}})}e.withAsyncBody=n})(ez||={});var mE=class js{static fromArray(t){return new js(n=>{n.emitMany(t)})}static fromPromise(t){return new js(async n=>{n.emitMany(await t)})}static fromPromises(t){return new js(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new js(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ke,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await wi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new js(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return js.map(this,t)}static filter(t,n){return new js(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return js.filter(this,t)}static coalesce(t){return js.filter(t,n=>!!n)}coalesce(){return js.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return js.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())}};mE.EMPTY=mE.fromArray([]);var{getWindow:_r,getWindowId:tz,onDidRegisterWindow:nz}=(function(){let e=new Map,t={window:ta,disposables:new to};e.set(ta.vscodeWindowId,t);let n=new ke,i=new ke,r=new ke;function o(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Et.None;let h=new to,p={window:u,disposables:h.add(new to)};return e.set(u.vscodeWindowId,p),h.add(xn(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),h.add(ft(u,ai.BEFORE_UNLOAD,()=>{r.fire(u)})),n.fire(p),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let p=u;return p?.view?p.view.window:ta},getDocument(u){return _r(u).document}}})(),iz=class{constructor(e,t,n,i){this._node=e,this._type=t,this._handler=n,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function ft(e,t,n,i){return new iz(e,t,n,i)}var gE=function(e,t,n,i){return ft(e,t,n,i)},l1,sz=class extends Q9{constructor(e){super(),this.defaultTarget=e&&_r(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},_E=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){qf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,r=o=>{n.set(o,!1);let u=e.get(o)??[];for(t.set(o,u),e.set(o,[]),i.set(o,!0);u.length>0;)u.sort(_E.sort),u.shift().execute();i.set(o,!1)};l1=(o,u,h=0)=>{let p=tz(o),f=new _E(u,h),m=e.get(p);return m||(m=[],e.set(p,m)),m.push(f),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>r(p))),f}})();function rz(e){let t=e.getBoundingClientRect(),n=_r(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var ai={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},az=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Zi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Zi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Zi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Zi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Zi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Zi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Zi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Zi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Zi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Zi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Zi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Zi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Zi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Zi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Zi(e){return typeof e=="number"?`${e}px`:e}function hd(e){return new az(e)}var tN=class{constructor(){this._hooks=new to,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(xn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=_r(e)}this._hooks.add(ft(o,ai.POINTER_MOVE,u=>{if(u.buttons!==n){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(ft(o,ai.POINTER_UP,u=>this.stopMonitoring(!0)))}};function oz(e,t,n){let i=null,r=null;if(typeof n.value=="function"?(i="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",r=n.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;n[i]=function(...u){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,u)}),this[o]}}var fr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(fr||={});var Ju=class Ti extends Et{constructor(){super(),this.dispatched=!1,this.targets=new oE,this.ignoreTargets=new oE,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(wi.runAndSubscribe(nz,({window:t,disposables:n})=>{n.add(ft(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(ft(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(ft(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:ta,disposables:this._store}))}static addTarget(t){if(!Ti.isTouchDevice())return Et.None;Ti.INSTANCE||(Ti.INSTANCE=new Ti);let n=Ti.INSTANCE.targets.push(t);return xn(n)}static ignoreTarget(t){if(!Ti.isTouchDevice())return Et.None;Ti.INSTANCE||(Ti.INSTANCE=new Ti);let n=Ti.INSTANCE.ignoreTargets.push(t);return xn(n)}static isTouchDevice(){return"ontouchstart"in ta||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let u=this.newGestureEvent(fr.Start,o.target);u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,u=n.changedTouches.length;o<u;o++){let h=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let p=this.activeTouches[h.identifier],f=Date.now()-p.initialTimeStamp;if(f<Ti.HOLD_DELAY&&Math.abs(p.initialPageX-ds(p.rollingPageX))<30&&Math.abs(p.initialPageY-ds(p.rollingPageY))<30){let m=this.newGestureEvent(fr.Tap,p.initialTarget);m.pageX=ds(p.rollingPageX),m.pageY=ds(p.rollingPageY),this.dispatchEvent(m)}else if(f>=Ti.HOLD_DELAY&&Math.abs(p.initialPageX-ds(p.rollingPageX))<30&&Math.abs(p.initialPageY-ds(p.rollingPageY))<30){let m=this.newGestureEvent(fr.Contextmenu,p.initialTarget);m.pageX=ds(p.rollingPageX),m.pageY=ds(p.rollingPageY),this.dispatchEvent(m)}else if(r===1){let m=ds(p.rollingPageX),_=ds(p.rollingPageY),b=ds(p.rollingTimestamps)-p.rollingTimestamps[0],S=m-p.rollingPageX[0],w=_-p.rollingPageY[0],x=[...this.targets].filter(C=>p.initialTarget instanceof Node&&C.contains(p.initialTarget));this.inertia(t,x,i,Math.abs(S)/b,S>0?1:-1,m,Math.abs(w)/b,w>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(fr.End,p.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=n,i.tapCount=0,i}dispatchEvent(t){if(t.type===fr.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Ti.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===fr.Change||t.type===fr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let n=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;n.push([r,i])}n.sort((i,r)=>i[0]-r[0]);for(let[i,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,r,o,u,h,p,f){this.handle=l1(t,()=>{let m=Date.now(),_=m-i,b=0,S=0,w=!0;r+=Ti.SCROLL_FRICTION*_,h+=Ti.SCROLL_FRICTION*_,r>0&&(w=!1,b=o*r*_),h>0&&(w=!1,S=p*h*_);let x=this.newGestureEvent(fr.Change);x.translationX=b,x.translationY=S,n.forEach(C=>C.dispatchEvent(x)),w||this.inertia(t,n,m,r,o,u+b,h,p,f+S)})}onTouchMove(t){let n=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let u=this.activeTouches[o.identifier],h=this.newGestureEvent(fr.Change,u.initialTarget);h.translationX=o.pageX-ds(u.rollingPageX),h.translationY=o.pageY-ds(u.rollingPageY),h.pageX=o.pageX,h.pageY=o.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(o.pageX),u.rollingPageY.push(o.pageY),u.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ju.SCROLL_FRICTION=-.005,Ju.HOLD_DELAY=700,Ju.CLEAR_TAP_COUNT_TIME=400,Dn([oz],Ju,"isTouchDevice",1);var lz=Ju,c1=class extends Et{onclick(e,t){this._register(ft(e,ai.CLICK,n=>t(new uf(_r(e),n))))}onmousedown(e,t){this._register(ft(e,ai.MOUSE_DOWN,n=>t(new uf(_r(e),n))))}onmouseover(e,t){this._register(ft(e,ai.MOUSE_OVER,n=>t(new uf(_r(e),n))))}onmouseleave(e,t){this._register(ft(e,ai.MOUSE_LEAVE,n=>t(new uf(_r(e),n))))}onkeydown(e,t){this._register(ft(e,ai.KEY_DOWN,n=>t(new hE(n))))}onkeyup(e,t){this._register(ft(e,ai.KEY_UP,n=>t(new hE(n))))}oninput(e,t){this._register(ft(e,ai.INPUT,t))}onblur(e,t){this._register(ft(e,ai.BLUR,t))}onfocus(e,t){this._register(ft(e,ai.FOCUS,t))}onchange(e,t){this._register(ft(e,ai.CHANGE,t))}ignoreGesture(e){return lz.ignoreTarget(e)}},vE=11,cz=class extends c1{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=vE+"px",this.domNode.style.height=vE+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new tN),this._register(gE(this.bgDomNode,ai.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(gE(this.domNode,ai.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new sz),this._pointerdownScheduleRepeatTimer=this._register(new o1)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,_r(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},uz=class sb{constructor(t,n,i,r,o,u,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,r=r|0,o=o|0,u=u|0,h=h|0),this.rawScrollLeft=r,this.rawScrollTop=h,n<0&&(n=0),r+n>i&&(r=i-n),r<0&&(r=0),o<0&&(o=0),h+o>u&&(h=u-o),h<0&&(h=0),this.width=n,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=u,this.scrollTop=h}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new sb(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new sb(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:p}}},dz=class extends Et{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new uz(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let i;t?i=new bE(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=bE.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},yE=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function ov(e,t){let n=t-e;return function(i){return e+n*pz(i)}}function hz(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var bE=class rb{constructor(t,n,i,r){this.from=t,this.to=n,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,i){if(Math.abs(t-n)>2.5*i){let r,o;return t<n?(r=t+.75*i,o=n-.75*i):(r=t-.75*i,o=n+.75*i),hz(ov(t,r),ov(o,n),.33)}return ov(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let i=this.scrollLeft(n),r=this.scrollTop(n);return new yE(i,r,!1)}return new yE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return rb.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new rb(t,n,r,i)}};function fz(e){return Math.pow(e,3)}function pz(e){return 1-fz(1-e)}var mz=class extends Et{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new o1)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},gz=140,nN=class extends c1{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new mz(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new tN),this._shouldRender=!0,this.domNode=hd(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(ft(this.domNode.domNode,ai.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new cz(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=hd(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ft(this.slider.domNode,ai.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let r=rz(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),u=Math.abs(o-n);if(ZR&&u>gz){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let h=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},iN=class ab{constructor(t,n,i,r,o,u){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ab(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,i,r,o){let u=Math.max(0,i-t),h=Math.max(0,u-2*n),p=r>0&&r>i;if(!p)return{computedAvailableSize:Math.round(u),computedIsNeeded:p,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*h/r))),m=(h-f)/(r-i),_=o*m;return{computedAvailableSize:Math.round(u),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:m,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=ab._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,i=this._scrollPosition;return n<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},_z=class extends nN{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new iN(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},vz=class extends nN{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new iN(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},yz=500,SE=50,bz=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},ob=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,n+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(r1){let n=_r(t.browserEvent),i=L9(n);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,i){let r=null,o=new bz(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),n){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),u=Math.abs(n.deltaX),h=Math.abs(n.deltaY),p=Math.max(Math.min(r,u),1),f=Math.max(Math.min(o,h),1),m=Math.max(r,u),_=Math.max(o,h);m%p===0&&_%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ob.INSTANCE=new ob;var Sz=ob,wz=class extends c1{constructor(e,t,n){super(),this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ke),this.onWillScroll=this._onWillScroll.event,this._options=Cz(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new vz(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new _z(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=hd(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=hd(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=hd(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new o1),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Zo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,vr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new pE(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Zo(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new pE(n))};this._mouseWheelToDispose.push(ft(this._listenOnDomNode,ai.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Sz.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let u=!vr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),p={};if(r){let f=SE*r,m=h.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,m)}if(o){let f=SE*o,m=h.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,m)}p=this._scrollable.validateScrollPosition(p),(h.scrollLeft!==p.scrollLeft||h.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let i=n;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,i=n?" left":"",r=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),yz)}},xz=class extends wz{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Cz(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,vr&&(t.className+=" mac"),t}var lb=class extends Et{constructor(e,t,n,i,r,o,u,h){super(),this._bufferService=n,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new ke),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new dz({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>l1(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new xz(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(wi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(xn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(xn(()=>this._styleElement.remove())),this._register(wi.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
89
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};lb=Dn([He(2,Hi),He(3,oa),He(4,BR),He(5,Nc),He(6,Fi),He(7,la)],lb);var cb=class extends Et{constructor(e,t,n,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(xn(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};cb=Dn([He(1,Hi),He(2,oa),He(3,Bd),He(4,la)],cb);var kz=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},dr={full:0,left:0,center:0,right:0},za={full:0,left:0,center:0,right:0},Lu={full:0,left:0,center:0,right:0},kp=class extends Et{constructor(e,t,n,i,r,o,u,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new kz,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(xn(()=>this._canvas?.remove()));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);za.full=this._canvas.width,za.left=e,za.center=t,za.right=e,this._refreshDrawHeightConstants(),Lu.full=1,Lu.left=1,Lu.center=1+za.left,Lu.right=1+za.left+za.center}_refreshDrawHeightConstants(){dr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);dr.left=t,dr.center=t,dr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*dr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*dr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*dr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*dr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Lu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-dr[e.position||"full"]/2),za[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+dr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};kp=Dn([He(2,Hi),He(3,Bd),He(4,la),He(5,Fi),He(6,Nc),He(7,oa)],kp);var ye;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
90
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ye||={});var Vf;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Vf||={});var sN;(e=>e.ST=`${ye.ESC}\\`)(sN||={});var ub=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ye.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ub=Dn([He(2,Hi),He(3,Fi),He(4,tl),He(5,la)],ub);var ui=0,di=0,hi=0,On=0,wE={css:"#00000000",rgba:0},Gn;(e=>{function t(r,o,u,h){return h!==void 0?`#${Ro(r)}${Ro(o)}${Ro(u)}${Ro(h)}`:`#${Ro(r)}${Ro(o)}${Ro(u)}`}e.toCss=t;function n(r,o,u,h=255){return(r<<24|o<<16|u<<8|h)>>>0}e.toRgba=n;function i(r,o,u,h){return{css:e.toCss(r,o,u,h),rgba:e.toRgba(r,o,u,h)}}e.toColor=i})(Gn||={});var vn;(e=>{function t(p,f){if(On=(f.rgba&255)/255,On===1)return{css:f.css,rgba:f.rgba};let m=f.rgba>>24&255,_=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,x=p.rgba>>8&255;ui=S+Math.round((m-S)*On),di=w+Math.round((_-w)*On),hi=x+Math.round((b-x)*On);let C=Gn.toCss(ui,di,hi),D=Gn.toRgba(ui,di,hi);return{css:C,rgba:D}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,m){let _=Yf.ensureContrastRatio(p.rgba,f.rgba,m);if(_)return Gn.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[ui,di,hi]=Yf.toChannels(f),{css:Gn.toCss(ui,di,hi),rgba:f}}e.opaque=r;function o(p,f){return On=Math.round(f*255),[ui,di,hi]=Yf.toChannels(p.rgba),{css:Gn.toCss(ui,di,hi,On),rgba:Gn.toRgba(ui,di,hi,On)}}e.opacity=o;function u(p,f){return On=p.rgba&255,o(p,On*f/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(vn||={});var Tn;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ui=parseInt(r.slice(1,2).repeat(2),16),di=parseInt(r.slice(2,3).repeat(2),16),hi=parseInt(r.slice(3,4).repeat(2),16),Gn.toColor(ui,di,hi);case 5:return ui=parseInt(r.slice(1,2).repeat(2),16),di=parseInt(r.slice(2,3).repeat(2),16),hi=parseInt(r.slice(3,4).repeat(2),16),On=parseInt(r.slice(4,5).repeat(2),16),Gn.toColor(ui,di,hi,On);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return ui=parseInt(o[1]),di=parseInt(o[2]),hi=parseInt(o[3]),On=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Gn.toColor(ui,di,hi,On);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ui,di,hi,On]=t.getImageData(0,0,1,1).data,On!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gn.toRgba(ui,di,hi,On),css:r}}e.toColor=i})(Tn||={});var Oi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let u=i/255,h=r/255,p=o/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+m*.7152+_*.0722}e.relativeLuminance2=n})(Oi||={});var Yf;(e=>{function t(u,h){if(On=(h&255)/255,On===1)return h;let p=h>>24&255,f=h>>16&255,m=h>>8&255,_=u>>24&255,b=u>>16&255,S=u>>8&255;return ui=_+Math.round((p-_)*On),di=b+Math.round((f-b)*On),hi=S+Math.round((m-S)*On),Gn.toRgba(ui,di,hi)}e.blend=t;function n(u,h,p){let f=Oi.relativeLuminance(u>>8),m=Oi.relativeLuminance(h>>8);if(Xr(f,m)<p){if(m<f){let S=i(u,h,p),w=Xr(f,Oi.relativeLuminance(S>>8));if(w<p){let x=r(u,h,p),C=Xr(f,Oi.relativeLuminance(x>>8));return w>C?S:x}return S}let _=r(u,h,p),b=Xr(f,Oi.relativeLuminance(_>>8));if(b<p){let S=i(u,h,p),w=Xr(f,Oi.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(u,h,p){let f=u>>24&255,m=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,x=Xr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(f,m,_));for(;x<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x=Xr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(f,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(u,h,p){let f=u>>24&255,m=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,x=Xr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(f,m,_));for(;x<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Xr(Oi.relativeLuminance2(b,S,w),Oi.relativeLuminance2(f,m,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(Yf||={});function Ro(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Ez=class extends Id{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ep=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new $s}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],i=t.translateToString(!0),r=0,o=0,u=0,h=t.getFg(0),p=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==p){if(f-r>1){let m=this._getJoinedRanges(i,u,o,t,r);for(let _=0;_<m.length;_++)n.push(m[_])}r=f,u=o,h=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||Za.length}if(this._bufferService.cols-r>1){let f=this._getJoinedRanges(i,u,o,t,r);for(let m=0;m<f.length;m++)n.push(f[m])}return n}_getJoinedRanges(e,t,n,i,r){let o=e.substring(t,n),u=[];try{u=this._characterJoiners[0].handler(o)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let p=this._characterJoiners[h].handler(o);for(let f=0;f<p.length;f++)Ep._mergeRanges(u,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(u,i,r),u}_stringRangesToCellRanges(e,t,n){let i=0,r=!1,o=0,u=e[i];if(u){for(let h=n;h<this._bufferService.cols;h++){let p=t.getWidth(h),f=t.getString(h).length||Za.length;if(p!==0){if(!r&&u[0]<=o&&(u[0]=h,r=!0),u[1]<=o){if(u[1]=h,u=e[++i],!u)break;u[0]<=o?(u[0]=h,r=!0):r=!1}o+=f}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let r=e[i];if(n){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ep=Dn([He(0,Hi)],Ep);function Tz(e){return 57508<=e&&e<=57558}function Az(e){return 9472<=e&&e<=9631}function Rz(e){return Tz(e)||Az(e)}function Nz(){return{css:{canvas:df(),cell:df()},device:{canvas:df(),cell:df(),char:{width:0,height:0,left:0,top:0}}}}function df(){return{width:0,height:0}}var db=class{constructor(e,t,n,i,r,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=u,this._workCell=new $s,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,r,o,u,h,p,f,m){let _=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let x,C=0,D="",z=0,F=0,N=0,I=0,j=!1,U=0,G=!1,W=0,Z=0,V=[],O=f!==-1&&m!==-1;for(let A=0;A<w;A++){e.loadCell(A,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let M=!1,k=A>=Z,T=A,R=this._workCell;if(b.length>0&&A===b[0][0]&&k){let Me=b.shift(),je=this._isCellInSelection(Me[0],t);for(z=Me[0]+1;z<Me[1];z++)k&&=je===this._isCellInSelection(z,t);k&&=!n||o<Me[0]||o>=Me[1],k?(M=!0,R=new Ez(this._workCell,e.translateToString(!0,Me[0],Me[1]),Me[1]-Me[0]),T=Me[1]-1,B=R.getWidth()):Z=Me[1]}let $=this._isCellInSelection(A,t),K=n&&A===o,L=O&&A>=f&&A<=m,q=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,Me=>{q=!0});let H=R.getChars()||Za;if(H===" "&&(R.isUnderline()||R.isOverline())&&(H=" "),W=B*h-p.get(H,R.isBold(),R.isItalic()),!x)x=this._document.createElement("span");else if(C&&($&&G||!$&&!G&&R.bg===F)&&($&&G&&S.selectionForeground||R.fg===N)&&R.extended.ext===I&&L===j&&W===U&&!K&&!M&&!q&&k){R.isInvisible()?D+=Za:D+=H,C++;continue}else C&&(x.textContent=D),x=this._document.createElement("span"),C=0,D="";if(F=R.bg,N=R.fg,I=R.extended.ext,j=L,U=W,G=$,M&&o>=A&&o<=T&&(o=A),!this._coreService.isCursorHidden&&K&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&V.push("xterm-cursor-blink"),V.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(R.isBold()&&V.push("xterm-bold"),R.isItalic()&&V.push("xterm-italic"),R.isDim()&&V.push("xterm-dim"),R.isInvisible()?D=Za:D=R.getChars()||Za,R.isUnderline()&&(V.push(`xterm-underline-${R.extended.underlineStyle}`),D===" "&&(D=" "),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Id.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let Me=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&Me<8&&(Me+=8),x.style.textDecorationColor=S.ansi[Me].css}R.isOverline()&&(V.push("xterm-overline"),D===" "&&(D=" ")),R.isStrikethrough()&&V.push("xterm-strikethrough"),L&&(x.style.textDecoration="underline");let ne=R.getFgColor(),oe=R.getFgColorMode(),Se=R.getBgColor(),xe=R.getBgColorMode(),fe=!!R.isInverse();if(fe){let Me=ne;ne=Se,Se=Me;let je=oe;oe=xe,xe=je}let De,rt,Ie=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,Me=>{Me.options.layer!=="top"&&Ie||(Me.backgroundColorRGB&&(xe=50331648,Se=Me.backgroundColorRGB.rgba>>8&16777215,De=Me.backgroundColorRGB),Me.foregroundColorRGB&&(oe=50331648,ne=Me.foregroundColorRGB.rgba>>8&16777215,rt=Me.foregroundColorRGB),Ie=Me.options.layer==="top")}),!Ie&&$&&(De=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,Se=De.rgba>>8&16777215,xe=50331648,Ie=!0,S.selectionForeground&&(oe=50331648,ne=S.selectionForeground.rgba>>8&16777215,rt=S.selectionForeground)),Ie&&V.push("xterm-decoration-top");let Ce;switch(xe){case 16777216:case 33554432:Ce=S.ansi[Se],V.push(`xterm-bg-${Se}`);break;case 50331648:Ce=Gn.toColor(Se>>16,Se>>8&255,Se&255),this._addStyle(x,`background-color:#${xE((Se>>>0).toString(16),"0",6)}`);break;default:fe?(Ce=S.foreground,V.push("xterm-bg-257")):Ce=S.background}switch(De||R.isDim()&&(De=vn.multiplyOpacity(Ce,.5)),oe){case 16777216:case 33554432:R.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(x,Ce,S.ansi[ne],R,De,void 0)||V.push(`xterm-fg-${ne}`);break;case 50331648:let Me=Gn.toColor(ne>>16&255,ne>>8&255,ne&255);this._applyMinimumContrast(x,Ce,Me,R,De,rt)||this._addStyle(x,`color:#${xE(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Ce,S.foreground,R,De,rt)||fe&&V.push("xterm-fg-257")}V.length&&(x.className=V.join(" "),V.length=0),!K&&!M&&!q&&k?C++:x.textContent=D,W!==this.defaultSpacing&&(x.style.letterSpacing=`${W}px`),_.push(x),A=T}return x&&C&&(x.textContent=D),_}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Rz(i.getCode()))return!1;let u=this._getContrastCache(i),h;if(!r&&!o&&(h=u.getColor(t.rgba,n.rgba)),h===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);h=vn.ensureContrastRatio(r||t,o||n,p),u.setColor((r||t).rgba,(o||n).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,i=this._selectionEnd;return!n||!i?!1:this._columnSelectMode?n[0]<=i[0]?e>=n[0]&&t>=n[1]&&e<i[0]&&t<=i[1]:e<n[0]&&t>=n[1]&&e>=i[0]&&t<=i[1]:t>n[1]&&t<i[1]||n[1]===i[1]&&t===n[1]&&e>=n[0]&&e<i[0]||n[1]<i[1]&&t===i[1]&&e<i[0]||n[1]<i[1]&&t===n[1]&&e>=n[0]}};db=Dn([He(1,zR),He(2,Fi),He(3,oa),He(4,tl),He(5,Bd),He(6,Nc)],db);function xE(e,t,n){for(;e.length<n;)e=t+e;return e}var Lz=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,i,r,o],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,i){e===this._font&&t===this._fontSize&&n===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,n){let i=0;if(!t&&!n&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let u=this._measure(e,0);return u>0&&(this._flat[i]=u),u}let r=e;t&&(r+="B"),n&&(r+="I");let o=this._holey.get(r);if(o===void 0){let u=0;t&&(u|=1),n&&(u|=2),o=this._measure(e,u),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Mz=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,i=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,u=n[1]-r,h=Math.max(o,0),p=Math.min(u,e.rows-1);if(h>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function jz(){return new Mz}var lv="xterm-dom-renderer-owner-",Rs="xterm-rows",hf="xterm-fg-",CE="xterm-bg-",Mu="xterm-focus",ff="xterm-selection",Oz=1,hb=class extends Et{constructor(e,t,n,i,r,o,u,h,p,f,m,_,b,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=u,this._charSizeService=p,this._optionsService=f,this._bufferService=m,this._coreService=_,this._coreBrowserService=b,this._themeService=S,this._terminalClass=Oz++,this._rowElements=[],this._selectionRenderModel=jz(),this.onRequestRedraw=this._register(new ke).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Rs),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(ff),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Nz(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(db,document),this._element.classList.add(lv+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(xn(()=>{this._element.classList.remove(lv+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Lz(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Rs} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Rs} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Rs} .xterm-dim { color: ${vn.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Rs}.${Mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Rs}.${Mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Rs}.${Mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Rs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Rs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Rs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Rs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Rs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ff} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ff} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ff} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${hf}${o} { color: ${u.css}; }${this._terminalSelector} .${hf}${o}.xterm-dim { color: ${vn.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${CE}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${hf}257 { color: ${vn.opaque(e.background).css}; }${this._terminalSelector} .${hf}257.xterm-dim { color: ${vn.multiplyOpacity(vn.opaque(e.background),.5).css}; }${this._terminalSelector} .${CE}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Mu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Mu),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];h.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],u-o+1))}else{let p=i===o?e[0]:0,f=o===r?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,p,f));let m=u-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,m)),o!==u){let _=r===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,_))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,n,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(n-t);return o+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${u}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,i=n.ybase+n.y,r=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let f=p+n.ydisp,m=this._rowElements[p],_=n.lines.get(f);if(!m||!_)break;m.replaceChildren(...this._rowFactory.createRow(_,f,f===i,u,h,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${lv}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,i,r,o){n<0&&(e=0),i<0&&(t=0);let u=this._bufferService.rows-1;n=Math.max(Math.min(n,u),0),i=Math.max(Math.min(i,u),0),r=Math.min(r,this._bufferService.cols);let h=this._bufferService.buffer,p=h.ybase+h.y,f=Math.min(h.x,r-1),m=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=i;++S){let w=S+h.ydisp,x=this._rowElements[S],C=h.lines.get(w);if(!x||!C)break;x.replaceChildren(...this._rowFactory.createRow(C,w,w===p,_,b,f,m,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};hb=Dn([He(7,n1),He(8,cm),He(9,Fi),He(10,Hi),He(11,tl),He(12,oa),He(13,Nc)],hb);var fb=class extends Et{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ke),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Iz(this._optionsService))}catch{this._measureStrategy=this._register(new Dz(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};fb=Dn([He(2,Fi)],fb);var rN=class extends Et{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Dz=class extends rN{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Iz=class extends rN{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Bz=class extends Et{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Pz(this._window)),this._onDprChange=this._register(new ke),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ke),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(wi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ft(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ft(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Pz=class extends Et{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new vc),this._onDprChange=this._register(new ke),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ft(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)}},$z=class extends Et{constructor(){super(),this.linkProviders=[],this._register(xn(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function u1(e,t,n){let i=n.getBoundingClientRect(),r=e.getComputedStyle(n),o=parseInt(r.getPropertyValue("padding-left")),u=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-u]}function zz(e,t,n,i,r,o,u,h,p){if(!o)return;let f=u1(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(p?u/2:0))/u),f[1]=Math.ceil(f[1]/h),f[0]=Math.min(Math.max(f[0],1),i+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),r),f}var pb=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return zz(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=u1(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};pb=Dn([He(0,la),He(1,cm)],pb);var Hz=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},aN={};Z$(aN,{getSafariVersion:()=>Uz,isChromeOS:()=>uN,isFirefox:()=>oN,isIpad:()=>Wz,isIphone:()=>qz,isLegacyEdge:()=>Fz,isLinux:()=>d1,isMac:()=>Tp,isNode:()=>um,isSafari:()=>lN,isWindows:()=>cN});var um=typeof process<"u"&&"title"in process,Pd=um?"node":navigator.userAgent,$d=um?"node":navigator.platform,oN=Pd.includes("Firefox"),Fz=Pd.includes("Edge"),lN=/^((?!chrome|android).)*safari/i.test(Pd);function Uz(){if(!lN)return 0;let e=Pd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Tp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes($d),Wz=$d==="iPad",qz=$d==="iPhone",cN=["Windows","Win16","Win32","WinCE"].includes($d),d1=$d.indexOf("Linux")>=0,uN=/\bCrOS\b/.test(Pd),dN=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},Gz=class extends dN{_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())}}},Kz=class extends dN{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ap=!um&&"requestIdleCallback"in window?Kz:Gz,Vz=class{constructor(){this._queue=new Ap}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},mb=class extends Et{constructor(e,t,n,i,r,o,u,h,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=r,this._coreBrowserService=h,this._renderer=this._register(new vc),this._pausedResizeTask=new Vz,this._observerDisposable=this._register(new vc),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 ke),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ke),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ke),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ke),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Hz((f,m)=>this._renderRows(f,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Yz(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=xn(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};mb=Dn([He(2,Fi),He(3,cm),He(4,tl),He(5,Bd),He(6,Hi),He(7,oa),He(8,Nc)],mb);var Yz=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Xz(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return Qz(r,o,e,t,n,i)+dm(o,t,n,i)+eH(r,o,e,t,n,i);let u;if(o===t)return u=r>e?"D":"C",wd(Math.abs(r-e),Sd(u,i));u=o>t?"D":"C";let h=Math.abs(o-t),p=Jz(o>t?e:r,n)+(h-1)*n.cols+1+Zz(o>t?r:e);return wd(p,Sd(u,i))}function Zz(e,t){return e-1}function Jz(e,t){return t.cols-e}function Qz(e,t,n,i,r,o){return dm(t,i,r,o).length===0?"":wd(fN(e,t,e,t-Jo(t,r),!1,r).length,Sd("D",o))}function dm(e,t,n,i){let r=e-Jo(e,n),o=t-Jo(t,n),u=Math.abs(r-o)-tH(e,t,n);return wd(u,Sd(hN(e,t),i))}function eH(e,t,n,i,r,o){let u;dm(t,i,r,o).length>0?u=i-Jo(i,r):u=t;let h=i,p=nH(e,t,n,i,r,o);return wd(fN(e,u,n,h,p==="C",r).length,Sd(p,o))}function tH(e,t,n){let i=0,r=e-Jo(e,n),o=t-Jo(t,n);for(let u=0;u<Math.abs(r-o);u++){let h=hN(e,t)==="A"?-1:1;n.buffer.lines.get(r+h*u)?.isWrapped&&i++}return i}function Jo(e,t){let n=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return n}function nH(e,t,n,i,r,o){let u;return dm(n,i,r,o).length>0?u=i-Jo(i,r):u=t,e<n&&u<=i||e>=n&&u<i?"C":"D"}function hN(e,t){return e>t?"A":"B"}function fN(e,t,n,i,r,o){let u=e,h=t,p="";for(;(u!==n||h!==i)&&h>=0&&h<o.buffer.lines.length;)u+=r?1:-1,r&&u>o.cols-1?(p+=o.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!r&&u<0&&(p+=o.buffer.translateBufferLineToString(h,!1,0,e+1),u=o.cols-1,e=u,h--);return p+o.buffer.translateBufferLineToString(h,!1,e,u)}function Sd(e,t){let n=t?"O":"[";return ye.ESC+n+e}function wd(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var iH=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function kE(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var cv=50,sH=15,rH=50,aH=500,oH=" ",lH=new RegExp(oH,"g"),gb=class extends Et{constructor(e,t,n,i,r,o,u,h,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=u,this._renderService=h,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new $s,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ke),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ke),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ke),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ke),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new iH(this._bufferService),this._activeSelectionMode=0,this._register(xn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let h=n.translateBufferLineToString(u,!0,r,o);i.push(h)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let u=n.lines.get(o),h=n.translateBufferLineToString(o,!0);u?.isWrapped?i[i.length-1]+=h:i.push(h)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),u=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(r=>r.replace(lH," ")).join(cN?`\r
91
+ `:`
92
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),d1&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i||!t?!1:this._areCoordsInSelection(t,n,i)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i?!1:this._areCoordsInSelection([e,t],n,i)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=kE(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=u1(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-cv),cv),t/=cv,t/Math.abs(t)+Math.round(t*(sH-1)))}shouldForceSelection(e){return Tp?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),rH)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Tp&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let i=n.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<aH&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let i=Xz(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==i&&(n+=r-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let u=r.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),p=h,f=e[0]-h,m=0,_=0,b=0,S=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;p<u.length&&u.charAt(p+1)===" ";)p++}else{let C=e[0],D=e[0];o.getWidth(C)===0&&(m++,C--),o.getWidth(D)===2&&(_++,D++);let z=o.getString(D).length;for(z>1&&(S+=z-1,p+=z-1);C>0&&h>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,C--):F>1&&(b+=F-1,h-=F-1),h--,C--}for(;D<o.length&&p+1<u.length&&!this._isCharWordSeparator(o.loadCell(D+1,this._workCell));){o.loadCell(D+1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,D++):F>1&&(S+=F-1,p+=F-1),p++,D++}}p++;let w=h+f-m+b,x=Math.min(this._bufferService.cols,p-h+m+_-b-S);if(!(!t&&u.slice(h,p).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let C=r.lines.get(e[1]-1);if(C&&o.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let z=this._bufferService.cols-D.start;w-=z,x+=z}}}if(i&&w+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=r.lines.get(e[1]+1);if(C?.isWrapped&&C.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(x+=D.length)}}return{start:w,length:x}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=kE(n,this._bufferService.cols)}};gb=Dn([He(3,Hi),He(4,tl),He(5,i1),He(6,Fi),He(7,la),He(8,oa)],gb);var EE=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},TE=class{constructor(){this._color=new EE,this._css=new EE}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Jn=Object.freeze((()=>{let e=[Tn.toColor("#2e3436"),Tn.toColor("#cc0000"),Tn.toColor("#4e9a06"),Tn.toColor("#c4a000"),Tn.toColor("#3465a4"),Tn.toColor("#75507b"),Tn.toColor("#06989a"),Tn.toColor("#d3d7cf"),Tn.toColor("#555753"),Tn.toColor("#ef2929"),Tn.toColor("#8ae234"),Tn.toColor("#fce94f"),Tn.toColor("#729fcf"),Tn.toColor("#ad7fa8"),Tn.toColor("#34e2e2"),Tn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],r=t[n/6%6|0],o=t[n%6];e.push({css:Gn.toCss(i,r,o),rgba:Gn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:Gn.toCss(i,i,i),rgba:Gn.toRgba(i,i,i)})}return e})()),Oo=Tn.toColor("#ffffff"),Qu=Tn.toColor("#000000"),AE=Tn.toColor("#ffffff"),RE=Qu,ju={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},cH=Oo,_b=class extends Et{constructor(e){super(),this._optionsService=e,this._contrastCache=new TE,this._halfContrastCache=new TE,this._onChangeColors=this._register(new ke),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Oo,background:Qu,cursor:AE,cursorAccent:RE,selectionForeground:void 0,selectionBackgroundTransparent:ju,selectionBackgroundOpaque:vn.blend(Qu,ju),selectionInactiveBackgroundTransparent:ju,selectionInactiveBackgroundOpaque:vn.blend(Qu,ju),scrollbarSliderBackground:vn.opacity(Oo,.2),scrollbarSliderHoverBackground:vn.opacity(Oo,.4),scrollbarSliderActiveBackground:vn.opacity(Oo,.5),overviewRulerBorder:Oo,ansi:Jn.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=on(e.foreground,Oo),t.background=on(e.background,Qu),t.cursor=vn.blend(t.background,on(e.cursor,AE)),t.cursorAccent=vn.blend(t.background,on(e.cursorAccent,RE)),t.selectionBackgroundTransparent=on(e.selectionBackground,ju),t.selectionBackgroundOpaque=vn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=on(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?on(e.selectionForeground,wE):void 0,t.selectionForeground===wE&&(t.selectionForeground=void 0),vn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vn.opacity(t.selectionBackgroundTransparent,.3)),vn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=on(e.scrollbarSliderBackground,vn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=on(e.scrollbarSliderHoverBackground,vn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=on(e.scrollbarSliderActiveBackground,vn.opacity(t.foreground,.5)),t.overviewRulerBorder=on(e.overviewRulerBorder,cH),t.ansi=Jn.slice(),t.ansi[0]=on(e.black,Jn[0]),t.ansi[1]=on(e.red,Jn[1]),t.ansi[2]=on(e.green,Jn[2]),t.ansi[3]=on(e.yellow,Jn[3]),t.ansi[4]=on(e.blue,Jn[4]),t.ansi[5]=on(e.magenta,Jn[5]),t.ansi[6]=on(e.cyan,Jn[6]),t.ansi[7]=on(e.white,Jn[7]),t.ansi[8]=on(e.brightBlack,Jn[8]),t.ansi[9]=on(e.brightRed,Jn[9]),t.ansi[10]=on(e.brightGreen,Jn[10]),t.ansi[11]=on(e.brightYellow,Jn[11]),t.ansi[12]=on(e.brightBlue,Jn[12]),t.ansi[13]=on(e.brightMagenta,Jn[13]),t.ansi[14]=on(e.brightCyan,Jn[14]),t.ansi[15]=on(e.brightWhite,Jn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)t.ansi[i+16]=on(e.extendedAnsi[i],Jn[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};_b=Dn([He(0,Fi)],_b);function on(e,t){if(e!==void 0)try{return Tn.toColor(e)}catch{}return t}var uH=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},dH=class{constructor(){this._services=new uH,this._services.set(n1,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=s9(e).sort((o,u)=>o.index-u.index),i=[];for(let o of n){let u=this._services.get(o.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(u)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},hH={trace:0,debug:1,info:2,warn:3,error:4,off:5},fH="xterm.js: ",vb=class extends Et{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=hH[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":fH)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};vb=Dn([He(0,Fi)],vb);var NE=class extends Et{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ke),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ke),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ke),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let i=this._length+n.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},kt=3,Wn=Object.freeze(new Id),pf=0,uv=2,ed=class pN{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*kt);let r=n||$s.fromCharData([0,jR,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*kt+0],i=n&2097151;return[this._data[t*kt+1],n&2097152?this._combined[t]:i?Ka(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*kt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*kt+0]=t|2097152|n[2]<<22):this._data[t*kt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*kt+0]>>22}hasWidth(t){return this._data[t*kt+0]&12582912}getFg(t){return this._data[t*kt+1]}getBg(t){return this._data[t*kt+2]}hasContent(t){return this._data[t*kt+0]&4194303}getCodePoint(t){let n=this._data[t*kt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*kt+0]&2097152}getString(t){let n=this._data[t*kt+0];return n&2097152?this._combined[t]:n&2097151?Ka(n&2097151):""}isProtected(t){return this._data[t*kt+2]&536870912}loadCell(t,n){return pf=t*kt,n.content=this._data[pf+0],n.fg=this._data[pf+1],n.bg=this._data[pf+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*kt+0]=n.content,this._data[t*kt+1]=n.fg,this._data[t*kt+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*kt+0]=n|i<<22,this._data[t*kt+1]=r.fg,this._data[t*kt+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*kt+0];r&2097152?this._combined[t]+=Ka(n):r&2097151?(this._combined[t]=Ka(r&2097151)+Ka(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*kt+0]=r}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let r=new $s;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,r));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let r=new $s;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,r));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*uv<this._data.buffer.byteLength;let i=t*kt;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let u=0;u<r.length;u++){let h=parseInt(r[u],10);h>=t&&delete this._combined[h]}let o=Object.keys(this._extendedAttrs);for(let u=0;u<o.length;u++){let h=parseInt(o[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,i*4*uv<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*uv<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new pN(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*kt+0]&4194303)return t+(this._data[t*kt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*kt+0]&4194303||this._data[t*kt+2]&50331648)return t+(this._data[t*kt+0]>>22);return 0}copyCellsFrom(t,n,i,r,o){let u=t._data;if(o)for(let p=r-1;p>=0;p--){for(let f=0;f<kt;f++)this._data[(i+p)*kt+f]=u[(n+p)*kt+f];u[(n+p)*kt+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}else for(let p=0;p<r;p++){for(let f=0;f<kt;f++)this._data[(i+p)*kt+f]=u[(n+p)*kt+f];u[(n+p)*kt+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}let h=Object.keys(t._combined);for(let p=0;p<h.length;p++){let f=parseInt(h[p],10);f>=n&&(this._combined[f-n+i]=t._combined[f])}}translateToString(t,n,i,r){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;n<i;){let u=this._data[n*kt+0],h=u&2097151,p=u&2097152?this._combined[n]:h?Ka(h):Za;if(o+=p,r)for(let f=0;f<p.length;++f)r.push(n);n+=u>>22||1}return r&&r.push(n),o}};function pH(e,t,n,i,r,o){let u=[];for(let h=0;h<e.length-1;h++){let p=h,f=e.get(++p);if(!f.isWrapped)continue;let m=[e.get(h)];for(;p<e.length&&f.isWrapped;)m.push(f),f=e.get(++p);if(!o&&i>=h&&i<p){h+=m.length-1;continue}let _=0,b=xd(m,_,t),S=1,w=0;for(;S<m.length;){let C=xd(m,S,t),D=C-w,z=n-b,F=Math.min(D,z);m[_].copyCellsFrom(m[S],w,b,F,!1),b+=F,b===n&&(_++,b=0),w+=F,w===C&&(S++,w=0),b===0&&_!==0&&m[_-1].getWidth(n-1)===2&&(m[_].copyCellsFrom(m[_-1],n-1,b++,1,!1),m[_-1].setCell(n-1,r))}m[_].replaceCells(b,n,r);let x=0;for(let C=m.length-1;C>0&&(C>_||m[C].getTrimmedLength()===0);C--)x++;x>0&&(u.push(h+m.length-x),u.push(x)),h+=m.length-1}return u}function mH(e,t){let n=[],i=0,r=t[i],o=0;for(let u=0;u<e.length;u++)if(r===u){let h=t[++i];e.onDeleteEmitter.fire({index:u-o,amount:h}),u+=h-1,o+=h,r=t[++i]}else n.push(u);return{layout:n,countRemoved:o}}function gH(e,t){let n=[];for(let i=0;i<t.length;i++)n.push(e.get(t[i]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=t.length}function _H(e,t,n){let i=[],r=e.map((p,f)=>xd(e,f,t)).reduce((p,f)=>p+f),o=0,u=0,h=0;for(;h<r;){if(r-h<n){i.push(r-h);break}o+=n;let p=xd(e,u,t);o>p&&(o-=p,u++);let f=e[u].getWidth(o-1)===2;f&&o--;let m=f?n-1:n;i.push(m),h+=m}return i}function xd(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?n-1:n}var mN=class gN{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=gN._nextId++,this._onDispose=this.register(new ke),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Zo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};mN._nextId=1;var vH=mN,ei={},Do=ei.B;ei[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ei.A={"#":"£"};ei.B=void 0;ei[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ei.C=ei[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ei.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ei.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ei.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ei.E=ei[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ei.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ei.H=ei[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var LE=4294967295,ME=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Wn.clone(),this.savedCharset=Do,this.markers=[],this._nullCell=$s.fromCharData([0,jR,1,0]),this._whitespaceCell=$s.fromCharData([0,Za,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ap,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new NE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Cp),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Cp),this._whitespaceCell}getBlankLine(e,t){return new ed(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>LE?LE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Wn);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new NE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Wn),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,n);let o=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ed(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new ed(e,n)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let u=this.lines.length-r;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=pH(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Wn),n);if(i.length>0){let r=mH(this.lines,i);gH(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(Wn),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ed(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Wn),r=[],o=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let p=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),p.unshift(h);if(!n){let F=this.ybase+this.y;if(F>=u&&F<u+p.length)continue}let f=p[p.length-1].getTrimmedLength(),m=_H(p,this._cols,e),_=m.length-p.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+_):b=Math.max(0,this.lines.length-this.lines.maxLength+_);let S=[];for(let F=0;F<_;F++){let N=this.getBlankLine(Wn,!0);S.push(N)}S.length>0&&(r.push({start:u+p.length+o,newLines:S}),o+=S.length),p.push(...S);let w=m.length-1,x=m[w];x===0&&(w--,x=m[w]);let C=p.length-_-1,D=f;for(;C>=0;){let F=Math.min(D,x);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[C],D-F,x-F,F,!0),x-=F,x===0&&(w--,x=m[w]),D-=F,D===0){C--;let N=Math.max(C,0);D=xd(p,N,this._cols)}}for(let F=0;F<p.length;F++)m[F]<e&&p[F].setCell(m[F],i);let z=_-b;for(;z-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(r.length>0){let u=[],h=[];for(let x=0;x<this.lines.length;x++)h.push(this.lines.get(x));let p=this.lines.length,f=p-1,m=0,_=r[m];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let x=Math.min(this.lines.maxLength-1,p+o-1);x>=0;x--)if(_&&_.start>f+b){for(let C=_.newLines.length-1;C>=0;C--)this.lines.set(x--,_.newLines[C]);x++,u.push({index:f+1,amount:_.newLines.length}),b+=_.newLines.length,_=r[++m]}else this.lines.set(x,h[f--]);let S=0;for(let x=u.length-1;x>=0;x--)u[x].index+=S,this.lines.onInsertEmitter.fire(u[x]),S+=u[x].amount;let w=Math.max(0,p+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,i){let r=this.lines.get(e);return r?r.translateToString(t,n,i):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new vH(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},yH=class extends Et{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ke),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 ME(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ME(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},_N=2,vN=1,yb=class extends Et{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ke),this.onResize=this._onResize.event,this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,_N),this.rows=Math.max(e.rawOptions.rows||0,vN),this.buffers=this._register(new yH(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let u=n.lines.isFull;o===n.lines.length-1?u?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),u?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let u=o-r+1;n.lines.shiftElements(r+1,u-1,-1),n.lines.set(o,i.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};yb=Dn([He(0,Fi)],yb);var Bl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Tp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},bH=["normal","bold","100","200","300","400","500","600","700","800","900"],SH=class extends Et{constructor(e){super(),this._onOptionChange=this._register(new ke),this.onOptionChange=this._onOptionChange.event;let t={...Bl};for(let n in e)if(n in t)try{let i=e[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(xn(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Bl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in Bl))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let i={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Bl[e]),!wH(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Bl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=bH.includes(t)?t:Bl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function wH(e){return e==="block"||e==="underline"||e==="bar"}function td(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let i in e)n[i]=t<=1?e[i]:e[i]&&td(e[i],t-1);return n}var jE=Object.freeze({insertMode:!1}),OE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),bb=class extends Et{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ke),this.onData=this._onData.event,this._onUserInput=this._register(new ke),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ke),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ke),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=td(jE),this.decPrivateModes=td(OE)}reset(){this.modes=td(jE),this.decPrivateModes=td(OE)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};bb=Dn([He(0,Hi),He(1,PR),He(2,Fi)],bb);var DE={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function dv(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var hv=String.fromCharCode,IE={DEFAULT:e=>{let t=[dv(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${hv(t[0])}${hv(t[1])}${hv(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${dv(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${dv(e,!0)};${e.x};${e.y}${t}`}},Sb=class extends Et{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ke),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(DE))this.addProtocol(i,DE[i]);for(let i of Object.keys(IE))this.addEncoding(i,IE[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let i=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Sb=Dn([He(0,Hi),He(1,tl),He(2,Fi)],Sb);var fv=[[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]],xH=[[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]],Qn;function CH(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var kH=class{constructor(){if(this.version="6",!Qn){Qn=new Uint8Array(65536),Qn.fill(1),Qn[0]=0,Qn.fill(0,1,32),Qn.fill(0,127,160),Qn.fill(2,4352,4448),Qn[9001]=2,Qn[9002]=2,Qn.fill(2,11904,42192),Qn[12351]=1,Qn.fill(2,44032,55204),Qn.fill(2,63744,64256),Qn.fill(2,65040,65050),Qn.fill(2,65072,65136),Qn.fill(2,65280,65377),Qn.fill(2,65504,65511);for(let e=0;e<fv.length;++e)Qn.fill(0,fv[e][0],fv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Qn[e]:CH(e,xH)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let r=Bo.extractWidth(t);r===0?i=!1:r>n&&(n=r)}return Bo.createPropertyValue(0,n,i)}},Bo=class Xf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ke,this.onChange=this._onChange.event;let t=new kH;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,r=t.length;for(let o=0;o<r;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return n+this.wcwidth(u);let f=t.charCodeAt(o);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let h=this.charProperties(u,i),p=Xf.extractWidth(h);Xf.extractShouldJoin(h)&&(p-=Xf.extractWidth(i)),n+=p,i=h}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},EH=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function BE(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Ou=2147483647,TH=256,yN=class wb{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>TH)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new wb;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)n.addSubParam(r[o]);else n.addParam(r)}return n}clone(){let t=new wb(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ou?Ou:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ou?Ou:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-n>0?this._subParams.subarray(n,i):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&(t[n]=this._subParams.slice(i,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[n-1];i[n-1]=~r?Math.min(r*10+t,Ou):t}},Du=[],AH=class{constructor(){this._state=0,this._active=Du,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Du}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Du,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Du,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",lm(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].end(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=Du,this._id=-1,this._state=0}}},hs=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,i){this._hitLimit||(this._data+=lm(t,n,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,n}},Iu=[],RH=class{constructor(){this._handlers=Object.create(null),this._active=Iu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Iu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Iu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Iu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",lm(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].unhook(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=Iu,this._ident=0}},nd=new yN;nd.addParam(0);var PE=class{constructor(e){this._handler=e,this._data="",this._params=nd,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():nd,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=lm(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=nd,this._data="",this._hitLimit=!1,n));return this._params=nd,this._data="",this._hitLimit=!1,t}},NH=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|i}},Ds=160,LH=(function(){let e=new NH(4095),t=Array.apply(null,Array(256)).map((h,p)=>p),n=(h,p)=>t.slice(h,p),i=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let o=n(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in o)e.addMany([24,26,153,154],u,3,0),e.addMany(n(128,144),u,3,0),e.addMany(n(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ds,0,2,0),e.add(Ds,8,5,8),e.add(Ds,6,0,6),e.add(Ds,11,0,11),e.add(Ds,13,13,13),e})(),MH=class extends Et{constructor(e=LH){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new yN,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(xn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new AH),this._dcsParser=this._register(new RH),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=i,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let i=this._escHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let i=this._csiHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,n){let i=0,r=0,o=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(u=h[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(u=h[p](),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,n),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],u=this._oscParser.end(i!==24&&i!==26,n),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<t;++h){switch(i=e[h],r=this._transitions.table[this.currentState<<8|(i<160?i:Ds)],r>>4){case 2:for(let b=h+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Ds){this._printHandler(e,h,b),h=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(u=p[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._preserveStack(3,p,f,r,h),u;f<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++h<t&&(i=e[h])>47&&i<60);h--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let m=this._escHandlers[this._collect<<8|i],_=m?m.length-1:-1;for(;_>=0&&(u=m[_](),u!==!0);_--)if(u instanceof Promise)return this._preserveStack(4,m,_,r,h),u;_<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let b=h+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<Ds){this._dcsParser.put(e,h,b),h=b-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,r,h),u;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=h+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<Ds){this._oscParser.put(e,h,b),h=b-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,r,h),u;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},jH=/^([\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})$/,OH=/^[\da-f]+$/;function $E(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=jH.exec(t);if(n){let i=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/i*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/i*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),OH.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(n*r,n*r+n),16);i[r]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return i}}function pv(e,t){let n=e.toString(16),i=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function DH(e,t=16){let[n,i,r]=e;return`rgb:${pv(n,t)}/${pv(i,t)}/${pv(r,t)}`}var IH={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ha=131072,zE=10;function HE(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var FE=5e3,UE=0,BH=class extends Et{constructor(e,t,n,i,r,o,u,h,p=new MH){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=u,this._unicodeService=h,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new n9,this._utf8Decoder=new i9,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Wn.clone(),this._eraseAttrDataInternal=Wn.clone(),this._onRequestBell=this._register(new ke),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ke),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ke),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ke),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ke),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ke),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ke),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ke),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ke),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ke),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ke),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ke),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ke),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 xb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,m)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:m.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,m,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:m,data:_})}),this._parser.setDcsHandlerFallback((f,m,_)=>{m==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:m,payload:_})}),this._parser.setPrintHandler((f,m,_)=>this.print(f,m,_)),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(ye.BEL,()=>this.bell()),this._parser.setExecuteHandler(ye.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ye.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ye.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ye.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ye.BS,()=>this.backspace()),this._parser.setExecuteHandler(ye.HT,()=>this.tab()),this._parser.setExecuteHandler(ye.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ye.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Vf.IND,()=>this.index()),this._parser.setExecuteHandler(Vf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Vf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new hs(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new hs(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new hs(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new hs(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new hs(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new hs(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new hs(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new hs(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new hs(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new hs(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new hs(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new hs(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(let f in ei)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 PE((f,m)=>this.requestStatusString(f,m)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),FE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${FE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,u=this._parseStack.paused;if(u){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ha&&(o=this._parseStack.position+Ha)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ha&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ha))),u||this._dirtyRowTracker.clearRange(),e.length>Ha)for(let f=o;f<e.length;f+=Ha){let m=f+Ha<e.length?f+Ha:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(f,m),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,m),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(i,r,_,f),this._logSlowResolvingAsync(n),n}else if(!u){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,r,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,n){let i,r,o=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,m=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let D=o[String.fromCharCode(i)];D&&(i=D.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=Bo.extractWidth(w);let x=Bo.extractShouldJoin(w),C=x?Bo.extractWidth(b):0;if(b=w,u&&this._onA11yChar.fire(Ka(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-C>h){if(p){let D=_,z=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&_ instanceof ed&&_.copyCellsFrom(D,z,0,C,!1);z<h;)D.setCellFromCodepoint(z++,0,1,m)}else if(this._activeBuffer.x=h-1,r===2)continue}if(x&&this._activeBuffer.x){let D=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-D,i,r);for(let z=r-C;--z>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(f&&(_.insertCells(this._activeBuffer.x,r-C,this._activeBuffer.getNullCell(m)),_.getWidth(h-1)===2&&_.setCellFromCodepoint(h-1,0,1,m)),_.setCellFromCodepoint(this._activeBuffer.x++,i,r,m),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=b,this._activeBuffer.x<h&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,m),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>HE(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new PE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new hs(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Wn));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,i=Bo.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),u=new Uint32Array(o.length*n),h=0;for(let f=0;f<o.length;){let m=o.codePointAt(f)||0;u[h++]=m,f+=m>65535?2:1}let p=h;for(let f=1;f<n;++f)u.copyWithin(p,0,h),p+=h;return this.print(u,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ye.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ye.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ye.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ye.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ye.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Do),this._charsetService.setgCharset(1,Do),this._charsetService.setgCharset(2,Do),this._charsetService.setgCharset(3,Do);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,u=this._coreService,{buffers:h,cols:p}=this._bufferService,{active:f,alt:m}=h,_=this._optionsService.rawOptions,b=(x,C)=>(u.triggerDataEvent(`${ye.ESC}[${t?"":"?"}${x};${C}$y`),!0),S=x=>x?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,S(u.modes.insertMode)):w===12?b(w,3):w===20?b(w,S(_.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):w===6?b(w,S(i.origin)):w===7?b(w,S(i.wraparound)):w===8?b(w,3):w===9?b(w,S(r==="X10")):w===12?b(w,S(_.cursorBlink)):w===25?b(w,S(!u.isCursorHidden)):w===45?b(w,S(i.reverseWraparound)):w===66?b(w,S(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,S(r==="VT200")):w===1002?b(w,S(r==="DRAG")):w===1003?b(w,S(r==="ANY")):w===1004?b(w,S(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,S(o==="SGR")):w===1015?b(w,4):w===1016?b(w,S(o==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,S(f===m)):w===2004?b(w,S(i.bracketedPasteMode)):w===2026?b(w,S(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,n,i,r){return t===2?(e|=50331648,e&=-16777216,e|=Id.fromColorRGB([n,i,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let u=e.getSubParams(t+o),h=0;do i[1]===5&&(r=1),i[o+h+1+r]=u[h];while(++h<u.length&&h+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let u=2;u<i.length;++u)i[u]===-1&&(i[u]=0);switch(i[0]){case 38:n.fg=this._updateAttrColor(n.fg,i[1],i[3],i[4],i[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,i[1],i[3],i[4],i[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Wn.fg,e.bg=Wn.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,i=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(i.fg&=-50331904,i.fg|=16777216|n-30):n>=40&&n<=47?(i.bg&=-50331904,i.bg|=16777216|n-40):n>=90&&n<=97?(i.fg&=-50331904,i.fg|=16777216|n-90|8):n>=100&&n<=107?(i.bg&=-50331904,i.bg|=16777216|n-100|8):n===0?this._processSGR0(i):n===1?i.fg|=134217728:n===3?i.bg|=67108864:n===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):n===5?i.fg|=536870912:n===7?i.fg|=67108864:n===8?i.fg|=1073741824:n===9?i.fg|=2147483648:n===2?i.bg|=134217728:n===21?this._processUnderline(2,i):n===22?(i.fg&=-134217729,i.bg&=-134217729):n===23?i.bg&=-67108865:n===24?(i.fg&=-268435457,this._processUnderline(0,i)):n===25?i.fg&=-536870913:n===27?i.fg&=-67108865:n===28?i.fg&=-1073741825:n===29?i.fg&=2147483647:n===39?(i.fg&=-67108864,i.fg|=Wn.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=Wn.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,i):n===53?i.bg|=1073741824:n===55?i.bg&=-1073741825:n===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):n===100?(i.fg&=-67108864,i.fg|=Wn.fg&16777215,i.bg&=-67108864,i.bg|=Wn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ye.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ye.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ye.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Wn.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!HE(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ye.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>zE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>zE&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let i=n.shift(),r=n.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(WE(o))if(r==="?")t.push({type:0,index:o});else{let u=$E(r);u&&t.push({type:1,index:o,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(n,i):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),i,r=n.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let i=0;i<n.length&&!(t>=this._specialColors.length);++i,++t)if(n[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=$E(n[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let i=0;i<n.length;++i)if(/^\d+$/.exec(n[i])){let r=parseInt(n[i]);WE(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Do),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(IH[e[0]],ei[e[1]]||Do),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Wn.clone(),this._eraseAttrDataInternal=Wn.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new $s;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=u=>(this._coreService.triggerDataEvent(`${ye.ESC}${u}${ye.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},xb=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(UE=e,e=t,t=UE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};xb=Dn([He(0,Hi)],xb);function WE(e){return 0<=e&&e<256}var PH=5e7,qE=12,$H=50,zH=class extends Et{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ke),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>PH)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let u=h=>performance.now()-n>=qE?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(n,h);r.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(u);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=qE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$H&&(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()}},Cb=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(p,h)),this._dataByLinkId.set(p.id,p),p.id}let n=e,i=this._getEntryIdKey(n),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(u,o)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Cb=Dn([He(0,Hi)],Cb);var GE=!1,HH=class extends Et{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new vc),this._onBinary=this._register(new ke),this.onBinary=this._onBinary.event,this._onData=this._register(new ke),this.onData=this._onData.event,this._onLineFeed=this._register(new ke),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ke),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ke),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ke),this._instantiationService=new dH,this.optionsService=this._register(new SH(e)),this._instantiationService.setService(Fi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(yb)),this._instantiationService.setService(Hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(vb)),this._instantiationService.setService(PR,this._logService),this.coreService=this._register(this._instantiationService.createInstance(bb)),this._instantiationService.setService(tl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Sb)),this._instantiationService.setService(BR,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Bo)),this._instantiationService.setService(o9,this.unicodeService),this._charsetService=this._instantiationService.createInstance(EH),this._instantiationService.setService(a9,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Cb),this._instantiationService.setService($R,this._oscLinkService),this._inputHandler=this._register(new BH(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(wi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(wi.forward(this._bufferService.onResize,this._onResize)),this._register(wi.forward(this.coreService.onData,this._onData)),this._register(wi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new zH((t,n)=>this._inputHandler.parse(t,n))),this._register(wi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ke),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!GE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),GE=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,_N),t=Math.max(t,vN),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(BE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(BE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xn(()=>{for(let t of e)t.dispose()})}}},FH={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function UH(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=ye.ESC+"OA":r.key=ye.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=ye.ESC+"OD":r.key=ye.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=ye.ESC+"OC":r.key=ye.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=ye.ESC+"OB":r.key=ye.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":ye.DEL,e.altKey&&(r.key=ye.ESC+r.key);break;case 9:if(e.shiftKey){r.key=ye.ESC+"[Z";break}r.key=ye.HT,r.cancel=!0;break;case 13:r.key=e.altKey?ye.ESC+ye.CR:ye.CR,r.cancel=!0;break;case 27:r.key=ye.ESC,e.altKey&&(r.key=ye.ESC+ye.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=ye.ESC+"[1;"+(o+1)+"D":t?r.key=ye.ESC+"OD":r.key=ye.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=ye.ESC+"[1;"+(o+1)+"C":t?r.key=ye.ESC+"OC":r.key=ye.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=ye.ESC+"[1;"+(o+1)+"A":t?r.key=ye.ESC+"OA":r.key=ye.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=ye.ESC+"[1;"+(o+1)+"B":t?r.key=ye.ESC+"OB":r.key=ye.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=ye.ESC+"[2~");break;case 46:o?r.key=ye.ESC+"[3;"+(o+1)+"~":r.key=ye.ESC+"[3~";break;case 36:o?r.key=ye.ESC+"[1;"+(o+1)+"H":t?r.key=ye.ESC+"OH":r.key=ye.ESC+"[H";break;case 35:o?r.key=ye.ESC+"[1;"+(o+1)+"F":t?r.key=ye.ESC+"OF":r.key=ye.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=ye.ESC+"[5;"+(o+1)+"~":r.key=ye.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=ye.ESC+"[6;"+(o+1)+"~":r.key=ye.ESC+"[6~";break;case 112:o?r.key=ye.ESC+"[1;"+(o+1)+"P":r.key=ye.ESC+"OP";break;case 113:o?r.key=ye.ESC+"[1;"+(o+1)+"Q":r.key=ye.ESC+"OQ";break;case 114:o?r.key=ye.ESC+"[1;"+(o+1)+"R":r.key=ye.ESC+"OR";break;case 115:o?r.key=ye.ESC+"[1;"+(o+1)+"S":r.key=ye.ESC+"OS";break;case 116:o?r.key=ye.ESC+"[15;"+(o+1)+"~":r.key=ye.ESC+"[15~";break;case 117:o?r.key=ye.ESC+"[17;"+(o+1)+"~":r.key=ye.ESC+"[17~";break;case 118:o?r.key=ye.ESC+"[18;"+(o+1)+"~":r.key=ye.ESC+"[18~";break;case 119:o?r.key=ye.ESC+"[19;"+(o+1)+"~":r.key=ye.ESC+"[19~";break;case 120:o?r.key=ye.ESC+"[20;"+(o+1)+"~":r.key=ye.ESC+"[20~";break;case 121:o?r.key=ye.ESC+"[21;"+(o+1)+"~":r.key=ye.ESC+"[21~";break;case 122:o?r.key=ye.ESC+"[23;"+(o+1)+"~":r.key=ye.ESC+"[23~";break;case 123:o?r.key=ye.ESC+"[24;"+(o+1)+"~":r.key=ye.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=ye.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=ye.DEL:e.keyCode===219?r.key=ye.ESC:e.keyCode===220?r.key=ye.FS:e.keyCode===221&&(r.key=ye.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let u=FH[e.keyCode]?.[e.shiftKey?1:0];if(u)r.key=ye.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(h);e.shiftKey&&(p=p.toUpperCase()),r.key=ye.ESC+p}else if(e.keyCode===32)r.key=ye.ESC+(e.ctrlKey?ye.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),r.key=ye.ESC+h,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=ye.US),e.key==="@"&&(r.key=ye.NUL));break}return r}var Pn=0,WH=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ap,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ap,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,o)=>this._getKey(r)-this._getKey(o)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[r]=e[t],t++):i[r]=this._array[n++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Pn=this._search(t),Pn===-1)||this._getKey(this._array[Pn])!==t)return!1;do if(this._array[Pn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Pn),!0;while(++Pn<this._array.length&&this._getKey(this._array[Pn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,n=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[i++]=this._array[r];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Pn=this._search(e),!(Pn<0||Pn>=this._array.length)&&this._getKey(this._array[Pn])===e))do yield this._array[Pn];while(++Pn<this._array.length&&this._getKey(this._array[Pn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Pn=this._search(e),!(Pn<0||Pn>=this._array.length)&&this._getKey(this._array[Pn])===e))do t(this._array[Pn]);while(++Pn<this._array.length&&this._getKey(this._array[Pn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let i=t+n>>1,r=this._getKey(this._array[i]);if(r>e)n=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},mv=0,KE=0,qH=class extends Et{constructor(){super(),this._decorations=new WH(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ke),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ke),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new GH(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,r=>{mv=r.options.x??0,KE=mv+(r.options.width??1),e>=mv&&e<KE&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},GH=class extends to{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ke),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ke),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Tn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Tn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},KH=1e3,VH=class{constructor(e,t=KH){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},VE=20,Rp=class extends Et{constructor(e,t,n,i){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new VH(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
93
+ `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(ft(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<VE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
94
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===VE+1&&(this._liveRegion.textContent+=Wy.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,i=n.lines.length.toString();for(let r=e;r<=t;r++){let o=n.lines.get(n.ydisp+r),u=[],h=o?.translateToString(!0,void 0,void 0,u)||"",p=(n.ydisp+r+1).toString(),f=this._rowElements[r];f&&(h.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=h,this._rowColumns.set(f,u)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let u,h;if(t===0?(u=n,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=n,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let r=({node:h,offset:p})=>{let f=h instanceof Text?h.parentNode:h,m=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(f);if(!_)return console.warn("columns is null. Race condition?"),null;let b=p<_.length?_[p]:_.slice(-1)[0]+1;return b>=this._terminal.cols&&(++m,b=0),{row:m,column:b}},o=r(t),u=r(n);if(!(!o||!u)){if(o.row>u.row||o.row===u.row&&o.column>=u.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(u.row-o.row)*this._terminal.cols-o.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let i=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Rp=Dn([He(1,n1),He(2,oa),He(3,la)],Rp);var kb=class extends Et{constructor(e,t,n,i,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ke),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ke),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xn(()=>{Zo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(ft(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ft(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ft(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ft(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let i=0;i<n.length;i++){let r=n[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let u=o?.map(h=>({link:h}));this._activeProviderReplies?.set(i,u),n=this._checkLinkProviderResult(i,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let u=r[o],h=u.link.range.start.y<e?0:u.link.range.start.x,p=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let f=h;f<=p;f++){if(n.has(f)){r.splice(o--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(u=>this._linkAtPosition(u.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let u=this._activeProviderReplies.get(o)?.find(h=>this._linkAtPosition(h.link,t));if(u){n=!0,this._handleNewLink(u);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&YH(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Zo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let i=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-i-1,n.end.x,n.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=i}_positionFromMouseEvent(e,t,n){let i=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,i,r){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:r}}};kb=Dn([He(1,i1),He(2,la),He(3,Hi),He(4,HR)],kb);function YH(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var XH=class extends HH{constructor(e={}){super(e),this._linkifier=this._register(new vc),this.browser=aN,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new vc),this._onCursorMove=this._register(new ke),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ke),this.onKey=this._onKey.event,this._onRender=this._register(new ke),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ke),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ke),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ke),this.onBell=this._onBell.event,this._onFocus=this._register(new ke),this._onBlur=this._register(new ke),this._onA11yCharEmitter=this._register(new ke),this._onA11yTabEmitter=this._register(new ke),this._onWillOpen=this._register(new ke),this._setup(),this._decorationService=this._instantiationService.createInstance(qH),this._instantiationService.setService(Bd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($z),this._instantiationService.setService(HR,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Gy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(wi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(wi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(wi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(wi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(xn(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,i="";switch(t.index){case 256:n="foreground",i="10";break;case 257:n="background",i="11";break;case 258:n="cursor",i="12";break;default:n="ansi",i="4;"+t.index}switch(t.type){case 0:let r=vn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ye.ESC}]${i};${DH(r)}${sN.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Gn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(u=>u[o]=Gn.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Rp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ye.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(ye.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,u=this.buffer.y*this._renderService.dimensions.css.cell.height,h=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=u+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ft(this.element,"copy",t=>{this.hasSelection()&&e9(t,this._selectionService)}));let e=t=>t9(t,this.textarea,this.coreService,this.optionsService);this._register(ft(this.textarea,"paste",e)),this._register(ft(this.element,"paste",e)),oN?this._register(ft(this.element,"mousedown",t=>{t.button===2&&sE(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ft(this.element,"contextmenu",t=>{sE(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),d1&&this._register(ft(this.element,"auxclick",t=>{t.button===1&&MR(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ft(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ft(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ft(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ft(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ft(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ft(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ft(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(ft(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Uy.get()),uN||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Bz,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(oa,this._coreBrowserService),this._register(ft(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(ft(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(fb,this._document,this._helperContainer),this._instantiationService.setService(cm,this._charSizeService),this._themeService=this._instantiationService.createInstance(_b),this._instantiationService.setService(Nc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ep),this._instantiationService.setService(zR,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(mb,this.rows,this.screenElement)),this._instantiationService.setService(la,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ub,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(pb),this._instantiationService.setService(i1,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(kb,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(lb,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(gb,this.element,this.screenElement,i)),this._instantiationService.setService(c9,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(wi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(cb,this.screenElement)),this._register(ft(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Rp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(hb,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let u=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!u)return!1;let h,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,h=o.button<3?o.button:3;break;case"mousedown":p=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let f=o.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;p=f<0?0:1,h=4;break;default:return!1}return p===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ft(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(ft(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let u=ye.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){LR(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=UH(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ye.ETX||n.key===ye.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(ZH(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Wn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ye.ESC+"[I"):this.coreService.triggerDataEvent(ye.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ye.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ye.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function ZH(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var JH=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},QH=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new $s)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},YE=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new QH(t)}getNullCell(){return new $s}},eF=class extends Et{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ke),this.onBufferChange=this._onBufferChange.event,this._normal=new YE(this._core.buffers.normal,"normal"),this._alternate=new YE(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)}},tF=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,i)=>t(n,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},nF=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},iF=["cols","rows"],hr=0,sF=class extends Et{constructor(e){super(),this._core=this._register(new XH(e)),this._addonManager=this._register(new JH),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(iF.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new tF(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nF(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 eF(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
95
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Uy.get()},set promptLabel(e){Uy.set(e)},get tooMuchOutput(){return Wy.get()},set tooMuchOutput(e){Wy.set(e)}}}_verifyIntegers(...e){for(hr of e)if(hr===1/0||isNaN(hr)||hr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(hr of e)if(hr&&(hr===1/0||isNaN(hr)||hr%1!==0||hr<0))throw new Error("This API only accepts positive integers")}};function rF(e){let t=!1,n=!1,i=!1,r=!1,o=null,u=null;const h=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},p=()=>{u!==null&&(clearTimeout(u),u=null),n=!1},f=()=>{p(),n=!0,u=setTimeout(()=>{u=null,n=!1},0)},m=()=>{i=!1,o!==null&&clearTimeout(o),u!==null&&(clearTimeout(u),u=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},_=()=>{t=!1,o===null&&(p(),i=!1)},b=()=>{t=!1,r=!1,p(),h()},S=w=>{if(o===null){if(t||n||oF(w)){i=!0,n&&!t?m():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),i&&m()},onCompositionCancel:_,handleKeyEvent(w){return aF(w)&&w.shiftKey?(w.preventDefault?.(),w.type==="keydown"?(r=!0,S(w)):w.type==="keypress"?(r||S(w),r=!1):w.type==="keyup"&&(r=!1),!1):!0},dispose:b}}function aF(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function oF(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function lF({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,u=!1;const h=()=>{o=!1,u=!1},p=b=>{XE(b)&&(o=!0,u=!1)},f=()=>{o&&(u=!0)},m=b=>{const S=o&&u&&XE(b);if(h(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},_=e.onSelectionChange(f);return t.addEventListener("mousedown",p,!0),n.addEventListener("mouseup",m),n.addEventListener("blur",h),{dispose:()=>{r||(r=!0,h(),_.dispose(),t.removeEventListener("mousedown",p,!0),n.removeEventListener("mouseup",m),n.removeEventListener("blur",h))}}}function XE(e){return e.button===0}function cF(e,t){return{activate(n,i){try{const r=new URL(i);if(r.protocol!=="http:"&&r.protocol!=="https:"||!t(r.href))return;e(r.href,"_blank","noopener,noreferrer")}catch{}}}}const uF={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:cF((e,t,n)=>window.open(e,t,n),e=>window.confirm(`Do you want to navigate to ${e}?
96
+
97
+ WARNING: This link could potentially be dangerous`)),lineHeight:1},dF="Symbols Nerd Font Mono",mf=`ui-monospace, "SF Mono", Menlo, "${dF}", monospace`,h1=14,bN=10,SN=22,hF={min:bN,max:SN},fF="cascadia",Cd=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${mf}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${mf}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${mf}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${mf}`,meta:"Variable · Adobe mono"}],ac=Cd[0];function pF(e){return Cd.find(t=>t.id===e)??ac}function kd(){return{source:"curated",id:fF,customName:"",family:ac.family,size:h1}}function f1(e,t){const n=pF(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:g1(t)}}function p1(e,t){const n=_F(e);return{source:"custom",id:null,customName:n,family:hp(n,ac.family),size:g1(t)}}function wN(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=g1(typeof t.size=="number"?t.size:h1);return t.source==="custom"&&typeof t.customName=="string"?p1(t.customName,n):typeof t.id=="string"&&gF(t.id)?f1(t.id,n):null}function m1(e){if(!e)return kd();try{const t=wN(JSON.parse(e));if(t!==null)return t}catch{}return kd()}function mF(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function g1(e){return Number.isFinite(e)?Math.min(SN,Math.max(bN,Math.round(e))):h1}function gF(e){return Cd.some(t=>t.id===e)}function _F(e){return Zp(e)}const Np="fleet-plugin.terminal.renderer",oc="fleet-plugin.terminal.font",ZE="fleet-console.terminalRenderer",JE="fleet-console.terminalFont",Eb=new Set;let no=NF(),Lp=null,Ko=0,gf=null;function vF(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(Np)!==null||window.localStorage.getItem(oc)!==null)return;const e=window.localStorage.getItem(ZE),t=window.localStorage.getItem(JE),n=e==="webgl"||e==="dom"?e:"webgl",i=m1(t);window.localStorage.setItem(Np,n),window.localStorage.setItem(oc,mF(i)),window.localStorage.removeItem(ZE),window.localStorage.removeItem(JE)}catch{}}function yF(e){Ko+=1,Lp=e,CF()}function xN(){return v.useSyncExternalStore(RF,QE,QE)}function bF(e){TF(e),yc({renderer:e})}function SF(e){const t=f1(e,no.font.size);Ko+=1,yc({font:t}),hm(t)}function wF(e){const t=p1(e,no.font.size);Ko+=1,yc({font:t}),hm(t)}function xF(e){const t=no.font.source==="custom"?p1(no.font.customName,e):f1(no.font.id,e);Ko+=1,yc({font:t}),hm(t)}async function CF(){if(!Lp)return;const e=Ko;try{const t=await Lp.read("terminal");if(t!==null){const n=wN(t.font);if(n!==null){if(e!==Ko)return;yc({font:n});try{window.localStorage.removeItem(oc)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(oc)}catch{}if(n!==null){const i=m1(n);if(e!==Ko)return;yc({font:i}),hm(i);try{window.localStorage.removeItem(oc)}catch{}}}}catch{}}async function hm(e){const t=Lp;if(t)try{await CN(t,{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function CN(e,t){const n=async()=>{const o=await e.read("terminal");await e.write("terminal",{...o??{},...t})},i=gf,r=i?i.catch(()=>{}).then(n):n();return gf=r,r.finally(()=>{gf===r&&(gf=null)}).catch(()=>{}),r}function kF(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(Np);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function EF(){if(typeof window>"u")return kd();try{return m1(window.localStorage.getItem(oc))}catch{return kd()}}function TF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Np,e)}catch{}}function AF(){for(const e of Eb)e()}function yc(e){no={...no,...e},AF()}function RF(e){return Eb.add(e),()=>{Eb.delete(e)}}function QE(){return no}function NF(){return typeof window>"u"?{renderer:"webgl",font:kd()}:(vF(),{renderer:kF(),font:EF()})}function e2({baseY:e,viewportY:t}){return t>=e}function LF(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:f,viewportY:m}=e.getViewport();n=Math.max(0,f-m)},o=()=>{if(n===null)return;const{baseY:f}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(f,f-n)))},u=()=>{if(t){e.scrollToBottom();return}o()},h=()=>{i===null&&(i=e.requestFrame(()=>{i=null,u()}))},p=()=>{t&&(u(),h())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=e2(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,p()},preserveAfterGeometryChange:f=>{f(),u(),h()},restoreAfterOutputParsing:()=>{if(t){p();return}e2(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function MF({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!jF(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function jF(e,t){return e.type==="keydown"&&/^win/i.test(t)&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey&&(e.code==="KeyC"||e.key.toLowerCase()==="c")}const OF="Symbols Nerd Font Mono",DF=`1em "${OF}"`,IF=650;let _f=null;function kN(){return _f||(_f=PF(),_f)}async function BF(){await $F(kN(),IF)}async function PF(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(DF)}catch{}}async function $F(e,t){await new Promise(n=>{let i=!1;const r=setTimeout(o,t);e.then(o,o);function o(){i||(i=!0,clearTimeout(r),n())}})}const zF=80,HF=16,FF=250,UF=1024*1024,WF=120,qF={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)"},GF={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)"},KF={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 _1({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,keyboardFocusRequestId:u,zoom:h=1}){const p=i,{renderer:f,font:m}=xN(),_=v.useRef(null),b=v.useRef(null),S=v.useRef(null),w=v.useRef(null),x=v.useRef(null),C=v.useRef(null),D=v.useRef(null),[z,F]=v.useState(h),N=v.useRef(r);N.current=r;const I=v.useRef(o);I.current=o;const[j,U]=v.useState("connecting"),[G,W]=v.useState(0),[Z,V]=v.useState(0);v.useEffect(()=>{const B=_.current;if(!B)return;let M=!1,k=null,T=null,R=null;return(async()=>{if(await BF(),M)return;const K=t2(p),L=new sF({...uF,fontFamily:m.family,fontSize:m.size*z,theme:K});b.current=L;const q=new HB;D.current=q,L.loadAddon(q),L.open(B),n2(B,K);const H=lF({terminal:L,selectionTarget:B,windowTarget:window,clipboard:navigator.clipboard});L.loadAddon(new pP),L.unicode.activeVersion="11";const ne=rF(()=>L.input(`
98
+ `)),oe=B.querySelector("textarea.xterm-helper-textarea, textarea")??B;oe.addEventListener("compositionstart",ne.onCompositionStart),oe.addEventListener("compositionend",ne.onCompositionEnd),oe.addEventListener("focusout",ne.onCompositionCancel);const Se=MF({getPlatform:()=>navigator.platform,getSelection:()=>L.getSelection(),writeText:je=>navigator.clipboard.writeText(je)});L.attachCustomKeyEventHandler(je=>Se.handleKeyEvent(je)&&ne.handleKeyEvent(je));const xe=LF({getViewport:()=>L.buffer.active,scrollToBottom:()=>VF(L),scrollToLine:je=>YF(L,je),requestFrame:je=>window.requestAnimationFrame(je),cancelFrame:je=>window.cancelAnimationFrame(je)});C.current=xe;const fe=XF(B,oe,xe.recordUserViewportChange),De=QF(L,I.current!==!1,xe.restoreAfterOutputParsing);x.current=De;const rt=OB({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:je=>L.onData(ze=>{xe.resumeFollowing(),je(ze)}),write:De.write},onExit:()=>N.current?.(),onStatus:(je,ze)=>{U(ze?`${je}: ${ze}`:je)}});S.current=rt;const Ie=()=>{xe.preserveAfterGeometryChange(()=>{q.fit(),rt.resize(L.cols,L.rows),L.refresh(0,L.rows-1)})},Ce=()=>{T&&clearTimeout(T),T=setTimeout(()=>{T=null,M||Ie()},zF)},Me=async()=>{await document.fonts?.ready,!M&&(Ie(),rt.start(),V(je=>je+1),I.current!==!1&&L.focus())};k=new ResizeObserver(Ce),k.observe(B),Me(),R=()=>{T&&clearTimeout(T),oe.removeEventListener("compositionstart",ne.onCompositionStart),oe.removeEventListener("compositionend",ne.onCompositionEnd),oe.removeEventListener("focusout",ne.onCompositionCancel),ne.dispose(),rt.dispose(),H.dispose(),fe.dispose(),De.dispose(),xe.dispose(),b.current=null,S.current=null,x.current=null,C.current=null,D.current=null;try{L.dispose()}catch{}},W(je=>je+1)})(),()=>{M=!0,k?.disconnect(),R?.()}},[e,t,n]),v.useEffect(()=>{x.current?.setActive(o!==!1),o&&(b.current?.focus(),C.current?.resumeFollowing())},[o,u,Z]),v.useEffect(()=>{const B=b.current;if(!B)return;let M=!1;if(f==="webgl")try{const k=new Y$;w.current=k,k.onContextLoss(()=>{if(!M){try{k.dispose()}catch{}w.current===k&&(w.current=null)}}),B.loadAddon(k)}catch{try{w.current?.dispose()}catch{}w.current=null}return()=>{M=!0;const k=w.current;if(k){w.current=null;try{k.dispose()}catch{}}}},[f,e,G]),v.useEffect(()=>{const B=b.current,M=_.current;if(!B||!M)return;const k=t2(p);B.options.theme=k,n2(M,k)},[p,G]),v.useEffect(()=>{const B=b.current;B&&(B.options.fontFamily=m.family,i2(B,D.current,S.current,C.current))},[m.family,G]),v.useEffect(()=>{if(h===z)return;const B=setTimeout(()=>F(h),WF);return()=>clearTimeout(B)},[h,z]),v.useEffect(()=>{const B=b.current;B&&(B.options.fontSize=m.size*z,i2(B,D.current,S.current,C.current))},[z,m.size,G]);const O=j.startsWith("live"),A=z===1?void 0:{width:`${z*100}%`,height:`${z*100}%`,transform:`scale(${1/z})`,transformOrigin:"0 0"};return c.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:c.jsxs("div",{className:"terminal-shell",children:[O?null:c.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[c.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),j]}),c.jsx("div",{className:"terminal-viewport",children:c.jsx("div",{className:"terminal-canvas",ref:_,style:A})})]})})}function t2(e){return e==="carbon"?KF:e==="maritime"?GF:qF}function n2(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function VF(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function YF(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function XF(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let r=!1,o=null;const u=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},h=()=>u(),p=()=>{r=!0},f=S=>{r=ZF(S,i)},m=()=>{r&&u()},_=()=>{const S=r;r=!1,S&&u()},b=S=>{JF(S)&&u()};return i.addEventListener("wheel",h,{capture:!0,passive:!0}),i.addEventListener("touchstart",p,{capture:!0,passive:!0}),i.addEventListener("touchend",_),i.addEventListener("touchcancel",_),i.addEventListener("pointerdown",f,!0),i.addEventListener("scroll",m),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",h,!0),i.removeEventListener("touchstart",p,!0),i.removeEventListener("touchend",_),i.removeEventListener("touchcancel",_),i.removeEventListener("pointerdown",f,!0),i.removeEventListener("scroll",m),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function ZF(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function JF(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function QF(e,t,n){let i=t,r=!1,o=null,u=0,h=[];const p=()=>{o&&(clearTimeout(o),o=null)},f=()=>{if(p(),r||u===0)return;const _=eU(h,u);h=[],u=0,e.write(_,()=>{r||n()})},m=()=>{r||o||u===0||(o=setTimeout(f,i?HF:FF))};return{write:_=>{if(!(r||_.byteLength===0)){if(h.push(_),u+=_.byteLength,u>=UF){f();return}m()}},setActive:_=>{if(i!==_){if(i=_,p(),i){f();return}m()}},dispose:()=>{f(),r=!0,h=[],u=0,p()}}}function eU(e,t){if(e.length===1)return e[0]??new Uint8Array;const n=new Uint8Array(t);let i=0;for(const r of e)n.set(r,i),i+=r.byteLength;return n}function i2(e,t,n,i){const r=()=>{t?.fit(),n?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(i){i.preserveAfterGeometryChange(r);return}r()}const tU=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),nU=50*1024;function Ed(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(Ed):Object.entries(e).some(([t,n])=>tU.has(t.toLowerCase())||Ed(n))}function iU(e){if(Ed(e)||!Qo(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(aU);return t.every(n=>n!==null)?{clis:t}:null}function sU(e){return Ed(e)||!Qo(e)||typeof e.type!="string"?null:e.type==="connected"?{type:"connected"}:(e.type==="chunk"||e.type==="thought")&&typeof e.text=="string"?{type:e.type,text:e.text}:e.type==="tool"&&typeof e.title=="string"&&typeof e.status=="string"?{type:"tool",title:e.title,status:e.status}:e.type==="complete"?{type:"complete"}:e.type==="error"&&EN(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&Qo(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&oU(e.artifact.html)<=nU?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function rU(e){return!Ed(e)&&Qo(e)&&EN(e.error)?e.error:null}function aU(e){if(!Qo(e)||typeof e.cliId!="string"||typeof e.label!="string"||typeof e.available!="boolean"||!Array.isArray(e.models))return null;const t=e.models.map(n=>Qo(n)&&typeof n.id=="string"&&typeof n.label=="string"&&Array.isArray(n.effortLevels)&&n.effortLevels.every(i=>typeof i=="string")?{id:n.id,label:n.label,effortLevels:n.effortLevels,defaultEffort:typeof n.defaultEffort=="string"?n.defaultEffort:void 0}:null);return t.every(n=>n!==null)?{cliId:e.cliId,label:e.label,available:e.available,defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0,models:t}:null}function EN(e){return Qo(e)&&typeof e.code=="string"&&typeof e.message=="string"}function Qo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function oU(e){return new TextEncoder().encode(e).byteLength}class Tb extends Error{constructor(t,n){super(n),this.code=t}code}const zd=e=>`analysis/${encodeURIComponent(e)}`,lU="/plugins/terminal/analysis/stream",cU={type:"error",error:{code:"analysis_session_not_found",message:"Analysis session was not found."}},TN=250,uU=4e3;let zs=null,bc=0,Ab=0,AN=new Set,v1=!1,lc=null,Zf=TN;const Vo=new Map;function dU(e,t,n,i){const r=new URLSearchParams({theme:t,canvas:n,foreground:i});return`/plugins/terminal/analysis/artifacts/${encodeURIComponent(e)}?${r.toString()}`}async function hU(e){const t=await pm(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=iU(n);if(i)return i;throw mm(t.status,n)}async function RN(e,t){try{const n=await pm(e,`${zd(t)}/ready`);if(!n.ok)return!1;const i=await n.json().catch(()=>null);return!!i&&typeof i=="object"&&!Array.isArray(i)&&i.ready===!0}catch{return!1}}async function fU(e,t,n,i){await b1(e,`${zd(t)}/start`,n,i)}async function pU(e,t,n){await b1(e,`${zd(t)}/message`,{text:n})}async function gv(e,t){await b1(e,`${zd(t)}/stop`,{})}async function NN(e,t){const n=await pm(e,`${zd(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw mm(n.status,await n.json().catch(()=>null))}function mU(e,t,n){return gU(t,n)}function gU(e,t){let n=Vo.get(e);return n||(n={listeners:new Set,confirmedEpoch:null},Vo.set(e,n)),n.listeners.add(t),vU(),queueMicrotask(()=>{n.listeners.has(t)&&zs?.readyState===EventSource.OPEN&&(!v1||!AN.has(e)||n.confirmedEpoch===null&&(n.confirmedEpoch=Ab,t({type:"connected"})))}),()=>{n.listeners.delete(t),n.listeners.size===0&&Vo.delete(e),_U()}}function fm(){for(const e of Vo.values())if(e.listeners.size>0)return!0;return!1}function y1(){v1=!1}function LN(){Zf=TN}function MN(){lc!==null&&(clearTimeout(lc),lc=null)}function _U(){fm()||(MN(),y1(),zs?.close(),zs=null,LN())}function jN(){MN(),y1(),zs?.close(),bc+=1;const e=bc,t=new EventSource(lU);zs=t,yU(t,e)}function vU(){if(!(zs&&zs.readyState!==EventSource.CLOSED)){if(zs?.readyState===EventSource.CLOSED){fm()&&ON();return}jN()}}function yU(e,t){e.onmessage=n=>{zs!==e||bc!==t||typeof n.data=="string"&&xU(n.data,t)},e.onerror=()=>{zs!==e||bc!==t||(y1(),e.readyState!==EventSource.CONNECTING&&e.readyState===EventSource.CLOSED&&fm()&&ON())}}function ON(){if(lc!==null)return;const e=Zf;Zf=Math.min(Zf*2,uU),lc=setTimeout(()=>{lc=null,fm()&&(zs!==null&&zs.readyState!==EventSource.CLOSED||jN())},e)}function Rb(e,t){const n=Vo.get(e);if(n)for(const i of n.listeners)i(t)}function bU(e,t){if(bc!==t)return;const n=new Set(e);for(const[i,r]of Vo)r.confirmedEpoch!==null&&!n.has(i)&&(Rb(i,cU),r.confirmedEpoch=null);Ab+=1,AN=n,v1=!0,LN();for(const i of e){const r=Vo.get(i);r&&(r.confirmedEpoch=Ab,Rb(i,{type:"connected"}))}}function DN(e,t){const n=Object.keys(e);return n.length===t.size&&n.every(i=>t.has(i))}function SU(e){if(!DN(e,new Set(["type","operationIds"]))||e.type!=="connected"||!Array.isArray(e.operationIds))return null;for(const t of e.operationIds)if(typeof t!="string")return null;return e.operationIds}function wU(e){if(!DN(e,new Set(["type","operationId","event"]))||e.type!=="event"||typeof e.operationId!="string"||!e.event||typeof e.event!="object"||Array.isArray(e.event))return null;const t=sU(e.event);return t?{operationId:e.operationId,event:t}:null}function xU(e,t){if(bc!==t)return;let n;try{n=JSON.parse(e)}catch{return}if(!n||typeof n!="object"||Array.isArray(n))return;const i=n,r=SU(i);if(r){bU(r,t);return}const o=wU(i);o&&Rb(o.operationId,o.event)}async function b1(e,t,n,i){const r=await pm(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),...i?{signal:i}:{}});if(!r.ok)throw mm(r.status,await r.json().catch(()=>null))}async function pm(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Ai?mm(i.status,i.body):i}}function mm(e,t){const n=rU(t);return new Tb(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const S1={"Walk me through how this session unfolded":"이 세션이 어떻게 진행됐는지 정리해 줘","What is the agent doing right now?":"에이전트가 지금 무엇을 하고 있어?","Flag anything I should review":"내가 검토해야 할 항목을 짚어 줘","Draft a handoff brief":"인수인계 브리프 초안을 작성해 줘","Draft a handoff brief and publish it as an artifact.":"인수인계 브리프 초안을 작성하고 아티팩트로 발행해 줘.","Flag anything I should review before this work continues.":"이 작업을 계속하기 전에 내가 검토해야 할 항목을 짚어 줘.","Walk me through how this session unfolded.":"이 세션이 어떻게 진행됐는지 정리해 줘","Go deeper on the last answer":"이전 답변 더 깊게 파기","Go deeper on your previous answer with more evidence citations.":"이전 답변을 근거 인용을 늘려 더 깊게 분석해 줘.","Check for intent drift":"의도 드리프트 점검","Review this session for intent drift against my stated goals.":"내가 정한 목표와 비교해 이 세션의 의도 드리프트를 검토해 줘.","Turn this into an artifact":"아티팩트로 만들기","Turn your previous answer into a published artifact.":"이전 답변을 아티팩트로 발행해 줘.","What is the agent doing now?":"에이전트 현재 상태","Current state — what the agent is doing right now":"현재 상태 — 에이전트가 지금 하고 있는 일","Intent drift review against settled goals":"확정된 목표 대비 의도 드리프트 검토","Handoff brief as an artifact":"아티팩트로 남기는 인수인계 브리프","Flag anything that needs review":"검토가 필요한 항목 표시","How the session unfolded, end to end":"세션 진행 경과 전체 타임라인","Session Analyst chat":"Session Analyst 채팅","Hide Artifacts":"아티팩트 닫기","Open Artifacts":"아티팩트 열기","The analyst is authoring an artifact…":"분석가가 아티팩트를 작성하는 중…","Artifacts the analyst publishes appear here":"분석가가 발행한 아티팩트가 여기에 표시됩니다",ARTIFACTS:"아티팩트","Session Analyst":"Session Analyst","Read-only intelligence for this operation":"이 오퍼레이션의 읽기 전용 인텔리전스",Reset:"초기화","Reset Session Analyst":"Session Analyst 초기화","Ask about this session":"이 세션에 대해 물어보세요","Review, explain, and summarize this session — without affecting the host agent.":"호스트 에이전트에 영향을 주지 않고 세션을 검토·설명·요약합니다.","Publishing an artifact":"아티팩트 발행 중","The analyst is authoring artifact content. It opens in Artifacts when it lands.":"분석가가 아티팩트 내용을 작성하고 있습니다. 완료되면 아티팩트에서 열립니다.","Artifact published — {title}":"아티팩트 발행됨 — {title}","Open in Artifacts":"아티팩트에서 열기","Stopped · last confirmed: {activity} · {elapsed}":"중지됨 · 마지막 확인: {activity} · {elapsed}","Last confirmed activity only":"마지막으로 확인된 활동만 표시","Starting analyst":"분석가 시작 중","Analyst connection confirmed":"분석가 연결 확인됨","Starting a new analysis session":"새 분석 세션 시작 중","Reasoning over session":"세션 분석 추론 중","Thought event received · content hidden":"사고 이벤트 수신 · 내용 숨김","Using {title}":"{title} 사용 중","Tool status: {status}":"도구 상태: {status}","Writing answer":"답변 작성 중","Answer chunk received":"답변 청크 수신","Needs attention":"확인 필요",Analyzing:"분석 중",Complete:"완료",Stopped:"중지됨",Ready:"준비됨",QUEUED:"대기 중","Cancel queued question {index + 1}":"대기 중인 질문 {index + 1} 취소","FOLLOW UP":"후속 질문","Analysis commands":"분석 명령","Initial analysis settings":"초기 분석 설정","Analysis CLI":"분석 CLI","Analysis model":"분석 모델","Analysis effort":"분석 Effort","n/a":"n/a","Ask about the session… (/ for commands)":"세션에 대해 질문하기… (/ 명령)",Stop:"중지","Queue question":"질문 대기열 추가",Send:"보내기","Enter queues the question — it fires when the analyst is ready":"Enter로 질문을 대기시킵니다 — 분석가가 준비되면 실행됩니다",Copied:"복사됨",Artifacts:"아티팩트","Visual outputs from this analysis":"이 분석의 시각적 결과물","Hide artifacts ({count} {item/items})":"아티팩트 닫기({count}개)","Show artifacts ({count} {item/items})":"아티팩트 보기({count}개)","Published artifacts":"발행된 아티팩트",Clear:"지우기","No artifacts yet":"아직 아티팩트 없음","Artifacts the analyst publishes will appear here.":"분석가가 발행한 아티팩트가 여기에 표시됩니다.","Selected artifact preview":"선택한 아티팩트 미리보기","Unknown time":"시간 알 수 없음","Exit Session Analyst":"Session Analyst 닫기","Open Session Analyst":"Session Analyst 열기","Send a message in this session first":"먼저 이 세션에서 메시지를 보내세요",EXIT:"닫기",ANALYZE:"분석","Analysis response timed out.":"분석 응답 시간이 초과됐습니다.","Analysis session ended — send again to restart.":"분석 세션이 종료됐습니다 — 다시 보내면 재시작합니다.","Stop failed: {message}":"중지 실패: {message}","Reset failed: {message}":"초기화 실패: {message}","Analysis is unavailable.":"분석을 사용할 수 없습니다.",Saved:"저장됨"},CU=Object.fromEntries(Object.keys(S1).map(e=>[e,e])),kU={en:CU,ko:S1};function $e(e,t,n={}){return kU[e][t].replace(/{([^{}]+)}/g,(i,r)=>Object.hasOwn(n,r)?String(n[r]):i)}function EU(e,t){return t.startsWith("Stop failed: ")?$e(e,"Stop failed: {message}",{message:t.slice(13)}):t.startsWith("Reset failed: ")?$e(e,"Reset failed: {message}",{message:t.slice(14)}):Object.hasOwn(S1,t)?$e(e,t):t}const TU=32,Nb={catalog:null,cliId:"",model:"",effort:"",draft:"",queue:[],started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],artifactAuthoring:null,artifactPublished:null,artifactsAutoOpenArmed:!0,selectionLocked:!1,selectionSaved:!1,error:null};function AU(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...s2(t.catalog,t.selection)};if(t.type==="select-cli"&&!e.started){const i=e.catalog?.clis.find(o=>o.cliId===t.cliId),r=i?.models.find(o=>o.id===i.defaultModel)??i?.models[0];return{...e,cliId:t.cliId,model:r?.id??"",effort:r?.defaultEffort??r?.effortLevels[0]??""}}if(t.type==="select-model"&&!e.started){const i=e.catalog?.clis.find(r=>r.cliId===e.cliId)?.models.find(r=>r.id===t.model);return{...e,model:t.model,effort:i?.defaultEffort??i?.effortLevels[0]??""}}if(t.type==="select-effort"&&!e.started)return{...e,effort:t.effort};if(t.type==="set-draft")return{...e,draft:t.draft};if(t.type==="queue-push")return{...e,queue:[...e.queue,t.text]};if(t.type==="queue-cancel")return t.index<0||t.index>=e.queue.length?e:{...e,queue:e.queue.filter((i,r)=>r!==t.index)};if(t.type==="queue-clear")return e.queue.length>0?{...e,queue:[]}:e;if(t.type==="sending")return{...e,started:e.started||t.started,busy:!0,phase:"starting",latestActivity:{kind:"starting",connected:!t.started},runStartedAt:t.now,runEndedAt:null,error:null,tools:[],artifactAuthoring:null,artifactPublished:null,entries:[...e.entries,{role:"user",text:t.text}]};if(t.type==="error")return Bu(e,t.message,t.now);if(t.type==="session-lost")return{...Bu(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...Bu(e,t.message,t.now),started:!1};if(t.type==="stopped")return{...e,queue:[],started:!1,busy:!1,phase:"stopped",runEndedAt:t.now,artifactAuthoring:null,error:null};if(t.type==="stop-failed")return{...Bu(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...Nb,catalog:i,selectionLocked:e.selectionLocked,...s2(i,t.selection)}:{...Nb,selectionLocked:e.selectionLocked}}if(t.type==="selection-lock")return e.selectionLocked===t.locked?e:{...e,selectionLocked:t.locked};if(t.type==="selection-saved")return{...e,selectionSaved:!0};if(t.type==="selection-saved-clear")return e.selectionSaved?{...e,selectionSaved:!1}:e;if(t.type==="clear-artifacts")return{...e,artifacts:[],artifactPublished:null,artifactsAutoOpenArmed:!0};if(t.type==="artifacts-chip-disarm")return e.artifactsAutoOpenArmed?{...e,artifactsAutoOpenArmed:!1}:e;if(t.type==="artifacts-chip-rearm")return e.artifactsAutoOpenArmed?e:{...e,artifactsAutoOpenArmed:!0};if(t.type!=="event")return e;const n=t.event;if(n.type==="connected")return e.phase==="starting"?{...e,latestActivity:{kind:"starting",connected:!0}}:e;if(n.type==="chunk")return{...e,phase:"writing",latestActivity:{kind:"writing"},entries:NU(e.entries,n.text)};if(n.type==="thought")return{...e,phase:"reasoning",latestActivity:{kind:"reasoning"}};if(n.type==="tool"){const i=n.status.toLowerCase(),r=n.title.toLowerCase().includes("publish_artifact")&&(i==="pending"||i==="in_progress");return{...e,phase:"tool",latestActivity:{kind:"tool",title:n.title,status:n.status},tools:[...e.tools.filter(o=>o.title!==n.title),{title:n.title,status:n.status}],...r?{artifactAuthoring:e.artifactAuthoring??{startedAt:t.now},artifactPublished:null}:{}}}return n.type==="artifact"?{...e,artifacts:[n.artifact,...e.artifacts.filter(i=>i.id!==n.artifact.id)].slice(0,TU),artifactPublished:{artifact:n.artifact,durationMs:e.artifactAuthoring?t.now-e.artifactAuthoring.startedAt:null},artifactAuthoring:null}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,artifactAuthoring:null,error:null}:Bu(e,n.error.message,t.now)}function RU(e){const t=e.clis.find(r=>r.cliId==="claude"&&r.available)??e.clis.find(r=>r.available)??e.clis[0],n=t?.models.find(r=>t.cliId==="claude"&&r.id==="sonnet")??t?.models.find(r=>r.id===t.defaultModel)??t?.models[0],i=n?.effortLevels.includes("medium")?"medium":n?.defaultEffort??n?.effortLevels[0]??"";return{cliId:t?.cliId??"",model:n?.id??"",effort:i}}function s2(e,t){const n=RU(e);if(!t)return n;const i=e.clis.find(m=>m.cliId===t.cliId&&m.available),r=i??e.clis.find(m=>m.cliId===n.cliId);if(!r)return n;const o=i?r.models.find(m=>m.id===r.defaultModel)??r.models[0]:r.models.find(m=>m.id===n.model)??r.models.find(m=>m.id===r.defaultModel)??r.models[0],h=r.models.find(m=>m.id===t.model)??o;if(!h)return{cliId:r.cliId,model:"",effort:""};const p=h.effortLevels.includes("medium")?"medium":h.defaultEffort??h.effortLevels[0]??"",f=h.effortLevels.length===0?t.effort===""?"":p:h.effortLevels.includes(t.effort)?t.effort:p;return{cliId:r.cliId,model:h.id,effort:f}}function Bu(e,t,n){return{...e,queue:[],busy:!1,phase:"error",runEndedAt:n,artifactAuthoring:null,error:t}}function NU(e,t){const n=e.at(-1);return n?.role==="analyst"?[...e.slice(0,-1),{role:"analyst",text:n.text+t}]:[...e,{role:"analyst",text:t}]}const Td=new Map,Pl=new Map;function IN(e){const t=LU(e.operationId,e.api,e.settings,e.language);return{state:v.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function LU(e,t,n,i){const r=Td.get(e);if(r)return r.updateContext(n,i),r;const o=IU(e,t,n,i);return Td.set(e,o),o}function MU(e){Td.get(e)?.dispose()}function jU(e){Td.get(e)?.dispatch({type:"artifacts-chip-rearm"})}const OU=2e3,DU=12e4;function IU(e,t,n,i){let r=Nb,o=n,u=i,h=null,p=!1,f=null,m=null,_=null,b=null,S=null,w=null,x=Promise.resolve(),C=0,D=null,z=0,F=0;const N=new Set,I=M=>{if(p)return;const k=M.type==="select-cli"||M.type==="select-model"||M.type==="select-effort";if(k&&r.selectionLocked)return;const T=AU(r,M);if(T!==r){k&&D!==null&&(clearTimeout(D),D=null),r=k&&T.selectionSaved?{...T,selectionSaved:!1}:T;for(const R of N)R();k&&j({cliId:r.cliId,model:r.model,effort:r.effort})}},j=M=>{const k=o;if(!k)return;const T=++C;x=x.then(async()=>{try{if(await CN(k,{analyst:{selection:M}}),h=M,p||T!==C)return;I({type:"selection-saved"}),D=setTimeout(()=>{D=null,I({type:"selection-saved-clear"})},1500)}catch{}})},U=()=>{m!==null&&(clearTimeout(m),m=null)},G=()=>{U(),m=setTimeout(()=>{m=null,I({type:"error",message:"Analysis response timed out.",now:Date.now()})},DU)},W=()=>{U(),z+=1,F+=1;const M=f;f=null,M?.()},Z=()=>{W(),I({type:"session-lost",now:Date.now()})},V=async()=>{if(f)return;const M=++z;let k=null;const T=new Promise(R=>{k=R});f=mU(t,e,R=>{if(M!==z||p)return;if(R.type==="connected"){I({type:"event",event:R,now:Date.now()}),k?.(),k=null;return}if(R.type==="error"&&a2(R.error.code)){k?.(),k=null,Z();return}(R.type==="complete"||R.type==="error")&&U();const $=R.type==="complete"?r.queue[0]:void 0;I({type:"event",event:R,now:Date.now()}),$!==void 0&&!r.busy&&!p&&M===z&&(I({type:"queue-cancel",index:0}),A.send($))}),await Promise.race([T,new Promise(R=>setTimeout(R,OU))])},A={getSnapshot:()=>r,subscribe:M=>(N.add(M),()=>N.delete(M)),dispatch:I,send:async M=>{const k=Pl.get(e);if(k&&await k,w)try{await w}catch{return}S&&await S;const T=M.trim();if(!T||r.busy||p)return;const R=!r.started,$=++F,K={cliId:r.cliId,model:r.model,effort:r.effort,...u?{language:u}:{}};if(I({type:"sending",started:R,text:T,now:Date.now()}),R){const L=new AbortController,q=fU(t,e,K,L.signal);b=L,_=q;try{await q}catch(H){if(p||$!==F)return;if(!(H instanceof Tb&&H.code==="analysis_session_exists")){I({type:"start-failed",message:Pu(H),now:Date.now()});return}}finally{b===L&&(b=null),_===q&&(_=null)}if(p||$!==F||!r.started||(await V(),$!==F||!r.started))return}try{if(await pU(t,e,T),$!==F||!r.busy||!r.started)return;G()}catch(L){if(p||$!==F)return;L instanceof Tb&&a2(L.code)?Z():I({type:"error",message:Pu(L),now:Date.now()})}},stop:async()=>{if(w){await w.catch(()=>{});return}if(S)return S;if(p||!r.started)return;W(),I({type:"stopped",now:Date.now()});const M=gv(t,e).catch(k=>{I({type:"stop-failed",message:Pu(k),now:Date.now()})});S=M,await M,S===M&&(S=null)},reset:async()=>{if(w)return w;if(p)return;I({type:"selection-lock",locked:!0});const M=r.started||r.phase!=="idle"||r.entries.length>0||r.artifacts.length>0;W();const k=(async()=>{S&&await S,_&&await _.catch(()=>{}),await x,M&&await gv(t,e),await NN(t,e).catch(()=>{}),I({type:"reset",selection:h})})().catch(T=>{throw I({type:"error",message:`Reset failed: ${Pu(T)}`,now:Date.now()}),T});w=k;try{await k}finally{w===k&&(w=null),I({type:"selection-lock",locked:!1})}},dispose:()=>{if(p)return;const M=Pl.get(e),k=w,T=S,R=_,$=x,K=b;p=!0,Td.delete(e),W(),D!==null&&clearTimeout(D),N.clear(),K?.abort();const L=(async()=>{M&&await M,R&&await R.catch(()=>{}),k&&await k.catch(()=>{}),T&&await T.catch(()=>{}),await $,await gv(t,e)})().catch(()=>{});Pl.set(e,L),L.finally(()=>{Pl.get(e)===L&&Pl.delete(e)})},updateContext:(M,k)=>{M&&(o=M),u=k}};return(Pl.get(e)??Promise.resolve()).then(()=>Promise.all([hU(t),BU(o)])).then(([M,k])=>{h=k,I({type:"catalog",catalog:M,selection:k})}).catch(M=>I({type:"error",message:Pu(M),now:Date.now()})),A}async function BU(e){if(!e)return null;try{const t=await e.read("terminal");if(!t)return null;const n=r2(t.analyst),i=r2(n.selection);return typeof i.cliId=="string"&&typeof i.model=="string"&&typeof i.effort=="string"?{cliId:i.cliId,model:i.model,effort:i.effort}:null}catch{return null}}function r2(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Pu(e){return e instanceof Error?e.message:"Analysis is unavailable."}function a2(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function PU({context:e}){const{state:t,dispatch:n}=IN(e),i=e.language??"en",r=v.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),o=t.artifacts[0]?.id??null,[u,h]=v.useState(null),[p,f]=v.useState(!1),m=v.useId(),_=v.useRef(null);v.useEffect(()=>{o&&h(o)},[o]);const b=r.find(w=>w.id===u)??r.at(-1)??null,S=r.length;return v.useEffect(()=>{if(!p)return;const w=C=>{C.target instanceof Node&&!_.current?.contains(C.target)&&f(!1)},x=C=>{C.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",w),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("keydown",x)}},[p]),v.useEffect(()=>{S||f(!1)},[S]),c.jsxs("section",{className:"session-analyst__artifacts","aria-label":$e(i,"Artifacts"),children:[c.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[c.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:$e(i,"Artifacts")}),c.jsx("small",{children:$e(i,"Visual outputs from this analysis")})]}),c.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:_,children:[c.jsxs("button",{type:"button",className:"session-analyst__artifact-count","aria-expanded":p,"aria-controls":m,"aria-haspopup":"listbox","aria-label":$e(i,p?"Hide artifacts ({count} {item/items})":"Show artifacts ({count} {item/items})",{count:S,"item/items":S===1?"item":"items"}),onClick:()=>f(w=>!w),disabled:!S,children:[c.jsx("strong",{children:S})," ",c.jsx("span",{children:i==="ko"?"개":S===1?"item":"items"}),c.jsx("i",{"aria-hidden":"true"})]}),p?c.jsx("div",{className:"session-analyst__artifact-menu",id:m,role:"listbox","aria-label":$e(i,"Published artifacts"),children:r.map(w=>{const x=w.id===b?.id;return c.jsxs("button",{type:"button",role:"option","aria-selected":x,className:x?"is-active":void 0,title:w.title,onClick:()=>{h(w.id),f(!1)},children:[c.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),c.jsx("strong",{children:w.title}),c.jsx(BN,{createdAt:w.createdAt,language:i})]},w.id)})}):null]}),c.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{f(!1),n({type:"clear-artifacts"}),NN(e.api,e.operationId).catch(()=>{})},disabled:!S,children:$e(i,"Clear")})]}),S===0?c.jsxs("div",{className:"session-analyst__artifacts-empty",children:[c.jsx("strong",{children:$e(i,"No artifacts yet")}),$e(i,"Artifacts the analyst publishes will appear here.")]}):c.jsx("div",{className:"session-analyst__artifact-content",children:b?c.jsx($U,{artifact:b,theme:e.theme,language:i},b.id):null})]})}function $U({artifact:e,theme:t,language:n}){if(!e.id)return null;const i=getComputedStyle(document.documentElement),r=i.getPropertyValue("--ink-veil").trim()||"Canvas",o=i.getPropertyValue("--ink-pearl").trim()||"CanvasText";return c.jsxs("article",{"aria-label":$e(n,"Selected artifact preview"),children:[c.jsxs("header",{children:[c.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),c.jsx(BN,{createdAt:e.createdAt,language:n})]}),c.jsx("iframe",{title:e.title,src:dU(e.id,t,r,o),sandbox:"allow-scripts"})]})}function BN({createdAt:e,language:t}){const n=new Date(e),i=Number.isFinite(n.getTime());return c.jsx("time",{dateTime:i?n.toISOString():void 0,children:i?n.toLocaleTimeString(t==="ko"?"ko-KR":"en",{hour:"2-digit",minute:"2-digit"}):$e(t,"Unknown time")})}const zU="modulepreload",HU=function(e){return"/console/"+e},o2={},FU=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let p=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");r=p(n.map(f=>{if(f=HU(f),f in o2)return;o2[f]=!0;const m=f.endsWith(".css"),_=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${_}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":zU,m||(b.as="script"),b.crossOrigin="",b.href=f,h&&b.setAttribute("nonce",h),document.head.appendChild(b),m)return new Promise((S,w)=>{b.addEventListener("load",S),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return r.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};const{entries:PN,setPrototypeOf:l2,isFrozen:UU,getPrototypeOf:WU,getOwnPropertyDescriptor:qU}=Object;let{freeze:zi,seal:Fs,create:Wl}=Object,{apply:Lb,construct:Mb}=typeof Reflect<"u"&&Reflect;zi||(zi=function(t){return t});Fs||(Fs=function(t){return t});Lb||(Lb=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];return t.apply(n,r)});Mb||(Mb=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return new t(...i)});const $u=Kn(Array.prototype.forEach),GU=Kn(Array.prototype.lastIndexOf),c2=Kn(Array.prototype.pop),zu=Kn(Array.prototype.push),KU=Kn(Array.prototype.splice),Di=Array.isArray,id=Kn(String.prototype.toLowerCase),_v=Kn(String.prototype.toString),u2=Kn(String.prototype.match),$l=Kn(String.prototype.replace),d2=Kn(String.prototype.indexOf),VU=Kn(String.prototype.trim),YU=Kn(Number.prototype.toString),XU=Kn(Boolean.prototype.toString),h2=typeof BigInt>"u"?null:Kn(BigInt.prototype.toString),f2=typeof Symbol>"u"?null:Kn(Symbol.prototype.toString),Ln=Kn(Object.prototype.hasOwnProperty),Hu=Kn(Object.prototype.toString),Si=Kn(RegExp.prototype.test),vf=ZU(TypeError);function Kn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Lb(e,t,i)}}function ZU(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Mb(e,n)}}function wt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:id;if(l2&&l2(e,null),!Di(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&(UU(t)||(t[i]=o),r=o)}e[r]=!0}return e}function JU(e){for(let t=0;t<e.length;t++)Ln(e,t)||(e[t]=null);return e}function Ji(e){const t=Wl(null);for(const[n,i]of PN(e))Ln(e,n)&&(Di(i)?t[n]=JU(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ji(i):t[n]=i);return t}function QU(e){switch(typeof e){case"string":return e;case"number":return YU(e);case"boolean":return XU(e);case"bigint":return h2?h2(e):"0";case"symbol":return f2?f2(e):"Symbol()";case"undefined":return Hu(e);case"function":case"object":{if(e===null)return Hu(e);const t=e,n=ql(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:Hu(i)}return Hu(e)}default:return Hu(e)}}function ql(e,t){for(;e!==null;){const i=qU(e,t);if(i){if(i.get)return Kn(i.get);if(typeof i.value=="function")return Kn(i.value)}e=WU(e)}function n(){return null}return n}function eW(e){try{return Si(e,""),!0}catch{return!1}}const p2=zi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),vv=zi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),yv=zi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),tW=zi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),bv=zi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),nW=zi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),m2=zi(["#text"]),g2=zi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Sv=zi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_2=zi(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),yf=zi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),iW=Fs(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sW=Fs(/<%[\w\W]*|[\w\W]*%>/gm),rW=Fs(/\$\{[\w\W]*/gm),aW=Fs(/^data-[\-\w.\u00B7-\uFFFF]+$/),oW=Fs(/^aria-[\-\w]+$/),$N=Fs(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lW=Fs(/^(?:\w+script|data):/i),cW=Fs(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zN=Fs(/^html$/i),uW=Fs(/^[a-z][.\w]*(-[.\w]+)+$/i);var v2=Object.freeze({__proto__:null,ARIA_ATTR:oW,ATTR_WHITESPACE:cW,CUSTOM_ELEMENT:uW,DATA_ATTR:aW,DOCTYPE_NAME:zN,ERB_EXPR:sW,IS_ALLOWED_URI:$N,IS_SCRIPT_OR_DATA:lW,MUSTACHE_EXPR:iW,TMPLIT_EXPR:rW});const Fu={element:1,text:3,progressingInstruction:7,comment:8,document:9},dW=function(){return typeof window>"u"?null:window},hW=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},y2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function HN(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dW();const t=Ve=>HN(Ve);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Fu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:u,Node:h,Element:p,NodeFilter:f,NamedNodeMap:m=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:_,DOMParser:b,trustedTypes:S}=e,w=p.prototype,x=ql(w,"cloneNode"),C=ql(w,"remove"),D=ql(w,"nextSibling"),z=ql(w,"childNodes"),F=ql(w,"parentNode");if(typeof u=="function"){const Ve=n.createElement("template");Ve.content&&Ve.content.ownerDocument&&(n=Ve.content.ownerDocument)}let N,I="";const{implementation:j,createNodeIterator:U,createDocumentFragment:G,getElementsByTagName:W}=n,{importNode:Z}=i;let V=y2();t.isSupported=typeof PN=="function"&&typeof F=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:A,TMPLIT_EXPR:B,DATA_ATTR:M,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:$}=v2;let{IS_ALLOWED_URI:K}=v2,L=null;const q=wt({},[...p2,...vv,...yv,...bv,...m2]);let H=null;const ne=wt({},[...g2,...Sv,..._2,...yf]);let oe=Object.seal(Wl(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}})),Se=null,xe=null;const fe=Object.seal(Wl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,rt=!0,Ie=!1,Ce=!0,Me=!1,je=!0,ze=!1,bt=!1,pt=!1,vt=!1,lt=!1,de=!1,ut=!0,tt=!1;const Vt="user-content-";let st=!0,zt=!1,Ft={},we=null;const Oe=wt({},["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 cn=null;const ti=wt({},["audio","video","img","source","image","track"]);let ni=null;const We=wt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let $t=Tt,Cn=!1,ee=null;const le=wt({},[gt,xt,Tt],_v);let Be=wt({},["mi","mo","mn","ms","mtext"]),Le=wt({},["annotation-xml"]);const Fe=wt({},["title","style","font","a","script"]);let it=null;const X=["application/xhtml+xml","text/html"],ue="text/html";let be=null,Ge=null;const At=n.createElement("form"),jt=function(Y){return Y instanceof RegExp||Y instanceof Function},Re=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ge&&Ge===Y)return;(!Y||typeof Y!="object")&&(Y={}),Y=Ji(Y),it=X.indexOf(Y.PARSER_MEDIA_TYPE)===-1?ue:Y.PARSER_MEDIA_TYPE,be=it==="application/xhtml+xml"?_v:id,L=Ln(Y,"ALLOWED_TAGS")&&Di(Y.ALLOWED_TAGS)?wt({},Y.ALLOWED_TAGS,be):q,H=Ln(Y,"ALLOWED_ATTR")&&Di(Y.ALLOWED_ATTR)?wt({},Y.ALLOWED_ATTR,be):ne,ee=Ln(Y,"ALLOWED_NAMESPACES")&&Di(Y.ALLOWED_NAMESPACES)?wt({},Y.ALLOWED_NAMESPACES,_v):le,ni=Ln(Y,"ADD_URI_SAFE_ATTR")&&Di(Y.ADD_URI_SAFE_ATTR)?wt(Ji(We),Y.ADD_URI_SAFE_ATTR,be):We,cn=Ln(Y,"ADD_DATA_URI_TAGS")&&Di(Y.ADD_DATA_URI_TAGS)?wt(Ji(ti),Y.ADD_DATA_URI_TAGS,be):ti,we=Ln(Y,"FORBID_CONTENTS")&&Di(Y.FORBID_CONTENTS)?wt({},Y.FORBID_CONTENTS,be):Oe,Se=Ln(Y,"FORBID_TAGS")&&Di(Y.FORBID_TAGS)?wt({},Y.FORBID_TAGS,be):Ji({}),xe=Ln(Y,"FORBID_ATTR")&&Di(Y.FORBID_ATTR)?wt({},Y.FORBID_ATTR,be):Ji({}),Ft=Ln(Y,"USE_PROFILES")?Y.USE_PROFILES&&typeof Y.USE_PROFILES=="object"?Ji(Y.USE_PROFILES):Y.USE_PROFILES:!1,De=Y.ALLOW_ARIA_ATTR!==!1,rt=Y.ALLOW_DATA_ATTR!==!1,Ie=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=Y.SAFE_FOR_TEMPLATES||!1,je=Y.SAFE_FOR_XML!==!1,ze=Y.WHOLE_DOCUMENT||!1,vt=Y.RETURN_DOM||!1,lt=Y.RETURN_DOM_FRAGMENT||!1,de=Y.RETURN_TRUSTED_TYPE||!1,pt=Y.FORCE_BODY||!1,ut=Y.SANITIZE_DOM!==!1,tt=Y.SANITIZE_NAMED_PROPS||!1,st=Y.KEEP_CONTENT!==!1,zt=Y.IN_PLACE||!1,K=eW(Y.ALLOWED_URI_REGEXP)?Y.ALLOWED_URI_REGEXP:$N,$t=typeof Y.NAMESPACE=="string"?Y.NAMESPACE:Tt,Be=Ln(Y,"MATHML_TEXT_INTEGRATION_POINTS")&&Y.MATHML_TEXT_INTEGRATION_POINTS&&typeof Y.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ji(Y.MATHML_TEXT_INTEGRATION_POINTS):wt({},["mi","mo","mn","ms","mtext"]),Le=Ln(Y,"HTML_INTEGRATION_POINTS")&&Y.HTML_INTEGRATION_POINTS&&typeof Y.HTML_INTEGRATION_POINTS=="object"?Ji(Y.HTML_INTEGRATION_POINTS):wt({},["annotation-xml"]);const _e=Ln(Y,"CUSTOM_ELEMENT_HANDLING")&&Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING=="object"?Ji(Y.CUSTOM_ELEMENT_HANDLING):Wl(null);if(oe=Wl(null),Ln(_e,"tagNameCheck")&&jt(_e.tagNameCheck)&&(oe.tagNameCheck=_e.tagNameCheck),Ln(_e,"attributeNameCheck")&&jt(_e.attributeNameCheck)&&(oe.attributeNameCheck=_e.attributeNameCheck),Ln(_e,"allowCustomizedBuiltInElements")&&typeof _e.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=_e.allowCustomizedBuiltInElements),Me&&(rt=!1),lt&&(vt=!0),Ft&&(L=wt({},m2),H=Wl(null),Ft.html===!0&&(wt(L,p2),wt(H,g2)),Ft.svg===!0&&(wt(L,vv),wt(H,Sv),wt(H,yf)),Ft.svgFilters===!0&&(wt(L,yv),wt(H,Sv),wt(H,yf)),Ft.mathMl===!0&&(wt(L,bv),wt(H,_2),wt(H,yf))),fe.tagCheck=null,fe.attributeCheck=null,Ln(Y,"ADD_TAGS")&&(typeof Y.ADD_TAGS=="function"?fe.tagCheck=Y.ADD_TAGS:Di(Y.ADD_TAGS)&&(L===q&&(L=Ji(L)),wt(L,Y.ADD_TAGS,be))),Ln(Y,"ADD_ATTR")&&(typeof Y.ADD_ATTR=="function"?fe.attributeCheck=Y.ADD_ATTR:Di(Y.ADD_ATTR)&&(H===ne&&(H=Ji(H)),wt(H,Y.ADD_ATTR,be))),Ln(Y,"ADD_URI_SAFE_ATTR")&&Di(Y.ADD_URI_SAFE_ATTR)&&wt(ni,Y.ADD_URI_SAFE_ATTR,be),Ln(Y,"FORBID_CONTENTS")&&Di(Y.FORBID_CONTENTS)&&(we===Oe&&(we=Ji(we)),wt(we,Y.FORBID_CONTENTS,be)),Ln(Y,"ADD_FORBID_CONTENTS")&&Di(Y.ADD_FORBID_CONTENTS)&&(we===Oe&&(we=Ji(we)),wt(we,Y.ADD_FORBID_CONTENTS,be)),st&&(L["#text"]=!0),ze&&wt(L,["html","head","body"]),L.table&&(wt(L,["tbody"]),delete Se.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw vf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');N=Y.TRUSTED_TYPES_POLICY,I=N.createHTML("")}else N===void 0&&(N=hW(S,r)),N!==null&&typeof I=="string"&&(I=N.createHTML(""));zi&&zi(Y),Ge=Y},Ae=wt({},[...vv,...yv,...tW]),et=wt({},[...bv,...nW]),fn=function(Y){let _e=F(Y);(!_e||!_e.tagName)&&(_e={namespaceURI:$t,tagName:"template"});const Q=id(Y.tagName),Ee=id(_e.tagName);return ee[Y.namespaceURI]?Y.namespaceURI===xt?_e.namespaceURI===Tt?Q==="svg":_e.namespaceURI===gt?Q==="svg"&&(Ee==="annotation-xml"||Be[Ee]):!!Ae[Q]:Y.namespaceURI===gt?_e.namespaceURI===Tt?Q==="math":_e.namespaceURI===xt?Q==="math"&&Le[Ee]:!!et[Q]:Y.namespaceURI===Tt?_e.namespaceURI===xt&&!Le[Ee]||_e.namespaceURI===gt&&!Be[Ee]?!1:!et[Q]&&(Fe[Q]||!Ae[Q]):!!(it==="application/xhtml+xml"&&ee[Y.namespaceURI]):!1},Rt=function(Y){zu(t.removed,{element:Y});try{F(Y).removeChild(Y)}catch{C(Y)}},Qt=function(Y,_e){try{zu(t.removed,{attribute:_e.getAttributeNode(Y),from:_e})}catch{zu(t.removed,{attribute:null,from:_e})}if(_e.removeAttribute(Y),Y==="is")if(vt||lt)try{Rt(_e)}catch{}else try{_e.setAttribute(Y,"")}catch{}},Li=function(Y){let _e=null,Q=null;if(pt)Y="<remove></remove>"+Y;else{const Ze=u2(Y,/^[\r\n\t ]+/);Q=Ze&&Ze[0]}it==="application/xhtml+xml"&&$t===Tt&&(Y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Y+"</body></html>");const Ee=N?N.createHTML(Y):Y;if($t===Tt)try{_e=new b().parseFromString(Ee,it)}catch{}if(!_e||!_e.documentElement){_e=j.createDocument($t,"template",null);try{_e.documentElement.innerHTML=Cn?I:Ee}catch{}}const Qe=_e.body||_e.documentElement;return Y&&Q&&Qe.insertBefore(n.createTextNode(Q),Qe.childNodes[0]||null),$t===Tt?W.call(_e,ze?"html":"body")[0]:ze?_e.documentElement:Qe},ys=function(Y){return U.call(Y.ownerDocument||Y,Y,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Ci=function(Y){return Y instanceof _&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof m)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},en=function(Y){return typeof h=="function"&&Y instanceof h};function tn(Ve,Y,_e){$u(Ve,Q=>{Q.call(t,Y,_e,Ge)})}const ns=function(Y){let _e=null;if(tn(V.beforeSanitizeElements,Y,null),Ci(Y))return Rt(Y),!0;const Q=be(Y.nodeName);if(tn(V.uponSanitizeElement,Y,{tagName:Q,allowedTags:L}),je&&Y.hasChildNodes()&&!en(Y.firstElementChild)&&Si(/<[/\w!]/g,Y.innerHTML)&&Si(/<[/\w!]/g,Y.textContent)||je&&Y.namespaceURI===Tt&&Q==="style"&&en(Y.firstElementChild)||Y.nodeType===Fu.progressingInstruction||je&&Y.nodeType===Fu.comment&&Si(/<[/\w]/g,Y.data))return Rt(Y),!0;if(Se[Q]||!(fe.tagCheck instanceof Function&&fe.tagCheck(Q))&&!L[Q]){if(!Se[Q]&&Ws(Q)&&(oe.tagNameCheck instanceof RegExp&&Si(oe.tagNameCheck,Q)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(Q)))return!1;if(st&&!we[Q]){const Ee=F(Y)||Y.parentNode,Qe=z(Y)||Y.childNodes;if(Qe&&Ee){const Ze=Qe.length;for(let Ne=Ze-1;Ne>=0;--Ne){const dt=x(Qe[Ne],!0);Ee.insertBefore(dt,D(Y))}}}return Rt(Y),!0}return Y instanceof p&&!fn(Y)||(Q==="noscript"||Q==="noembed"||Q==="noframes")&&Si(/<\/no(script|embed|frames)/i,Y.innerHTML)?(Rt(Y),!0):(Me&&Y.nodeType===Fu.text&&(_e=Y.textContent,$u([O,A,B],Ee=>{_e=$l(_e,Ee," ")}),Y.textContent!==_e&&(zu(t.removed,{element:Y.cloneNode()}),Y.textContent=_e)),tn(V.afterSanitizeElements,Y,null),!1)},Us=function(Y,_e,Q){if(xe[_e]||ut&&(_e==="id"||_e==="name")&&(Q in n||Q in At))return!1;const Ee=H[_e]||fe.attributeCheck instanceof Function&&fe.attributeCheck(_e,Y);if(!(rt&&!xe[_e]&&Si(M,_e))){if(!(De&&Si(k,_e))){if(!Ee||xe[_e]){if(!(Ws(Y)&&(oe.tagNameCheck instanceof RegExp&&Si(oe.tagNameCheck,Y)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(Y))&&(oe.attributeNameCheck instanceof RegExp&&Si(oe.attributeNameCheck,_e)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(_e,Y))||_e==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&Si(oe.tagNameCheck,Q)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(Q))))return!1}else if(!ni[_e]){if(!Si(K,$l(Q,R,""))){if(!((_e==="src"||_e==="xlink:href"||_e==="href")&&Y!=="script"&&d2(Q,"data:")===0&&cn[Y])){if(!(Ie&&!Si(T,$l(Q,R,"")))){if(Q)return!1}}}}}}return!0},ua=wt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ws=function(Y){return!ua[id(Y)]&&Si($,Y)},Tr=function(Y){tn(V.beforeSanitizeAttributes,Y,null);const{attributes:_e}=Y;if(!_e||Ci(Y))return;const Q={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let Ee=_e.length;for(;Ee--;){const Qe=_e[Ee],{name:Ze,namespaceURI:Ne,value:dt}=Qe,pe=be(Ze),Pe=dt;let qe=Ze==="value"?Pe:VU(Pe);if(Q.attrName=pe,Q.attrValue=qe,Q.keepAttr=!0,Q.forceKeepAttr=void 0,tn(V.uponSanitizeAttribute,Y,Q),qe=Q.attrValue,tt&&(pe==="id"||pe==="name")&&d2(qe,Vt)!==0&&(Qt(Ze,Y),qe=Vt+qe),je&&Si(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,qe)){Qt(Ze,Y);continue}if(pe==="attributename"&&u2(qe,"href")){Qt(Ze,Y);continue}if(Q.forceKeepAttr)continue;if(!Q.keepAttr){Qt(Ze,Y);continue}if(!Ce&&Si(/\/>/i,qe)){Qt(Ze,Y);continue}Me&&$u([O,A,B],Yt=>{qe=$l(qe,Yt," ")});const Ct=be(Y.nodeName);if(!Us(Ct,pe,qe)){Qt(Ze,Y);continue}if(N&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!Ne)switch(S.getAttributeType(Ct,pe)){case"TrustedHTML":{qe=N.createHTML(qe);break}case"TrustedScriptURL":{qe=N.createScriptURL(qe);break}}if(qe!==Pe)try{Ne?Y.setAttributeNS(Ne,Ze,qe):Y.setAttribute(Ze,qe),Ci(Y)?Rt(Y):c2(t.removed)}catch{Qt(Ze,Y)}}tn(V.afterSanitizeAttributes,Y,null)},Ui=function(Y){let _e=null;const Q=ys(Y);for(tn(V.beforeSanitizeShadowDOM,Y,null);_e=Q.nextNode();)tn(V.uponSanitizeShadowNode,_e,null),ns(_e),Tr(_e),_e.content instanceof o&&Ui(_e.content);tn(V.afterSanitizeShadowDOM,Y,null)};return t.sanitize=function(Ve){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_e=null,Q=null,Ee=null,Qe=null;if(Cn=!Ve,Cn&&(Ve="<!-->"),typeof Ve!="string"&&!en(Ve)&&(Ve=QU(Ve),typeof Ve!="string"))throw vf("dirty is not a string, aborting");if(!t.isSupported)return Ve;if(bt||Re(Y),t.removed=[],typeof Ve=="string"&&(zt=!1),zt){const dt=Ve.nodeName;if(typeof dt=="string"){const pe=be(dt);if(!L[pe]||Se[pe])throw vf("root node is forbidden and cannot be sanitized in-place")}}else if(Ve instanceof h)_e=Li("<!---->"),Q=_e.ownerDocument.importNode(Ve,!0),Q.nodeType===Fu.element&&Q.nodeName==="BODY"||Q.nodeName==="HTML"?_e=Q:_e.appendChild(Q);else{if(!vt&&!Me&&!ze&&Ve.indexOf("<")===-1)return N&&de?N.createHTML(Ve):Ve;if(_e=Li(Ve),!_e)return vt?null:de?I:""}_e&&pt&&Rt(_e.firstChild);const Ze=ys(zt?Ve:_e);for(;Ee=Ze.nextNode();)ns(Ee),Tr(Ee),Ee.content instanceof o&&Ui(Ee.content);if(zt)return Ve;if(vt){if(Me){_e.normalize();let dt=_e.innerHTML;$u([O,A,B],pe=>{dt=$l(dt,pe," ")}),_e.innerHTML=dt}if(lt)for(Qe=G.call(_e.ownerDocument);_e.firstChild;)Qe.appendChild(_e.firstChild);else Qe=_e;return(H.shadowroot||H.shadowrootmode)&&(Qe=Z.call(i,Qe,!0)),Qe}let Ne=ze?_e.outerHTML:_e.innerHTML;return ze&&L["!doctype"]&&_e.ownerDocument&&_e.ownerDocument.doctype&&_e.ownerDocument.doctype.name&&Si(zN,_e.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+_e.ownerDocument.doctype.name+`>
99
+ `+Ne),Me&&$u([O,A,B],dt=>{Ne=$l(Ne,dt," ")}),N&&de?N.createHTML(Ne):Ne},t.setConfig=function(){let Ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Re(Ve),bt=!0},t.clearConfig=function(){Ge=null,bt=!1},t.isValidAttribute=function(Ve,Y,_e){Ge||Re({});const Q=be(Ve),Ee=be(Y);return Us(Q,Ee,_e)},t.addHook=function(Ve,Y){typeof Y=="function"&&zu(V[Ve],Y)},t.removeHook=function(Ve,Y){if(Y!==void 0){const _e=GU(V[Ve],Y);return _e===-1?void 0:KU(V[Ve],_e,1)[0]}return c2(V[Ve])},t.removeHooks=function(Ve){V[Ve]=[]},t.removeAllHooks=function(){V=y2()},t}var fd=HN();function w1(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var nl=w1();function FN(e){nl=e}var pd={exec:()=>null};function Gt(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,o)=>{let u=typeof o=="string"?o:o.source;return u=u.replace($i.caret,"$1"),n=n.replace(r,u),i},getRegex:()=>new RegExp(n,t)};return i}var fW=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),$i={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")},pW=/^(?:[ \t]*(?:\n|$))+/,mW=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gW=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_W=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,x1=/(?:[*+-]|\d{1,9}[.)])/,UN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,WN=Gt(UN).replace(/bull/g,x1).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(),vW=Gt(UN).replace(/bull/g,x1).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(),C1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,yW=/^[^\n]+/,k1=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,bW=Gt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",k1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),SW=Gt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,x1).getRegex(),gm="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",E1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,wW=Gt("^ {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",E1).replace("tag",gm).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qN=Gt(C1).replace("hr",Hd).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",gm).getRegex(),xW=Gt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qN).getRegex(),T1={blockquote:xW,code:mW,def:bW,fences:gW,heading:_W,hr:Hd,html:wW,lheading:WN,list:SW,newline:pW,paragraph:qN,table:pd,text:yW},b2=Gt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hd).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",gm).getRegex(),CW={...T1,lheading:vW,table:b2,paragraph:Gt(C1).replace("hr",Hd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",b2).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",gm).getRegex()},kW={...T1,html:Gt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",E1).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:pd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Gt(C1).replace("hr",Hd).replace("heading",` *#{1,6} *[^
100
+ ]`).replace("lheading",WN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},EW=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,TW=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,GN=/^( {2,}|\\)\n(?!\s*$)/,AW=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_m=/[\p{P}\p{S}]/u,A1=/[\s\p{P}\p{S}]/u,KN=/[^\s\p{P}\p{S}]/u,RW=Gt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,A1).getRegex(),VN=/(?!~)[\p{P}\p{S}]/u,NW=/(?!~)[\s\p{P}\p{S}]/u,LW=/(?:[^\s\p{P}\p{S}]|~)/u,MW=Gt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",fW?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),YN=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,jW=Gt(YN,"u").replace(/punct/g,_m).getRegex(),OW=Gt(YN,"u").replace(/punct/g,VN).getRegex(),XN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",DW=Gt(XN,"gu").replace(/notPunctSpace/g,KN).replace(/punctSpace/g,A1).replace(/punct/g,_m).getRegex(),IW=Gt(XN,"gu").replace(/notPunctSpace/g,LW).replace(/punctSpace/g,NW).replace(/punct/g,VN).getRegex(),BW=Gt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,KN).replace(/punctSpace/g,A1).replace(/punct/g,_m).getRegex(),PW=Gt(/\\(punct)/,"gu").replace(/punct/g,_m).getRegex(),$W=Gt(/^<(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(),zW=Gt(E1).replace("(?:-->|$)","-->").getRegex(),HW=Gt("^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",zW).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mp=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,FW=Gt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Mp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ZN=Gt(/^!?\[(label)\]\[(ref)\]/).replace("label",Mp).replace("ref",k1).getRegex(),JN=Gt(/^!?\[(ref)\](?:\[\])?/).replace("ref",k1).getRegex(),UW=Gt("reflink|nolink(?!\\()","g").replace("reflink",ZN).replace("nolink",JN).getRegex(),S2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,R1={_backpedal:pd,anyPunctuation:PW,autolink:$W,blockSkip:MW,br:GN,code:TW,del:pd,emStrongLDelim:jW,emStrongRDelimAst:DW,emStrongRDelimUnd:BW,escape:EW,link:FW,nolink:JN,punctuation:RW,reflink:ZN,reflinkSearch:UW,tag:HW,text:AW,url:pd},WW={...R1,link:Gt(/^!?\[(label)\]\((.*?)\)/).replace("label",Mp).getRegex(),reflink:Gt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mp).getRegex()},jb={...R1,emStrongRDelimAst:IW,emStrongLDelim:OW,url:Gt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",S2).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:Gt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",S2).getRegex()},qW={...jb,br:Gt(GN).replace("{2,}","*").getRegex(),text:Gt(jb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},bf={normal:T1,gfm:CW,pedantic:kW},Uu={normal:R1,gfm:jb,breaks:qW,pedantic:WW},GW={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},w2=e=>GW[e];function pr(e,t){if(t){if($i.escapeTest.test(e))return e.replace($i.escapeReplace,w2)}else if($i.escapeTestNoEncode.test(e))return e.replace($i.escapeReplaceNoEncode,w2);return e}function x2(e){try{e=encodeURI(e).replace($i.percentDecode,"%")}catch{return null}return e}function C2(e,t){let n=e.replace($i.findPipe,(o,u,h)=>{let p=!1,f=u;for(;--f>=0&&h[f]==="\\";)p=!p;return p?"|":" |"}),i=n.split($i.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace($i.slashPipe,"|");return i}function Wu(e,t,n){let i=e.length;if(i===0)return"";let r=0;for(;r<i&&e.charAt(i-r-1)===t;)r++;return e.slice(0,i-r)}function KW(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function k2(e,t,n,i,r){let o=t.href,u=t.title||null,h=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let p={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:u,text:h,tokens:i.inlineTokens(h)};return i.state.inLink=!1,p}function VW(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
101
+ `).map(o=>{let u=o.match(n.other.beginningSpace);if(u===null)return o;let[h]=u;return h.length>=r.length?o.slice(r.length):o}).join(`
102
+ `)}var jp=class{options;rules;lexer;constructor(e){this.options=e||nl}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Wu(n,`
103
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=VW(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=Wu(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Wu(t[0],`
104
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Wu(t[0],`
105
+ `).split(`
106
+ `),i="",r="",o=[];for(;n.length>0;){let u=!1,h=[],p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))h.push(n[p]),u=!0;else if(!u)h.push(n[p]);else break;n=n.slice(p);let f=h.join(`
107
+ `),m=f.replace(this.rules.other.blockquoteSetextReplace,`
108
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
109
+ ${f}`:f,r=r?`${r}
110
+ ${m}`:m;let _=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=_,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
111
+ `+n.join(`
112
+ `),x=this.blockquote(w);o[o.length-1]=x,i=i.substring(0,i.length-S.raw.length)+x.raw,r=r.substring(0,r.length-S.text.length)+x.text;break}else if(b?.type==="list"){let S=b,w=S.raw+`
113
+ `+n.join(`
114
+ `),x=this.list(w);o[o.length-1]=x,i=i.substring(0,i.length-b.raw.length)+x.raw,r=r.substring(0,r.length-S.raw.length)+x.raw,n=w.substring(o.at(-1).raw.length).split(`
115
+ `);continue}}return{type:"blockquote",raw:i,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),u=!1;for(;e;){let p=!1,f="",m="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let _=t[2].split(`
116
+ `,1)[0].replace(this.rules.other.listReplaceTabs,D=>" ".repeat(3*D.length)),b=e.split(`
117
+ `,1)[0],S=!_.trim(),w=0;if(this.options.pedantic?(w=2,m=_.trimStart()):S?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,m=_.slice(w),w+=t[1].length),S&&this.rules.other.blankLine.test(b)&&(f+=b+`
118
+ `,e=e.substring(b.length+1),p=!0),!p){let D=this.rules.other.nextBulletRegex(w),z=this.rules.other.hrRegex(w),F=this.rules.other.fencesBeginRegex(w),N=this.rules.other.headingBeginRegex(w),I=this.rules.other.htmlBeginRegex(w);for(;e;){let j=e.split(`
119
+ `,1)[0],U;if(b=j,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),U=b):U=b.replace(this.rules.other.tabCharGlobal," "),F.test(b)||N.test(b)||I.test(b)||D.test(b)||z.test(b))break;if(U.search(this.rules.other.nonSpaceChar)>=w||!b.trim())m+=`
120
+ `+U.slice(w);else{if(S||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||F.test(_)||N.test(_)||z.test(_))break;m+=`
121
+ `+b}!S&&!b.trim()&&(S=!0),f+=j+`
122
+ `,e=e.substring(j.length+1),_=U.slice(w)}}r.loose||(u?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(u=!0));let x=null,C;this.options.gfm&&(x=this.rules.other.listIsTask.exec(m),x&&(C=x[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:f,task:!!x,checked:C,loose:!1,text:m,tokens:[]}),r.raw+=f}let h=r.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let p=0;p<r.items.length;p++)if(this.lexer.state.top=!1,r.items[p].tokens=this.lexer.blockTokens(r.items[p].text,[]),!r.loose){let f=r.items[p].tokens.filter(_=>_.type==="space"),m=f.length>0&&f.some(_=>this.rules.other.anyLine.test(_.raw));r.loose=m}if(r.loose)for(let p=0;p<r.items.length;p++)r.items[p].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=C2(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
123
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let u of i)this.rules.other.tableAlignRight.test(u)?o.align.push("right"):this.rules.other.tableAlignCenter.test(u)?o.align.push("center"):this.rules.other.tableAlignLeft.test(u)?o.align.push("left"):o.align.push(null);for(let u=0;u<n.length;u++)o.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:o.align[u]});for(let u of r)o.rows.push(C2(u,o.header.length).map((h,p)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:o.align[p]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
124
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Wu(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=KW(t[2],"()");if(o===-2)return;if(o>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],r=o[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),k2(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return k2(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,o,u,h=r,p=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(i=f.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(u=[...o].length,i[3]||i[4]){h+=u;continue}else if((i[5]||i[6])&&r%3&&!((r+u)%3)){p+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+p);let m=[...i[0]][0].length,_=e.slice(0,r+i.index+m+u);if(Math.min(r,u)%2){let S=_.slice(1,-1);return{type:"em",raw:_,text:S,tokens:this.lexer.inlineTokens(S)}}let b=_.slice(2,-2);return{type:"strong",raw:_,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Xs=class Ob{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||nl,this.options.tokenizer=this.options.tokenizer||new jp,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:$i,block:bf.normal,inline:Uu.normal};this.options.pedantic?(n.block=bf.pedantic,n.inline=Uu.pedantic):this.options.gfm&&(n.block=bf.gfm,this.options.breaks?n.inline=Uu.breaks:n.inline=Uu.gfm),this.tokenizer.rules=n}static get rules(){return{block:bf,inline:Uu}}static lex(t,n){return new Ob(n).lex(t)}static lexInline(t,n){return new Ob(n).inlineTokens(t)}lex(t){t=t.replace($i.carriageReturn,`
125
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){for(this.options.pedantic&&(t=t.replace($i.tabCharGlobal," ").replace($i.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(u=>(r=u.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let u=n.at(-1);r.raw.length===1&&u!==void 0?u.raw+=`
126
+ `:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
127
+ `)?"":`
128
+ `)+r.raw,u.text+=`
129
+ `+r.text,this.inlineQueue.at(-1).src=u.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
130
+ `)?"":`
131
+ `)+r.raw,u.text+=`
132
+ `+r.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let o=t;if(this.options.extensions?.startBlock){let u=1/0,h=t.slice(1),p;this.options.extensions.startBlock.forEach(f=>{p=f.call({lexer:this},h),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(o=t.substring(0,u+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let u=n.at(-1);i&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
133
+ `)?"":`
134
+ `)+r.raw,u.text+=`
135
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(r),i=o.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
136
+ `)?"":`
137
+ `)+r.raw,u.text+=`
138
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(r);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let i=t,r=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=r[2]?r[2].length:0,i=i.slice(0,r.index+o)+"["+"a".repeat(r[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let u=!1,h="";for(;t;){u||(h=""),u=!1;let p;if(this.options.extensions?.inline?.some(m=>(p=m.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let m=n.at(-1);p.type==="text"&&m?.type==="text"?(m.raw+=p.raw,m.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,i,h)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let f=t;if(this.options.extensions?.startInline){let m=1/0,_=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},_),typeof b=="number"&&b>=0&&(m=Math.min(m,b))}),m<1/0&&m>=0&&(f=t.substring(0,m+1))}if(p=this.tokenizer.inlineText(f)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(h=p.raw.slice(-1)),u=!0;let m=n.at(-1);m?.type==="text"?(m.raw+=p.raw,m.text+=p.text):n.push(p);continue}if(t){let m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},Op=class{options;parser;constructor(e){this.options=e||nl}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match($i.notSpaceStart)?.[0],r=e.replace($i.endingNewline,"")+`
139
+ `;return i?'<pre><code class="language-'+pr(i)+'">'+(n?r:pr(r,!0))+`</code></pre>
140
+ `:"<pre><code>"+(n?r:pr(r,!0))+`</code></pre>
141
+ `}blockquote({tokens:e}){return`<blockquote>
142
+ ${this.parser.parse(e)}</blockquote>
143
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
144
+ `}hr(e){return`<hr>
145
+ `}list(e){let t=e.ordered,n=e.start,i="";for(let u=0;u<e.items.length;u++){let h=e.items[u];i+=this.listitem(h)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
146
+ `+i+"</"+r+`>
147
+ `}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+pr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
148
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
149
+ `}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let i="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let u=0;u<o.length;u++)n+=this.tablecell(o[u]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
150
+ <thead>
151
+ `+t+`</thead>
152
+ `+i+`</table>
153
+ `}tablerow({text:e}){return`<tr>
154
+ ${e}</tr>
155
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
156
+ `}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>${pr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=x2(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+pr(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=x2(e);if(r===null)return pr(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${pr(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:pr(e.text)}},N1=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""}},Zs=class Db{options;renderer;textRenderer;constructor(t){this.options=t||nl,this.options.renderer=this.options.renderer||new Op,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new N1}static parse(t,n){return new Db(n).parse(t)}static parseInline(t,n){return new Db(n).parseInline(t)}parse(t,n=!0){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let h=o,p=this.options.extensions.renderers[h.type].call({parser:this},h);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){i+=p||"";continue}}let u=o;switch(u.type){case"space":{i+=this.renderer.space(u);continue}case"hr":{i+=this.renderer.hr(u);continue}case"heading":{i+=this.renderer.heading(u);continue}case"code":{i+=this.renderer.code(u);continue}case"table":{i+=this.renderer.table(u);continue}case"blockquote":{i+=this.renderer.blockquote(u);continue}case"list":{i+=this.renderer.list(u);continue}case"html":{i+=this.renderer.html(u);continue}case"def":{i+=this.renderer.def(u);continue}case"paragraph":{i+=this.renderer.paragraph(u);continue}case"text":{let h=u,p=this.renderer.text(h);for(;r+1<t.length&&t[r+1].type==="text";)h=t[++r],p+=`
157
+ `+this.renderer.text(h);n?i+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):i+=p;continue}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(t,n=this.renderer){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=h||"";continue}}let u=o;switch(u.type){case"escape":{i+=n.text(u);break}case"html":{i+=n.html(u);break}case"link":{i+=n.link(u);break}case"image":{i+=n.image(u);break}case"strong":{i+=n.strong(u);break}case"em":{i+=n.em(u);break}case"codespan":{i+=n.codespan(u);break}case"br":{i+=n.br(u);break}case"del":{i+=n.del(u);break}case"text":{i+=n.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},sd=class{options;block;constructor(e){this.options=e||nl}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?Xs.lex:Xs.lexInline}provideParser(){return this.block?Zs.parse:Zs.parseInline}},QN=class{defaults=w1();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Zs;Renderer=Op;TextRenderer=N1;Lexer=Xs;Tokenizer=jp;Hooks=sd;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let r=i;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let u of o)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let r=i;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let u=r[o].flat(1/0);n=n.concat(this.walkTokens(u,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...u){let h=r.renderer.apply(this,u);return h===!1&&(h=o.apply(this,u)),h}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new Op(this.defaults);for(let o in n.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let u=o,h=n.renderer[u],p=r[u];r[u]=(...f)=>{let m=h.apply(r,f);return m===!1&&(m=p.apply(r,f)),m||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new jp(this.defaults);for(let o in n.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let u=o,h=n.tokenizer[u],p=r[u];r[u]=(...f)=>{let m=h.apply(r,f);return m===!1&&(m=p.apply(r,f)),m}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new sd;for(let o in n.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let u=o,h=n.hooks[u],p=r[u];sd.passThroughHooks.has(o)?r[u]=f=>{if(this.defaults.async&&sd.passThroughHooksRespectAsync.has(o))return(async()=>{let _=await h.call(r,f);return p.call(r,_)})();let m=h.call(r,f);return p.call(r,m)}:r[u]=(...f)=>{if(this.defaults.async)return(async()=>{let _=await h.apply(r,f);return _===!1&&(_=await p.apply(r,f)),_})();let m=h.apply(r,f);return m===!1&&(m=p.apply(r,f)),m}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(u){let h=[];return h.push(o.call(this,u)),r&&(h=h.concat(r.call(this,u))),h}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Xs.lex(e,t??this.defaults)}parser(e,t){return Zs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let u=r.hooks?await r.hooks.preprocess(t):t,h=await(r.hooks?await r.hooks.provideLexer():e?Xs.lex:Xs.lexInline)(u,r),p=r.hooks?await r.hooks.processAllTokens(h):h;r.walkTokens&&await Promise.all(this.walkTokens(p,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser():e?Zs.parse:Zs.parseInline)(p,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let u=(r.hooks?r.hooks.provideLexer():e?Xs.lex:Xs.lexInline)(t,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let h=(r.hooks?r.hooks.provideParser():e?Zs.parse:Zs.parseInline)(u,r);return r.hooks&&(h=r.hooks.postprocess(h)),h}catch(u){return o(u)}}}onError(e,t){return n=>{if(n.message+=`
158
+ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+pr(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},el=new QN;function ln(e,t){return el.parse(e,t)}ln.options=ln.setOptions=function(e){return el.setOptions(e),ln.defaults=el.defaults,FN(ln.defaults),ln};ln.getDefaults=w1;ln.defaults=nl;ln.use=function(...e){return el.use(...e),ln.defaults=el.defaults,FN(ln.defaults),ln};ln.walkTokens=function(e,t){return el.walkTokens(e,t)};ln.parseInline=el.parseInline;ln.Parser=Zs;ln.parser=Zs.parse;ln.Renderer=Op;ln.TextRenderer=N1;ln.Lexer=Xs;ln.lexer=Xs.lex;ln.Tokenizer=jp;ln.Hooks=sd;ln.parse=ln;ln.options;ln.setOptions;ln.use;ln.walkTokens;ln.parseInline;Zs.parse;Xs.lex;var wv,E2;function YW(){if(E2)return wv;E2=1;function e(X){return X instanceof Map?X.clear=X.delete=X.set=function(){throw new Error("map is read-only")}:X instanceof Set&&(X.add=X.clear=X.delete=function(){throw new Error("set is read-only")}),Object.freeze(X),Object.getOwnPropertyNames(X).forEach(ue=>{const be=X[ue],Ge=typeof be;(Ge==="object"||Ge==="function")&&!Object.isFrozen(be)&&e(be)}),X}class t{constructor(ue){ue.data===void 0&&(ue.data={}),this.data=ue.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(X,...ue){const be=Object.create(null);for(const Ge in X)be[Ge]=X[Ge];return ue.forEach(function(Ge){for(const At in Ge)be[At]=Ge[At]}),be}const r="</span>",o=X=>!!X.scope,u=(X,{prefix:ue})=>{if(X.startsWith("language:"))return X.replace("language:","language-");if(X.includes(".")){const be=X.split(".");return[`${ue}${be.shift()}`,...be.map((Ge,At)=>`${Ge}${"_".repeat(At+1)}`)].join(" ")}return`${ue}${X}`};class h{constructor(ue,be){this.buffer="",this.classPrefix=be.classPrefix,ue.walk(this)}addText(ue){this.buffer+=n(ue)}openNode(ue){if(!o(ue))return;const be=u(ue.scope,{prefix:this.classPrefix});this.span(be)}closeNode(ue){o(ue)&&(this.buffer+=r)}value(){return this.buffer}span(ue){this.buffer+=`<span class="${ue}">`}}const p=(X={})=>{const ue={children:[]};return Object.assign(ue,X),ue};class f{constructor(){this.rootNode=p(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ue){this.top.children.push(ue)}openNode(ue){const be=p({scope:ue});this.add(be),this.stack.push(be)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ue){return this.constructor._walk(ue,this.rootNode)}static _walk(ue,be){return typeof be=="string"?ue.addText(be):be.children&&(ue.openNode(be),be.children.forEach(Ge=>this._walk(ue,Ge)),ue.closeNode(be)),ue}static _collapse(ue){typeof ue!="string"&&ue.children&&(ue.children.every(be=>typeof be=="string")?ue.children=[ue.children.join("")]:ue.children.forEach(be=>{f._collapse(be)}))}}class m extends f{constructor(ue){super(),this.options=ue}addText(ue){ue!==""&&this.add(ue)}startScope(ue){this.openNode(ue)}endScope(){this.closeNode()}__addSublanguage(ue,be){const Ge=ue.root;be&&(Ge.scope=`language:${be}`),this.add(Ge)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _(X){return X?typeof X=="string"?X:X.source:null}function b(X){return x("(?=",X,")")}function S(X){return x("(?:",X,")*")}function w(X){return x("(?:",X,")?")}function x(...X){return X.map(be=>_(be)).join("")}function C(X){const ue=X[X.length-1];return typeof ue=="object"&&ue.constructor===Object?(X.splice(X.length-1,1),ue):{}}function D(...X){return"("+(C(X).capture?"":"?:")+X.map(Ge=>_(Ge)).join("|")+")"}function z(X){return new RegExp(X.toString()+"|").exec("").length-1}function F(X,ue){const be=X&&X.exec(ue);return be&&be.index===0}const N=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function I(X,{joinWith:ue}){let be=0;return X.map(Ge=>{be+=1;const At=be;let jt=_(Ge),Re="";for(;jt.length>0;){const Ae=N.exec(jt);if(!Ae){Re+=jt;break}Re+=jt.substring(0,Ae.index),jt=jt.substring(Ae.index+Ae[0].length),Ae[0][0]==="\\"&&Ae[1]?Re+="\\"+String(Number(Ae[1])+At):(Re+=Ae[0],Ae[0]==="("&&be++)}return Re}).map(Ge=>`(${Ge})`).join(ue)}const j=/\b\B/,U="[a-zA-Z]\\w*",G="[a-zA-Z_]\\w*",W="\\b\\d+(\\.\\d+)?",Z="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",V="\\b(0b[01]+)",O="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",A=(X={})=>{const ue=/^#![ ]*\//;return X.binary&&(X.begin=x(ue,/.*\b/,X.binary,/\b.*/)),i({scope:"meta",begin:ue,end:/$/,relevance:0,"on:begin":(be,Ge)=>{be.index!==0&&Ge.ignoreMatch()}},X)},B={begin:"\\\\[\\s\\S]",relevance:0},M={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[B]},k={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[B]},T={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/},R=function(X,ue,be={}){const Ge=i({scope:"comment",begin:X,end:ue,contains:[]},be);Ge.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 At=D("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Ge.contains.push({begin:x(/[ ]+/,"(",At,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ge},$=R("//","$"),K=R("/\\*","\\*/"),L=R("#","$"),q={scope:"number",begin:W,relevance:0},H={scope:"number",begin:Z,relevance:0},ne={scope:"number",begin:V,relevance:0},oe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[B,{begin:/\[/,end:/\]/,relevance:0,contains:[B]}]},Se={scope:"title",begin:U,relevance:0},xe={scope:"title",begin:G,relevance:0},fe={begin:"\\.\\s*"+G,relevance:0};var rt=Object.freeze({__proto__:null,APOS_STRING_MODE:M,BACKSLASH_ESCAPE:B,BINARY_NUMBER_MODE:ne,BINARY_NUMBER_RE:V,COMMENT:R,C_BLOCK_COMMENT_MODE:K,C_LINE_COMMENT_MODE:$,C_NUMBER_MODE:H,C_NUMBER_RE:Z,END_SAME_AS_BEGIN:function(X){return Object.assign(X,{"on:begin":(ue,be)=>{be.data._beginMatch=ue[1]},"on:end":(ue,be)=>{be.data._beginMatch!==ue[1]&&be.ignoreMatch()}})},HASH_COMMENT_MODE:L,IDENT_RE:U,MATCH_NOTHING_RE:j,METHOD_GUARD:fe,NUMBER_MODE:q,NUMBER_RE:W,PHRASAL_WORDS_MODE:T,QUOTE_STRING_MODE:k,REGEXP_MODE:oe,RE_STARTERS_RE:O,SHEBANG:A,TITLE_MODE:Se,UNDERSCORE_IDENT_RE:G,UNDERSCORE_TITLE_MODE:xe});function Ie(X,ue){X.input[X.index-1]==="."&&ue.ignoreMatch()}function Ce(X,ue){X.className!==void 0&&(X.scope=X.className,delete X.className)}function Me(X,ue){ue&&X.beginKeywords&&(X.begin="\\b("+X.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",X.__beforeBegin=Ie,X.keywords=X.keywords||X.beginKeywords,delete X.beginKeywords,X.relevance===void 0&&(X.relevance=0))}function je(X,ue){Array.isArray(X.illegal)&&(X.illegal=D(...X.illegal))}function ze(X,ue){if(X.match){if(X.begin||X.end)throw new Error("begin & end are not supported with match");X.begin=X.match,delete X.match}}function bt(X,ue){X.relevance===void 0&&(X.relevance=1)}const pt=(X,ue)=>{if(!X.beforeMatch)return;if(X.starts)throw new Error("beforeMatch cannot be used with starts");const be=Object.assign({},X);Object.keys(X).forEach(Ge=>{delete X[Ge]}),X.keywords=be.keywords,X.begin=x(be.beforeMatch,b(be.begin)),X.starts={relevance:0,contains:[Object.assign(be,{endsParent:!0})]},X.relevance=0,delete be.beforeMatch},vt=["of","and","for","in","not","or","if","then","parent","list","value"],lt="keyword";function de(X,ue,be=lt){const Ge=Object.create(null);return typeof X=="string"?At(be,X.split(" ")):Array.isArray(X)?At(be,X):Object.keys(X).forEach(function(jt){Object.assign(Ge,de(X[jt],ue,jt))}),Ge;function At(jt,Re){ue&&(Re=Re.map(Ae=>Ae.toLowerCase())),Re.forEach(function(Ae){const et=Ae.split("|");Ge[et[0]]=[jt,ut(et[0],et[1])]})}}function ut(X,ue){return ue?Number(ue):tt(X)?0:1}function tt(X){return vt.includes(X.toLowerCase())}const Vt={},st=X=>{console.error(X)},zt=(X,...ue)=>{console.log(`WARN: ${X}`,...ue)},Ft=(X,ue)=>{Vt[`${X}/${ue}`]||(console.log(`Deprecated as of ${X}. ${ue}`),Vt[`${X}/${ue}`]=!0)},we=new Error;function Oe(X,ue,{key:be}){let Ge=0;const At=X[be],jt={},Re={};for(let Ae=1;Ae<=ue.length;Ae++)Re[Ae+Ge]=At[Ae],jt[Ae+Ge]=!0,Ge+=z(ue[Ae-1]);X[be]=Re,X[be]._emit=jt,X[be]._multi=!0}function cn(X){if(Array.isArray(X.begin)){if(X.skip||X.excludeBegin||X.returnBegin)throw st("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),we;if(typeof X.beginScope!="object"||X.beginScope===null)throw st("beginScope must be object"),we;Oe(X,X.begin,{key:"beginScope"}),X.begin=I(X.begin,{joinWith:""})}}function ti(X){if(Array.isArray(X.end)){if(X.skip||X.excludeEnd||X.returnEnd)throw st("skip, excludeEnd, returnEnd not compatible with endScope: {}"),we;if(typeof X.endScope!="object"||X.endScope===null)throw st("endScope must be object"),we;Oe(X,X.end,{key:"endScope"}),X.end=I(X.end,{joinWith:""})}}function ni(X){X.scope&&typeof X.scope=="object"&&X.scope!==null&&(X.beginScope=X.scope,delete X.scope)}function We(X){ni(X),typeof X.beginScope=="string"&&(X.beginScope={_wrap:X.beginScope}),typeof X.endScope=="string"&&(X.endScope={_wrap:X.endScope}),cn(X),ti(X)}function gt(X){function ue(Re,Ae){return new RegExp(_(Re),"m"+(X.case_insensitive?"i":"")+(X.unicodeRegex?"u":"")+(Ae?"g":""))}class be{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ae,et){et.position=this.position++,this.matchIndexes[this.matchAt]=et,this.regexes.push([et,Ae]),this.matchAt+=z(Ae)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ae=this.regexes.map(et=>et[1]);this.matcherRe=ue(I(Ae,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ae){this.matcherRe.lastIndex=this.lastIndex;const et=this.matcherRe.exec(Ae);if(!et)return null;const fn=et.findIndex((Qt,Li)=>Li>0&&Qt!==void 0),Rt=this.matchIndexes[fn];return et.splice(0,fn),Object.assign(et,Rt)}}class Ge{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ae){if(this.multiRegexes[Ae])return this.multiRegexes[Ae];const et=new be;return this.rules.slice(Ae).forEach(([fn,Rt])=>et.addRule(fn,Rt)),et.compile(),this.multiRegexes[Ae]=et,et}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ae,et){this.rules.push([Ae,et]),et.type==="begin"&&this.count++}exec(Ae){const et=this.getMatcher(this.regexIndex);et.lastIndex=this.lastIndex;let fn=et.exec(Ae);if(this.resumingScanAtSamePosition()&&!(fn&&fn.index===this.lastIndex)){const Rt=this.getMatcher(0);Rt.lastIndex=this.lastIndex+1,fn=Rt.exec(Ae)}return fn&&(this.regexIndex+=fn.position+1,this.regexIndex===this.count&&this.considerAll()),fn}}function At(Re){const Ae=new Ge;return Re.contains.forEach(et=>Ae.addRule(et.begin,{rule:et,type:"begin"})),Re.terminatorEnd&&Ae.addRule(Re.terminatorEnd,{type:"end"}),Re.illegal&&Ae.addRule(Re.illegal,{type:"illegal"}),Ae}function jt(Re,Ae){const et=Re;if(Re.isCompiled)return et;[Ce,ze,We,pt].forEach(Rt=>Rt(Re,Ae)),X.compilerExtensions.forEach(Rt=>Rt(Re,Ae)),Re.__beforeBegin=null,[Me,je,bt].forEach(Rt=>Rt(Re,Ae)),Re.isCompiled=!0;let fn=null;return typeof Re.keywords=="object"&&Re.keywords.$pattern&&(Re.keywords=Object.assign({},Re.keywords),fn=Re.keywords.$pattern,delete Re.keywords.$pattern),fn=fn||/\w+/,Re.keywords&&(Re.keywords=de(Re.keywords,X.case_insensitive)),et.keywordPatternRe=ue(fn,!0),Ae&&(Re.begin||(Re.begin=/\B|\b/),et.beginRe=ue(et.begin),!Re.end&&!Re.endsWithParent&&(Re.end=/\B|\b/),Re.end&&(et.endRe=ue(et.end)),et.terminatorEnd=_(et.end)||"",Re.endsWithParent&&Ae.terminatorEnd&&(et.terminatorEnd+=(Re.end?"|":"")+Ae.terminatorEnd)),Re.illegal&&(et.illegalRe=ue(Re.illegal)),Re.contains||(Re.contains=[]),Re.contains=[].concat(...Re.contains.map(function(Rt){return Tt(Rt==="self"?Re:Rt)})),Re.contains.forEach(function(Rt){jt(Rt,et)}),Re.starts&&jt(Re.starts,Ae),et.matcher=At(et),et}if(X.compilerExtensions||(X.compilerExtensions=[]),X.contains&&X.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return X.classNameAliases=i(X.classNameAliases||{}),jt(X)}function xt(X){return X?X.endsWithParent||xt(X.starts):!1}function Tt(X){return X.variants&&!X.cachedVariants&&(X.cachedVariants=X.variants.map(function(ue){return i(X,{variants:null},ue)})),X.cachedVariants?X.cachedVariants:xt(X)?i(X,{starts:X.starts?i(X.starts):null}):Object.isFrozen(X)?i(X):X}var $t="11.11.1";class Cn extends Error{constructor(ue,be){super(ue),this.name="HTMLInjectionError",this.html=be}}const ee=n,le=i,Be=Symbol("nomatch"),Le=7,Fe=function(X){const ue=Object.create(null),be=Object.create(null),Ge=[];let At=!0;const jt="Could not find the language '{}', did you forget to load/include a language module?",Re={disableAutodetect:!0,name:"Plain text",contains:[]};let Ae={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:m};function et(pe){return Ae.noHighlightRe.test(pe)}function fn(pe){let Pe=pe.className+" ";Pe+=pe.parentNode?pe.parentNode.className:"";const qe=Ae.languageDetectRe.exec(Pe);if(qe){const Ct=Y(qe[1]);return Ct||(zt(jt.replace("{}",qe[1])),zt("Falling back to no-highlight mode for this block.",pe)),Ct?qe[1]:"no-highlight"}return Pe.split(/\s+/).find(Ct=>et(Ct)||Y(Ct))}function Rt(pe,Pe,qe){let Ct="",Yt="";typeof Pe=="object"?(Ct=pe,qe=Pe.ignoreIllegals,Yt=Pe.language):(Ft("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ft("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),Yt=pe,Ct=Pe),qe===void 0&&(qe=!0);const Ke={code:Ct,language:Yt};Ne("before:highlight",Ke);const Ht=Ke.result?Ke.result:Qt(Ke.language,Ke.code,qe);return Ht.code=Ke.code,Ne("after:highlight",Ht),Ht}function Qt(pe,Pe,qe,Ct){const Yt=Object.create(null);function Ke(Te,Ye){return Te.keywords[Ye]}function Ht(){if(!ct.keywords){$n.addText(Xt);return}let Te=0;ct.keywordPatternRe.lastIndex=0;let Ye=ct.keywordPatternRe.exec(Xt),_t="";for(;Ye;){_t+=Xt.substring(Te,Ye.index);const Ot=Yn.case_insensitive?Ye[0].toLowerCase():Ye[0],kn=Ke(ct,Ot);if(kn){const[bs,Oc]=kn;if($n.addText(_t),_t="",Yt[Ot]=(Yt[Ot]||0)+1,Yt[Ot]<=Le&&(fa+=Oc),bs.startsWith("_"))_t+=Ye[0];else{const Wd=Yn.classNameAliases[bs]||bs;un(Ye[0],Wd)}}else _t+=Ye[0];Te=ct.keywordPatternRe.lastIndex,Ye=ct.keywordPatternRe.exec(Xt)}_t+=Xt.substring(Te),$n.addText(_t)}function nn(){if(Xt==="")return;let Te=null;if(typeof ct.subLanguage=="string"){if(!ue[ct.subLanguage]){$n.addText(Xt);return}Te=Qt(ct.subLanguage,Xt,!0,Ud[ct.subLanguage]),Ud[ct.subLanguage]=Te._top}else Te=ys(Xt,ct.subLanguage.length?ct.subLanguage:null);ct.relevance>0&&(fa+=Te.relevance),$n.__addSublanguage(Te._emitter,Te.language)}function Bt(){ct.subLanguage!=null?nn():Ht(),Xt=""}function un(Te,Ye){Te!==""&&($n.startScope(Ye),$n.addText(Te),$n.endScope())}function qs(Te,Ye){let _t=1;const Ot=Ye.length-1;for(;_t<=Ot;){if(!Te._emit[_t]){_t++;continue}const kn=Yn.classNameAliases[Te[_t]]||Te[_t],bs=Ye[_t];kn?un(bs,kn):(Xt=bs,Ht(),Xt=""),_t++}}function is(Te,Ye){return Te.scope&&typeof Te.scope=="string"&&$n.openNode(Yn.classNameAliases[Te.scope]||Te.scope),Te.beginScope&&(Te.beginScope._wrap?(un(Xt,Yn.classNameAliases[Te.beginScope._wrap]||Te.beginScope._wrap),Xt=""):Te.beginScope._multi&&(qs(Te.beginScope,Ye),Xt="")),ct=Object.create(Te,{parent:{value:ct}}),ct}function Ar(Te,Ye,_t){let Ot=F(Te.endRe,_t);if(Ot){if(Te["on:end"]){const kn=new t(Te);Te["on:end"](Ye,kn),kn.isMatchIgnored&&(Ot=!1)}if(Ot){for(;Te.endsParent&&Te.parent;)Te=Te.parent;return Te}}if(Te.endsWithParent)return Ar(Te.parent,Ye,_t)}function da(Te){return ct.matcher.regexIndex===0?(Xt+=Te[0],1):(pa=!0,0)}function ki(Te){const Ye=Te[0],_t=Te.rule,Ot=new t(_t),kn=[_t.__beforeBegin,_t["on:begin"]];for(const bs of kn)if(bs&&(bs(Te,Ot),Ot.isMatchIgnored))return da(Ye);return _t.skip?Xt+=Ye:(_t.excludeBegin&&(Xt+=Ye),Bt(),!_t.returnBegin&&!_t.excludeBegin&&(Xt=Ye)),is(_t,Te),_t.returnBegin?0:Ye.length}function ii(Te){const Ye=Te[0],_t=Pe.substring(Te.index),Ot=Ar(ct,Te,_t);if(!Ot)return Be;const kn=ct;ct.endScope&&ct.endScope._wrap?(Bt(),un(Ye,ct.endScope._wrap)):ct.endScope&&ct.endScope._multi?(Bt(),qs(ct.endScope,Te)):kn.skip?Xt+=Ye:(kn.returnEnd||kn.excludeEnd||(Xt+=Ye),Bt(),kn.excludeEnd&&(Xt=Ye));do ct.scope&&$n.closeNode(),!ct.skip&&!ct.subLanguage&&(fa+=ct.relevance),ct=ct.parent;while(ct!==Ot.parent);return Ot.starts&&is(Ot.starts,Te),kn.returnEnd?0:Ye.length}function co(){const Te=[];for(let Ye=ct;Ye!==Yn;Ye=Ye.parent)Ye.scope&&Te.unshift(Ye.scope);Te.forEach(Ye=>$n.openNode(Ye))}let rr={};function ha(Te,Ye){const _t=Ye&&Ye[0];if(Xt+=Te,_t==null)return Bt(),0;if(rr.type==="begin"&&Ye.type==="end"&&rr.index===Ye.index&&_t===""){if(Xt+=Pe.slice(Ye.index,Ye.index+1),!At){const Ot=new Error(`0 width match regex (${pe})`);throw Ot.languageName=pe,Ot.badRule=rr.rule,Ot}return 1}if(rr=Ye,Ye.type==="begin")return ki(Ye);if(Ye.type==="illegal"&&!qe){const Ot=new Error('Illegal lexeme "'+_t+'" for mode "'+(ct.scope||"<unnamed>")+'"');throw Ot.mode=ct,Ot}else if(Ye.type==="end"){const Ot=ii(Ye);if(Ot!==Be)return Ot}if(Ye.type==="illegal"&&_t==="")return Xt+=`
160
+ `,1;if(jc>1e5&&jc>Ye.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xt+=_t,_t.length}const Yn=Y(pe);if(!Yn)throw st(jt.replace("{}",pe)),new Error('Unknown language: "'+pe+'"');const il=gt(Yn);let sl="",ct=Ct||il;const Ud={},$n=new Ae.__emitter(Ae);co();let Xt="",fa=0,Rr=0,jc=0,pa=!1;try{if(Yn.__emitTokens)Yn.__emitTokens(Pe,$n);else{for(ct.matcher.considerAll();;){jc++,pa?pa=!1:ct.matcher.considerAll(),ct.matcher.lastIndex=Rr;const Te=ct.matcher.exec(Pe);if(!Te)break;const Ye=Pe.substring(Rr,Te.index),_t=ha(Ye,Te);Rr=Te.index+_t}ha(Pe.substring(Rr))}return $n.finalize(),sl=$n.toHTML(),{language:pe,value:sl,relevance:fa,illegal:!1,_emitter:$n,_top:ct}}catch(Te){if(Te.message&&Te.message.includes("Illegal"))return{language:pe,value:ee(Pe),illegal:!0,relevance:0,_illegalBy:{message:Te.message,index:Rr,context:Pe.slice(Rr-100,Rr+100),mode:Te.mode,resultSoFar:sl},_emitter:$n};if(At)return{language:pe,value:ee(Pe),illegal:!1,relevance:0,errorRaised:Te,_emitter:$n,_top:ct};throw Te}}function Li(pe){const Pe={value:ee(pe),illegal:!1,relevance:0,_top:Re,_emitter:new Ae.__emitter(Ae)};return Pe._emitter.addText(pe),Pe}function ys(pe,Pe){Pe=Pe||Ae.languages||Object.keys(ue);const qe=Li(pe),Ct=Pe.filter(Y).filter(Q).map(Bt=>Qt(Bt,pe,!1));Ct.unshift(qe);const Yt=Ct.sort((Bt,un)=>{if(Bt.relevance!==un.relevance)return un.relevance-Bt.relevance;if(Bt.language&&un.language){if(Y(Bt.language).supersetOf===un.language)return 1;if(Y(un.language).supersetOf===Bt.language)return-1}return 0}),[Ke,Ht]=Yt,nn=Ke;return nn.secondBest=Ht,nn}function Ci(pe,Pe,qe){const Ct=Pe&&be[Pe]||qe;pe.classList.add("hljs"),pe.classList.add(`language-${Ct}`)}function en(pe){let Pe=null;const qe=fn(pe);if(et(qe))return;if(Ne("before:highlightElement",{el:pe,language:qe}),pe.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",pe);return}if(pe.children.length>0&&(Ae.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(pe)),Ae.throwUnescapedHTML))throw new Cn("One of your code blocks includes unescaped HTML.",pe.innerHTML);Pe=pe;const Ct=Pe.textContent,Yt=qe?Rt(Ct,{language:qe,ignoreIllegals:!0}):ys(Ct);pe.innerHTML=Yt.value,pe.dataset.highlighted="yes",Ci(pe,qe,Yt.language),pe.result={language:Yt.language,re:Yt.relevance,relevance:Yt.relevance},Yt.secondBest&&(pe.secondBest={language:Yt.secondBest.language,relevance:Yt.secondBest.relevance}),Ne("after:highlightElement",{el:pe,result:Yt,text:Ct})}function tn(pe){Ae=le(Ae,pe)}const ns=()=>{Ws(),Ft("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Us(){Ws(),Ft("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ua=!1;function Ws(){function pe(){Ws()}if(document.readyState==="loading"){ua||window.addEventListener("DOMContentLoaded",pe,!1),ua=!0;return}document.querySelectorAll(Ae.cssSelector).forEach(en)}function Tr(pe,Pe){let qe=null;try{qe=Pe(X)}catch(Ct){if(st("Language definition for '{}' could not be registered.".replace("{}",pe)),At)st(Ct);else throw Ct;qe=Re}qe.name||(qe.name=pe),ue[pe]=qe,qe.rawDefinition=Pe.bind(null,X),qe.aliases&&_e(qe.aliases,{languageName:pe})}function Ui(pe){delete ue[pe];for(const Pe of Object.keys(be))be[Pe]===pe&&delete be[Pe]}function Ve(){return Object.keys(ue)}function Y(pe){return pe=(pe||"").toLowerCase(),ue[pe]||ue[be[pe]]}function _e(pe,{languageName:Pe}){typeof pe=="string"&&(pe=[pe]),pe.forEach(qe=>{be[qe.toLowerCase()]=Pe})}function Q(pe){const Pe=Y(pe);return Pe&&!Pe.disableAutodetect}function Ee(pe){pe["before:highlightBlock"]&&!pe["before:highlightElement"]&&(pe["before:highlightElement"]=Pe=>{pe["before:highlightBlock"](Object.assign({block:Pe.el},Pe))}),pe["after:highlightBlock"]&&!pe["after:highlightElement"]&&(pe["after:highlightElement"]=Pe=>{pe["after:highlightBlock"](Object.assign({block:Pe.el},Pe))})}function Qe(pe){Ee(pe),Ge.push(pe)}function Ze(pe){const Pe=Ge.indexOf(pe);Pe!==-1&&Ge.splice(Pe,1)}function Ne(pe,Pe){const qe=pe;Ge.forEach(function(Ct){Ct[qe]&&Ct[qe](Pe)})}function dt(pe){return Ft("10.7.0","highlightBlock will be removed entirely in v12.0"),Ft("10.7.0","Please use highlightElement now."),en(pe)}Object.assign(X,{highlight:Rt,highlightAuto:ys,highlightAll:Ws,highlightElement:en,highlightBlock:dt,configure:tn,initHighlighting:ns,initHighlightingOnLoad:Us,registerLanguage:Tr,unregisterLanguage:Ui,listLanguages:Ve,getLanguage:Y,registerAliases:_e,autoDetection:Q,inherit:le,addPlugin:Qe,removePlugin:Ze}),X.debugMode=function(){At=!1},X.safeMode=function(){At=!0},X.versionString=$t,X.regex={concat:x,lookahead:b,either:D,optional:w,anyNumberOfTimes:S};for(const pe in rt)typeof rt[pe]=="object"&&e(rt[pe]);return Object.assign(X,rt),X},it=Fe({});return it.newInstance=()=>Fe({}),wv=it,it.HighlightJS=it,it.default=it,wv}var XW=YW();const Ns=g0(XW);function T2(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),u={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},h={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(h);const p={match:/\\"/},f={className:"string",begin:/'/,end:/'/},m={match:/\\'/},_={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],D={match:/(\/[a-z._-]+)+/},z=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],F=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],N=["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"],I=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:x,literal:C,built_in:[...z,...F,"set","shopt",...N,...I]},contains:[S,e.SHEBANG(),w,_,o,u,D,h,p,f,m,n]}}const A2="[A-Za-z$_][0-9A-Za-z$_]*",ZW=["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"],JW=["true","false","null","undefined","NaN","Infinity"],eL=["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"],tL=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],nL=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],QW=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],eq=[].concat(nL,eL,tL);function R2(e){const t=e.regex,n=(R,{after:$})=>{const K="</"+R[0].slice(1);return R.input.indexOf(K,$)!==-1},i=A2,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,$)=>{const K=R[0].length+R.index,L=R.input[K];if(L==="<"||L===","){$.ignoreMatch();return}L===">"&&(n(R,{after:K})||$.ignoreMatch());let q;const H=R.input.substring(K);if(q=H.match(/^\s*=/)){$.ignoreMatch();return}if((q=H.match(/^\s+extends\s+/))&&q.index===0){$.ignoreMatch();return}}},h={$pattern:A2,keyword:ZW,literal:JW,built_in:eq,"variable.language":QW},p="[0-9](_?[0-9])*",f=`\\.(${p})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${m})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},z={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},F=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,{match:/\$\d+/},_];b.contains=F.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(F)});const N=[].concat(z,b.contains),I=N.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(N)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:I},U={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},G={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:{_:[...eL,...tL]}},W={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Z={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},V={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(R){return t.concat("(?!",R.join("|"),")")}const A={match:t.concat(/\b/,O([...nL,"super","import"].map(R=>`${R}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},B={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:I,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),W,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,z,{match:/\$\d+/},_,G,{scope:"attr",match:i+t.lookahead(":"),relevance:0},T,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[z,e.REGEXP_MODE,{className:"function",begin:k,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:I}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},Z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},B,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},A,V,U,M,{match:/\$[(.]/}]}}function tq(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function N2(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},u={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},h=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,h,/:\/\/.*?\)/),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}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},m={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},_=e.inherit(f,{contains:[]}),b=e.inherit(m,{contains:[]});f.contains.push(b),m.contains.push(_);let S=[n,p];return[f,m,_,b].forEach(D=>{D.contains=D.contains.concat(S)}),S=S.concat(f,m),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},n,o,f,m,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,i,p,u,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function L2(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],h={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:h,illegal:/#/},m={begin:/\{\{/,relevance:0},_={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,m,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,m,f]},{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,m,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,m,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b="[0-9](_?[0-9])*",S=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,w=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${S}))[eE][+-]?(${b})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${b})[jJ](?=${w})`}]},C={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:h,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},D={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:["self",p,x,_,e.HASH_COMMENT_MODE]}]};return f.contains=[_,x,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:h,illegal:/(<\/|\?)|=>/,contains:[p,x,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},_,C,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[D]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[x,D,_]}]}}const Dp="[A-Za-z$_][0-9A-Za-z$_]*",iL=["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"],sL=["true","false","null","undefined","NaN","Infinity"],rL=["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"],aL=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],oL=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],lL=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],cL=[].concat(oL,rL,aL);function nq(e){const t=e.regex,n=(R,{after:$})=>{const K="</"+R[0].slice(1);return R.input.indexOf(K,$)!==-1},i=Dp,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,$)=>{const K=R[0].length+R.index,L=R.input[K];if(L==="<"||L===","){$.ignoreMatch();return}L===">"&&(n(R,{after:K})||$.ignoreMatch());let q;const H=R.input.substring(K);if(q=H.match(/^\s*=/)){$.ignoreMatch();return}if((q=H.match(/^\s+extends\s+/))&&q.index===0){$.ignoreMatch();return}}},h={$pattern:Dp,keyword:iL,literal:sL,built_in:cL,"variable.language":lL},p="[0-9](_?[0-9])*",f=`\\.(${p})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${m})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},z={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},F=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,{match:/\$\d+/},_];b.contains=F.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(F)});const N=[].concat(z,b.contains),I=N.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(N)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:I},U={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},G={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:{_:[...rL,...aL]}},W={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Z={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},V={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(R){return t.concat("(?!",R.join("|"),")")}const A={match:t.concat(/\b/,O([...oL,"super","import"].map(R=>`${R}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},B={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",T={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:I,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),W,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,x,C,z,{match:/\$\d+/},_,G,{scope:"attr",match:i+t.lookahead(":"),relevance:0},T,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[z,e.REGEXP_MODE,{className:"function",begin:k,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:I}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},Z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},B,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},A,V,U,M,{match:/\$[(.]/}]}}function M2(e){const t=e.regex,n=nq(e),i=Dp,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},u={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},h={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:Dp,keyword:iL.concat(p),literal:sL,built_in:cL.concat(r),"variable.language":lL},m={className:"meta",begin:"@"+i},_=(x,C,D)=>{const z=x.contains.findIndex(F=>F.label===C);if(z===-1)throw new Error("can not find mode to replace");x.contains.splice(z,1,D)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(m);const b=n.contains.find(x=>x.scope==="attr"),S=Object.assign({},b,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,b,S]),n.contains=n.contains.concat([m,o,u,S]),_(n,"shebang",e.SHEBANG()),_(n,"use_strict",h);const w=n.contains.find(x=>x.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const iq=/\[\[wiki:([^\]]+)\]\]/g,sq=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,rq=/^(\S[^:]*?):[ \t]*(.*)$/,aq=new QN({gfm:!0,breaks:!1}),j2={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},xv=bq();function Hs(e,t={}){const{entries:n,content:i}=cq(e),r=hq(i,t.resolveWikiLink),o=aq.parse(r,{async:!1}),u=dq(n),h=fd.sanitize(u+o,j2),p=new DOMParser().parseFromString(h,"text/html");return pq(p,t.omitDuplicateTitle),fq(p),mq(p),_q(p),{html:fd.sanitize(p.body.innerHTML,j2),toc:vq(p)}}function oq(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function lq(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new TextDecoder().decode(n)}function cq(e){const t=sq.exec(e);return t?{entries:uq(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function uq(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=rq.exec(i);if(r){const[,h="",p=""]=r;t.push({key:h.trim(),value:p.trim()});continue}const o=t[t.length-1];if(!o)continue;const u=i.trim();o.value=o.value?`${o.value} ${u}`:u}return t}function dq(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${md(n.key)}</dt><dd>${md(n.value)}</dd>`).join("")}</dl>`}function hq(e,t){return e.replace(iq,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return md(`[[wiki:${r}]]`);const o=t(r);if(o===null)return md(`[[wiki:${r}]]`);const u=md(r),h=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${h}">${u}</a>`})}function fq(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=xq(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function pq(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||O2(n.textContent??"")===O2(t)&&n.remove()}function mq(e){for(const t of e.querySelectorAll("pre > code")){const n=Sq(t.className),i=t.textContent??"",r=t.parentElement;if(!r)continue;if(n==="mermaid"){const u=e.createElement("div");u.className="diagram-block",u.setAttribute("data-mermaid-source",oq(i)),u.setAttribute("data-diagram-state","pending"),r.replaceWith(u);continue}const o=yq(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(gq(e,n||"text"),r.firstChild)}}function gq(e,t){const n=e.createElement("div");n.className="code-block-toolbar";const i=e.createElement("span");i.className="code-block-dots",i.setAttribute("aria-hidden","true");for(let u=0;u<3;u++)i.append(e.createElement("span"));const r=e.createElement("span");r.className="code-block-language",r.textContent=t;const o=e.createElement("button");return o.className="copy-code",o.type="button",o.dataset.action="copy-code",o.setAttribute("aria-label",`Copy ${t} code`),o.textContent="Copy",n.append(i,r,o),n}function _q(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";wq(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function vq(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 yq(e,t){return t&&xv.getLanguage(t)?xv.highlight(e,{language:t}).value:xv.highlightAuto(e).value}function bq(){return Ns.registerLanguage("bash",T2),Ns.registerLanguage("sh",T2),Ns.registerLanguage("javascript",R2),Ns.registerLanguage("js",R2),Ns.registerLanguage("json",tq),Ns.registerLanguage("markdown",N2),Ns.registerLanguage("md",N2),Ns.registerLanguage("python",L2),Ns.registerLanguage("py",L2),Ns.registerLanguage("typescript",M2),Ns.registerLanguage("ts",M2),Ns}function Sq(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function wq(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function xq(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function O2(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function md(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Cq=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",kq=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Eq=/^on/i,Tq={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},D2="diagramInteractionBound",Aq=/^oklch\s*\(\s*([^)]+)\s*\)$/i,Rq=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Os=[25,50,75,100,125,150,200],Nq=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let Cv=null;const I2=new WeakSet;let Lq=0,Mq=0,Ad=null;function Va(e){const t=e.trim();if(!t)return t;const n=eG(t);return n?tG(n):t}function vm(e){if(I2.has(e))return;I2.add(e),B2(e);const t=e instanceof Node?e:document.body;new MutationObserver(i=>{let r=!1;for(const o of i)if(o.type==="childList"){Ad&&!Ad.trigger.isConnected&&rd(!1);for(const u of o.addedNodes)if(u instanceof Element&&(u.matches?.(".diagram-block[data-mermaid-source]")||u.querySelector?.(".diagram-block[data-mermaid-source]"))){r=!0;break}if(r)break}r&&B2(e)}).observe(t,{childList:!0,subtree:!0})}function B2(e){const t=e.querySelectorAll(Cq);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",jq(n))}async function jq(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=lq(t)}catch{kv(e,"Invalid diagram source");return}if(!n.trim()){kv(e,"Empty diagram source");return}try{const i=await Dq(),r=`mermaid-diagram-${++Lq}`,{svg:o}=await i.render(r,n);e.innerHTML=Oq(o),Pq(e,o),$q(e),zq(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);kv(e,r)}}function kv(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function Oq(e){const t=(n,i)=>{Eq.test(i.attrName)&&(i.keepAttr=!1)};fd.addHook("uponSanitizeAttribute",t);try{return fd.sanitize(e,Tq)}finally{fd.removeHook("uponSanitizeAttribute",t)}}async function Dq(){return Cv||(Cv=(async()=>{const e=await FU(()=>import("./mermaid.core-6fYEjApv.js").then(n=>n.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:Iq(),themeCSS:Bq(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),Cv}function Iq(){const e=getComputedStyle(document.documentElement),t=(x,C)=>{const D=e.getPropertyValue(x).trim();return Va(D||C)},n=(x,C)=>e.getPropertyValue(x).trim()||C,i=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),u=t("--aurora","#8bd7e6"),h=t("--aurora-deep","#1f8aa8"),p=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),m=t("--ink-fog","#a6afbb"),_=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,u,p,Va("oklch(70% 0.11 68)"),h,Va("oklch(76% 0.09 205)"),o,Va("oklch(68% 0.14 30)"),m,Va("oklch(62% 0.08 228)"),Va("oklch(52% 0.05 248)")],w=Object.fromEntries(Nq.map((x,C)=>[x,S[C]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:_,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:_,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:h,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:r,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:_,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:_,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function Bq(){const e=getComputedStyle(document.documentElement),t=(f,m)=>{const _=e.getPropertyValue(f).trim();return Va(_||m)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),u=Va("oklch(15% 0.04 250 / 34%)"),h=t("--surface-glass","#1d2734"),p=t("--ink-pearl","#e6e9ef");return`
161
+ .node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
162
+ stroke: ${n};
163
+ fill: ${h};
164
+ }
165
+ .edgePath path, .messageLine0, .messageLine1, .relation {
166
+ stroke: ${r};
167
+ }
168
+ .nodeLabel, .edgeLabel, .actor text, .messageText {
169
+ fill: ${p};
170
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
171
+ }
172
+ .pieCircle {
173
+ stroke: ${n};
174
+ stroke-width: 1.35px;
175
+ opacity: 0.96;
176
+ filter: drop-shadow(0 0 1.5px ${u});
177
+ }
178
+ .pieOuterCircle {
179
+ stroke: ${i};
180
+ opacity: 0.7;
181
+ }
182
+ .slice, .legend text, .pieTitleText {
183
+ fill: ${p};
184
+ paint-order: stroke;
185
+ stroke: ${o};
186
+ stroke-width: 3px;
187
+ stroke-linejoin: round;
188
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
189
+ }
190
+ .slice {
191
+ font-weight: 600;
192
+ letter-spacing: 0.04em;
193
+ font-style: italic;
194
+ }
195
+ .pieTitleText {
196
+ font-weight: 600;
197
+ letter-spacing: 0.12em;
198
+ font-style: italic;
199
+ }
200
+ .legend text {
201
+ font-weight: 500;
202
+ letter-spacing: 0.03em;
203
+ }
204
+ .legend rect {
205
+ rx: 999px;
206
+ ry: 999px;
207
+ opacity: 0.9;
208
+ stroke: ${o};
209
+ stroke-width: 1.5px;
210
+ paint-order: stroke;
211
+ filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
212
+ }
213
+ `}function Pq(e,t){const n=new DOMParser().parseFromString(t,"image/svg+xml"),i=Array.from(n.querySelectorAll("a")),r=Array.from(e.querySelectorAll("a")),o=Math.min(i.length,r.length);for(let u=0;u<o;u++){const h=i[u],p=r[u];if(!h||!p)continue;const f=h.getAttribute("href")??h.getAttribute("xlink:href")??"",m=dL(f);m&&p.setAttribute("href",m)}}function $q(e){const t=e.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}const{x:i,y:r,width:o,height:u}=n;!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(u)||i<0||r<0||o<=0||u<=0||t.setAttribute("viewBox",`${tc(i)} ${tc(r)} ${tc(o)} ${tc(u)}`)}function zq(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),Zq(e),e.dataset[D2]!=="true"&&(e.dataset[D2]="true",e.addEventListener("click",Hq),e.addEventListener("keydown",Fq))}function Hq(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||Ip(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),uL(t))}function Fq(e){if(e.key!=="Enter"&&e.key!==" "||Ip(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),uL(t))}function uL(e){const t=e.querySelector("svg");if(!t)return;rd(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++Mq,o=`diagram-lightbox-title-${r}`;i.className="diagram-lightbox",i.setAttribute("aria-labelledby",o),n||(i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1);const u=document.createElement("div");u.className="diagram-lightbox__frame";const h=document.createElement("div");h.className="diagram-lightbox__header";const p=document.createElement("h2");p.id=o,p.textContent="MANIFEST · DIAGRAM";const f=document.createElement("button");f.className="diagram-lightbox__close",f.type="button",f.setAttribute("aria-label","Close expanded diagram"),f.textContent="Close";const m=document.createElement("div");m.className="diagram-lightbox__controls",m.setAttribute("aria-label","Diagram zoom controls");const _=Sf("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=Sf("+","Zoom in","in"),w=Sf("Fit","Fit diagram to viewport","fit"),x=Sf("Reset","Reset diagram zoom","reset");m.append(_,b,S,w,x);const C=document.createElement("div");C.className="diagram-lightbox__viewport";const D=qq(t),z=t.cloneNode(!0);z.removeAttribute("style"),Kq(z,`diagram-lightbox-svg-${r}`),C.append(z),h.append(p,m,f),u.append(h,C),i.append(u),document.body.append(i);const F=new Uq(C,z,b,D);_.addEventListener("click",()=>F.zoomOut()),S.addEventListener("click",()=>F.zoomIn()),w.addEventListener("click",()=>F.fit()),x.addEventListener("click",()=>F.reset());const N=Vq(i),I=G=>{(G.target===i||G.target===f)&&rd(!0)},j=G=>{if(G.key==="Escape"){G.preventDefault(),rd(!0);return}F.handleKeyboard(G)||G.key==="Tab"&&Xq(G,i)},U={dialog:i,trigger:e,inertStates:N,onClick:I,onKeyDown:j,cleanupPanZoom:()=>F.destroy()};n&&(U.onCancel=G=>{G.preventDefault(),rd(!0)},i.addEventListener("cancel",U.onCancel),i.showModal()),i.addEventListener("click",I),document.addEventListener("keydown",j,!0),Ad=U,F.fit(),f.focus()}function Sf(e,t,n){const i=document.createElement("button");return i.className="diagram-lightbox__zoom-button",i.type="button",i.dataset.zoomAction=n,i.setAttribute("aria-label",t),i.textContent=e,i}class Uq{constructor(t,n,i,r){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=r,this.applyZoom(this.zoomIndex),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerEnd),t.addEventListener("pointercancel",this.onPointerEnd),t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("dblclick",this.onDoubleClick),window.addEventListener("resize",this.onResize)}viewport;svg;readout;baseSize;zoomIndex=Os.indexOf(100);dragStart=null;pinchStart=null;pointers=new Map;destroy(){this.viewport.removeEventListener("pointerdown",this.onPointerDown),this.viewport.removeEventListener("pointermove",this.onPointerMove),this.viewport.removeEventListener("pointerup",this.onPointerEnd),this.viewport.removeEventListener("pointercancel",this.onPointerEnd),this.viewport.removeEventListener("wheel",this.onWheel),this.viewport.removeEventListener("dblclick",this.onDoubleClick),window.removeEventListener("resize",this.onResize),this.pointers.clear()}zoomIn(){this.zoomAroundViewportCenter(Math.min(this.zoomIndex+1,Os.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Os.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,n=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,i=Math.min(t/this.baseSize.width,n/this.baseSize.height),r=Math.floor(i*100),o=Os.findIndex(h=>h>r),u=o===-1?Os.length-1:Math.max(0,o-1);this.applyZoom(u),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-n)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(wf(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(wf(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=wf(this.zoomIndex),i=n/100;this.svg.setAttribute("width",tc(this.baseSize.width*i)),this.svg.setAttribute("height",tc(this.baseSize.height*i)),this.readout.textContent=`${n}%`}zoomAroundViewportCenter(t){const n=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,n.left+n.width/2,n.top+n.height/2)}zoomAroundPoint(t,n,i){if(t===this.zoomIndex)return;const r=this.svgWidth,o=this.svgHeight,u=this.viewport.getBoundingClientRect(),h=this.viewport.scrollLeft+n-u.left,p=this.viewport.scrollTop+i-u.top;this.applyZoom(t),this.viewport.scrollLeft=h/r*this.svgWidth-(n-u.left),this.viewport.scrollTop=p/o*this.svgHeight-(i-u.top)}onPointerDown=t=>{if(t.button!==0||Ip(t.target))return;const n=t.pointerId??1;if(this.pointers.set(n,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:n},this.viewport.setPointerCapture?.(n)};onPointerMove=t=>{const n=t.pointerId??1;if(this.pointers.has(n)&&this.pointers.set(n,t),this.pinchStart&&this.pointers.size>=2){const i=this.pointerDistance()/this.pinchStart.distance,r=wf(this.pinchStart.zoomIndex)*i;this.applyZoom(Gq(r));return}!this.dragStart||this.dragStart.pointerId!==n||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const n=t.pointerId??1;this.pointers.delete(n),this.viewport.releasePointerCapture?.(n),this.dragStart?.pointerId===n&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=t.deltaY<0?Math.min(this.zoomIndex+1,Os.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{Ip(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Os.indexOf(200)?Os.indexOf(100):Os.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,n]=Array.from(this.pointers.values());return!t||!n?1:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}}function Wq(e){const t=P2(e.getAttribute("width")),n=P2(e.getAttribute("height"));if(t&&n)return{width:t,height:n};const i=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],r=i[2],o=i[3],u=r!==void 0&&Number.isFinite(r)&&r>0?r:null,h=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??u??800,height:n??h??600}}function qq(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:Wq(e)}function P2(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function tc(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Gq(e){let t=0,n=Number.POSITIVE_INFINITY;return Os.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function wf(e){return Os[e]??Os[0]}function Kq(e,t){const n=e.getAttribute("id")??"";e.setAttribute("id",t);const i=e.querySelector("style");!n||!i?.textContent||(i.textContent=i.textContent.split(`#${n}`).join(`#${t}`))}function rd(e){const t=Ad;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),Yq(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),Ad=null,e&&t.trigger.isConnected&&t.trigger.focus())}function Vq(e){const t=[];for(const n of Array.from(document.body.children))!(n instanceof HTMLElement)||n===e||(t.push({element:n,ariaHidden:n.getAttribute("aria-hidden"),inert:n.inert}),n.inert=!0,n.setAttribute("aria-hidden","true"));return t}function Yq(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 Xq(e,t){const n=Array.from(t.querySelectorAll(kq)).filter(Qq);if(n.length===0){e.preventDefault(),t.focus();return}const i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function Zq(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function Ip(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!Jq(t)}function Jq(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function Qq(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function dL(e){const t=e.trim();if(!t||t.includes(".."))return null;if(/^[a-z][a-z0-9+.-]*:/i.test(t)){if(/^javascript:/i.test(t)||/^data:/i.test(t))return null;let i;try{i=new URL(t)}catch{return null}return i.origin!==window.location.origin?null:dL(i.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const i=t.slice(7);let r;try{r=decodeURIComponent(i)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(r)?`/entry/${encodeURIComponent(r)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function eG(e){const t=Aq.exec(e);if(!t)return null;const n=t[1]?.trim();if(!n)return null;const i=n.indexOf("/"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1).trim():"",u=r.trim().split(/[\s,]+/).filter(Boolean);if(u.length!==3)return null;const[h,p,f]=u;if(!h||!p||!f)return null;const m=Ev(h,1),_=Ev(p,.4),b=nG(f);if(m===null||_===null||b===null)return null;let S=1;if(i>=0){const w=Ev(o,1);if(w===null)return null;S=w}return{L:m,C:_,h:b,alpha:S}}function tG(e){const t=e.h*Math.PI/180,n=e.C*Math.cos(t),i=e.C*Math.sin(t),r=e.L,o=r+.3963377774*n+.2158037573*i,u=r-.1055613458*n-.0638541728*i,h=r-.0894841775*n-1.291485548*i,p=o**3,f=u**3,m=h**3,_=4.0767416621*p-3.3077115913*f+.2309699292*m,b=-1.2684380046*p+2.6097574011*f-.3413193965*m,S=-.0041960863*p-.7034186147*f+1.707614701*m,w=xf(Tv(_)),x=xf(Tv(b)),C=xf(Tv(S));if(e.alpha<1){const D=xf(e.alpha);return`#${No(w)}${No(x)}${No(C)}${No(D)}`}return`#${No(w)}${No(x)}${No(C)}`}function Ev(e,t){if(!e)return null;if(e.endsWith("%")){const i=Number(e.slice(0,-1));return Number.isFinite(i)?i/100*t:null}const n=Number(e);return Number.isFinite(n)?n:null}function nG(e){const t=Rq.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function Tv(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 xf(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function No(e){return e.toString(16).padStart(2,"0")}const iG=32,hL=v.memo(function({text:t,streaming:n,className:i}){const r=v.useRef(t),o=v.useRef(n?t:""),u=v.useRef(null),[h,p]=v.useState(()=>n?Hs(t).html:"");r.current=t;const f=v.useMemo(()=>n?null:Hs(t).html,[n,t]);return v.useEffect(()=>{if(!n){u.current!==null&&window.clearTimeout(u.current),u.current=null;return}o.current===t||u.current!==null||(u.current=window.setTimeout(()=>{u.current=null;const m=r.current;m!==o.current&&(o.current=m,p(Hs(m).html))},iG))},[n,t]),v.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),c.jsx("div",{className:i,dangerouslySetInnerHTML:{__html:f??h}})}),sG=[{icon:"◈",tone:"aurora",text:"Walk me through how this session unfolded"},{icon:"●",tone:"aurora",text:"What is the agent doing right now?"},{icon:"▲",tone:"coral",text:"Flag anything I should review"},{icon:"≡",tone:"brass",text:"Draft a handoff brief"}],rG=[{icon:"◈",tone:"aurora",label:"Go deeper on the last answer",text:"Go deeper on your previous answer with more evidence citations."},{icon:"▲",tone:"coral",label:"Check for intent drift",text:"Review this session for intent drift against my stated goals."},{icon:"≡",tone:"brass",label:"Turn this into an artifact",text:"Turn your previous answer into a published artifact."},{icon:"●",tone:"aurora",label:"What is the agent doing now?",text:"What is the agent doing right now?"}],aG=[{command:"/now",descriptionKey:"Current state — what the agent is doing right now",templateKey:"What is the agent doing right now?"},{command:"/drift",descriptionKey:"Intent drift review against settled goals",templateKey:"Review this session for intent drift against my stated goals."},{command:"/brief",descriptionKey:"Handoff brief as an artifact",templateKey:"Draft a handoff brief and publish it as an artifact."},{command:"/risks",descriptionKey:"Flag anything that needs review",templateKey:"Flag anything I should review before this work continues."},{command:"/timeline",descriptionKey:"How the session unfolded, end to end",templateKey:"Walk me through how this session unfolded."}],Gl="session-analyst-artifacts";function oG({context:e}){const{state:t,dispatch:n,send:i,stop:r,reset:o}=IN(e),u=e.language??"en",h=_G(),[p,f]=v.useState(0),[m,_]=v.useState(!1),b=t.catalog?.clis.find(H=>H.cliId===t.cliId),S=b?.models.find(H=>H.id===t.model),w=t.entries.length>0,x=t.artifacts.length,C=e.hiddenCompanionPanelIds,D=e.onSetCompanionPanelVisible,z=C!==void 0&&D!==void 0,F=C?.includes(Gl)??!1,N=x>0&&!F,I=t.artifactAuthoring!==null&&x===0,j=v.useRef(0),[U,G]=v.useState(0),W=v.useRef(null),Z=v.useRef(null),V=v.useRef(null),O=t.entries.at(-1),A=t.draft.startsWith("/")?aG.filter(H=>H.command.toLowerCase().startsWith(t.draft.toLowerCase())):[],B=!m&&A.length>0,M=`analysis-${e.operationId}-slash-listbox`,k=H=>`analysis-${e.operationId}-slash-${H.slice(1)}`,T=B?A[Math.min(p,A.length-1)]:void 0,R=v.useRef(w).current,$=w&&!R;v.useLayoutEffect(()=>{const H=Z.current;!H||!w||(H.scrollTop=H.scrollHeight)},[w,O?.text,t.entries.length,t.latestActivity,t.phase,t.artifactAuthoring,t.artifactPublished]),v.useLayoutEffect(()=>{const H=V.current;H&&$2(H)},[t.draft]),v.useLayoutEffect(()=>{const H=V.current;if(!H||typeof ResizeObserver>"u")return;const ne=new ResizeObserver(()=>$2(H));return ne.observe(H),()=>ne.disconnect()},[]),v.useEffect(()=>{const H=Z.current;H&&vm(H)},[]),v.useEffect(()=>{const H=j.current;if(j.current=x,!(!z||!D)){if(x===0){if(t.artifactsAutoOpenArmed||n({type:"artifacts-chip-rearm"}),!F){const ne=document.activeElement instanceof Element&&document.activeElement.closest(".session-analyst__artifacts")!==null;D(Gl,!1),ne&&window.requestAnimationFrame(()=>W.current?.focus())}return}if(H===0&&F&&t.artifactsAutoOpenArmed){D(Gl,!0);return}x>H&&F&&G(ne=>ne+1)}},[x,F,n,D,t.artifactsAutoOpenArmed,z]);const K=async(H,ne)=>{const oe=H.trim();if(oe){if(t.busy){n({type:"queue-push",text:oe}),ne&&n({type:"set-draft",draft:""});return}ne&&n({type:"set-draft",draft:""}),await i(oe)}},L=H=>{const ne=A[H];ne&&(n({type:"set-draft",draft:$e(u,ne.templateKey)}),_(!0),f(0),window.requestAnimationFrame(()=>V.current?.focus()))},q=v.useCallback(H=>{const ne=H.target.closest('[data-action="copy-code"]');if(!ne)return;const oe=ne.closest("pre")?.getAttribute("data-code");oe&&lG(ne,oe,u)},[u]);return c.jsxs("section",{className:`session-analyst__chat-pane ${w?"has-interacted":"is-initial"}`,"aria-label":$e(u,"Session Analyst chat"),"data-phase":t.phase,children:[z?c.jsxs("button",{ref:W,type:"button",className:`session-analyst-handle session-analyst-handle--artifacts${x===0?" is-waiting":""}${I?" is-authoring":""}`,"aria-label":$e(u,N?"Hide Artifacts":"Open Artifacts"),"aria-pressed":N,"aria-disabled":x===0,tabIndex:x===0?-1:void 0,title:I?$e(u,"The analyst is authoring an artifact…"):x===0?$e(u,"Artifacts the analyst publishes appear here"):void 0,onClick:()=>{!D||x===0||(N&&n({type:"artifacts-chip-disarm"}),D(Gl,!N))},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:N?"«":"»"}),x>0?c.jsx("span",{className:`session-analyst-handle__count${U>0?" is-pulsing":""}`,children:x},U):null,I?c.jsx("span",{className:"session-analyst-handle__count",children:"…"}):null,c.jsx("span",{className:"session-analyst-handle__label",children:$e(u,"ARTIFACTS")})]}):null,c.jsx(cG,{state:t,language:u,onReset:()=>{o().catch(()=>{})}}),c.jsxs("div",{className:"session-analyst__workspace",children:[c.jsxs("section",{ref:Z,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[w?c.jsx("ol",{className:"session-analyst__transcript",onClick:q,children:t.entries.map((H,ne)=>c.jsx("li",{className:`session-analyst__message session-analyst__message--${H.role}`,children:H.role==="analyst"?c.jsx(hL,{className:"session-analyst__response markdown-body",text:H.text,streaming:t.busy&&ne===t.entries.length-1}):H.text},`${H.role}-${ne}`))}):c.jsxs("div",{className:"session-analyst__hero-wrap",children:[c.jsxs("header",{className:"session-analyst__hero",children:[c.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),c.jsx("h2",{children:$e(u,"Ask about this session")}),c.jsx("p",{children:$e(u,"Review, explain, and summarize this session — without affecting the host agent.")})]}),c.jsx("div",{className:"session-analyst__suggestions",children:sG.map(H=>c.jsxs("button",{type:"button",onClick:()=>{K($e(u,H.text),!1)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":H.tone,"aria-hidden":"true",children:H.icon}),$e(u,H.text)]},H.text))})]}),t.artifactAuthoring||t.artifactPublished?c.jsx(uG,{state:t,language:u,onOpen:z&&D?()=>D(Gl,!0):void 0}):null,t.phase!=="idle"?c.jsx(dG,{state:t,language:u}):null]}),t.queue.length>0?c.jsx("div",{className:"session-analyst__queue","aria-live":"polite",children:t.queue.map((H,ne)=>c.jsxs("div",{className:"session-analyst__queue-item",children:[c.jsx("span",{className:"session-analyst__queue-tag",children:$e(u,"QUEUED")}),c.jsx("span",{className:"session-analyst__queue-text",children:H}),c.jsx("button",{type:"button","aria-label":$e(u,"Cancel queued question {index + 1}",{"index + 1":ne+1}),onClick:()=>n({type:"queue-cancel",index:ne}),children:"✕"})]},`${H}-${ne}`))}):null,t.phase==="complete"&&!t.busy&&w?c.jsxs("div",{className:"session-analyst__followups",children:[c.jsx("span",{className:"session-analyst__followups-label",children:$e(u,"FOLLOW UP")}),c.jsx("div",{className:"session-analyst__followups-row",children:rG.map(H=>c.jsxs("button",{type:"button",onClick:()=>{K($e(u,H.text),!1)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":H.tone,"aria-hidden":"true",children:H.icon}),$e(u,H.label)]},H.label))})]}):null,c.jsxs("form",{className:`session-analyst__composer ${w?"is-docked":"is-initial"}${$?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:H=>{H.preventDefault(),K(t.draft,!0)},children:[B?c.jsxs("div",{id:M,className:"session-analyst__slash",role:"listbox","aria-label":$e(u,"Analysis commands"),children:[c.jsx("span",{className:"session-analyst__slash-heading",children:$e(u,"Analysis commands")}),A.map((H,ne)=>c.jsxs("button",{type:"button",id:k(H.command),role:"option","aria-selected":ne===p,className:ne===p?"is-selected":void 0,onMouseDown:oe=>oe.preventDefault(),onClick:()=>L(ne),children:[c.jsx("span",{children:H.command}),c.jsx("small",{children:$e(u,H.descriptionKey)})]},H.command))]}):null,w?null:c.jsxs("div",{className:"session-analyst__selector-strip","aria-label":$e(u,"Initial analysis settings"),children:[c.jsx("span",{className:"session-analyst__select",children:c.jsx(Ni,{compact:!0,label:$e(u,"Analysis CLI"),value:t.cliId,disabled:t.started||t.selectionLocked||!t.catalog,options:t.catalog?.clis.map(H=>({value:H.cliId,label:H.label,disabled:!H.available}))??[],onChange:H=>n({type:"select-cli",cliId:H})})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx(Ni,{compact:!0,label:$e(u,"Analysis model"),value:t.model,disabled:t.started||t.selectionLocked||!S,options:b?.models.map(H=>({value:H.id,label:H.label}))??[],onChange:H=>n({type:"select-model",model:H})})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx(Ni,{compact:!0,label:$e(u,"Analysis effort"),value:t.effort,disabled:t.started||t.selectionLocked||!S||!S.effortLevels.length,options:S?.effortLevels.length?S.effortLevels.map(H=>({value:H,label:H})):[{value:"",label:$e(u,"n/a")}],onChange:H=>n({type:"select-effort",effort:H})})}),c.jsx("span",{"aria-live":"polite","aria-atomic":"true",style:{display:"inline-block",inlineSize:"5em",flex:"none",opacity:t.selectionSaved?1:0,textAlign:"center",transition:h?"none":"opacity var(--duration-base) var(--ease-glide)"},children:t.selectionSaved?$e(u,"Saved"):""})]}),c.jsxs("div",{className:"session-analyst__composer-surface",children:[c.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:$e(u,"Ask about this session")}),c.jsx("textarea",{ref:V,id:`analysis-${e.operationId}`,role:"combobox","aria-expanded":B,"aria-controls":M,"aria-activedescendant":T?k(T.command):void 0,rows:1,placeholder:$e(u,"Ask about the session… (/ for commands)"),value:t.draft,onChange:H=>{n({type:"set-draft",draft:H.target.value}),f(0),_(!1)},onKeyDown:H=>{if(B&&!H.nativeEvent.isComposing){if(H.key==="ArrowDown"){H.preventDefault(),f(ne=>(ne+1)%A.length);return}if(H.key==="ArrowUp"){H.preventDefault(),f(ne=>(ne-1+A.length)%A.length);return}if(H.key==="Enter"){H.preventDefault(),L(Math.min(p,A.length-1));return}if(H.key==="Escape"){H.preventDefault(),_(!0);return}}H.key!=="Enter"||H.shiftKey||H.nativeEvent.isComposing||(H.preventDefault(),K(t.draft,!0))}}),t.busy?c.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":$e(u,"Stop"),onClick:()=>{r()},children:c.jsx("span",{"aria-hidden":"true"})}):null,c.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":$e(u,t.busy?"Queue question":"Send"),disabled:!t.draft.trim(),children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:c.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]}),t.busy?c.jsx("div",{className:"session-analyst__composer-hint",children:$e(u,"Enter queues the question — it fires when the analyst is ready")}):null]})]})]})}function $2(e){e.style.height="auto";const t=window.getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||18.75,i=(Number.parseFloat(t.paddingTop)||0)+(Number.parseFloat(t.paddingBottom)||0),r=n*6+i,o=Math.max(36,Math.min(e.scrollHeight,r));e.style.height=`${o}px`,e.style.overflowY=e.scrollHeight>r?"auto":"hidden"}function lG(e,t,n){const i=navigator.clipboard;if(!i)return;let r;try{r=i.writeText(t)}catch{return}const o=e.textContent;r.then(()=>{e.isConnected&&(e.textContent=$e(n,"Copied"),window.setTimeout(()=>{e.isConnected&&(e.textContent=o)},1200))}).catch(()=>{})}function cG({state:e,language:t,onReset:n}){const i=e.started||e.phase!=="idle"||e.draft.length>0||e.queue.length>0||e.entries.length>0||e.artifacts.length>0;return c.jsxs("header",{className:"session-analyst__panel-head",children:[c.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:$e(t,"Session Analyst")}),c.jsx("small",{children:$e(t,"Read-only intelligence for this operation")})]}),c.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":$e(t,"Reset Session Analyst"),onClick:n,disabled:!i,children:$e(t,"Reset")}),c.jsxs("span",{className:"session-analyst__panel-state",children:[c.jsx("i",{"aria-hidden":"true"}),pG(e,t)]})]})}function uG({state:e,language:t,onOpen:n}){const i=gG(e.artifactAuthoring?.startedAt??null);if(e.artifactAuthoring)return c.jsxs("div",{className:"session-analyst__author-card is-authoring",children:[c.jsxs("div",{className:"session-analyst__author-head",children:[c.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"✳"}),c.jsx("strong",{className:"session-analyst__author-title",children:$e(t,"Publishing an artifact")}),c.jsx("time",{className:"session-analyst__author-time",children:Ib(i)})]}),c.jsx("p",{className:"session-analyst__author-sub",children:$e(t,"The analyst is authoring artifact content. It opens in Artifacts when it lands.")}),c.jsx("div",{className:"session-analyst__author-track","aria-hidden":"true",children:c.jsx("span",{})})]});const r=e.artifactPublished;return r?c.jsx("div",{className:"session-analyst__author-card is-done",children:c.jsxs("div",{className:"session-analyst__author-head",children:[c.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"◆"}),c.jsx("strong",{className:"session-analyst__author-title",children:$e(t,"Artifact published — {title}",{title:r.artifact.title})}),r.durationMs===null?null:c.jsx("time",{className:"session-analyst__author-time",children:Ib(r.durationMs)}),n?c.jsx("button",{type:"button",className:"session-analyst__author-open",onClick:n,children:$e(t,"Open in Artifacts")}):null]})}):null}function dG({state:e,language:t}){const n=mG(e),i=Ib(n),r=fG(e.latestActivity,t);if(e.phase==="complete")return null;if(e.phase==="stopped")return c.jsx("div",{className:"session-analyst__receipt is-stopped",role:"status",children:$e(t,"Stopped · last confirmed: {activity} · {elapsed}",{activity:r,elapsed:i})});const o=e.phase==="error",u=hG(e.latestActivity,t);return c.jsxs("div",{className:`session-analyst__pulse${o?" is-error":""}`,role:o?"alert":"status","aria-live":o?void 0:"polite",children:[o?null:c.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),c.jsxs("div",{className:"session-analyst__pulse-main",children:[c.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),c.jsxs("span",{className:"session-analyst__pulse-copy",children:[c.jsx("strong",{children:o?EU(t,e.error??""):u.label},`${e.phase}-${u.label}`),c.jsx("small",{children:o?t==="ko"?r:`Last confirmed activity: ${r}`:u.note})]}),c.jsx("time",{children:i})]}),c.jsx("span",{className:"session-analyst__truth-mark",children:$e(t,"Last confirmed activity only")})]})}function hG(e,t){return!e||e.kind==="starting"?{label:$e(t,"Starting analyst"),note:$e(t,e?.connected?"Analyst connection confirmed":"Starting a new analysis session")}:e.kind==="reasoning"?{label:$e(t,"Reasoning over session"),note:$e(t,"Thought event received · content hidden")}:e.kind==="tool"?{label:$e(t,"Using {title}",{title:e.title}),note:$e(t,"Tool status: {status}",{status:e.status})}:{label:$e(t,"Writing answer"),note:$e(t,"Answer chunk received")}}function fG(e,t){return!e||e.kind==="starting"?$e(t,"Starting analyst"):e.kind==="reasoning"?$e(t,"Reasoning over session"):e.kind==="tool"?`${$e(t,"Using {title}",{title:e.title})} (${e.status})`:$e(t,"Writing answer")}function pG(e,t){return e.phase==="error"?$e(t,"Needs attention"):e.busy?$e(t,"Analyzing"):e.phase==="complete"?$e(t,"Complete"):e.phase==="stopped"?$e(t,"Stopped"):$e(t,"Ready")}function mG(e){const[t,n]=v.useState(()=>Date.now());return v.useEffect(()=>{if(!e.busy)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e.busy,e.runStartedAt]),e.runStartedAt===null?0:Math.max(0,(e.runEndedAt??t)-e.runStartedAt)}function gG(e){const[t,n]=v.useState(()=>Date.now());return v.useEffect(()=>{if(e===null)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e]),e===null?0:Math.max(0,t-e)}function Ib(e){return`${Math.floor(e/1e3)}s`}function _G(){const[e,t]=v.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return v.useEffect(()=>{if(typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-reduced-motion: reduce)"),i=()=>t(n.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),e}class wr extends Error{constructor(t,n){super(n),this.status=t}status}const vG=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function yG(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await M1(t),pL(await t.json(),t.status)}async function fL(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await M1(t),xG(await t.json(),t.status)}async function bG(e,t,n){return L1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function SG(e,t,n,i){return L1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function wG(e,t,n){return L1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function L1(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await M1(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new wr(r.status,"Invalid carrier settings mutation response");return{state:pL(o.state,r.status)}}async function M1(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new wr(e.status,t)}function pL(e,t){mL(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new wr(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>CG(i,t))}}function xG(e,t){mL(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new wr(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>kG(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function CG(e,t){const n=e;if(!n||typeof n.carrierId!="string"||typeof n.displayName!="string"||typeof n.sourceDisplayName!="string"||typeof n.role!="string"||typeof n.roleDescription!="string"||typeof n.slot!="number"||typeof n.cliType!="string"||typeof n.defaultCliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string"||typeof n.taskForceCapable!="boolean"||!n.taskforce||!Array.isArray(n.taskforce.backends))throw new wr(t,"Invalid carrier settings carrier response");return{carrierId:n.carrierId,displayName:n.displayName,sourceDisplayName:n.sourceDisplayName,role:n.role,roleDescription:n.roleDescription,...n.category?{category:n.category}:{},slot:n.slot,cliType:n.cliType,defaultCliType:n.defaultCliType,model:n.model,...n.effort?{effort:n.effort}:{},taskForceCapable:n.taskForceCapable,taskforce:{backends:n.taskforce.backends.map(i=>TG(i,t))}}}function kG(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.displayName!="string"||!Array.isArray(n.models)||typeof n.defaultModel!="string")throw new wr(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>EG(i,t)),defaultModel:n.defaultModel}}function EG(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new wr(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new wr(t,"Invalid carrier settings effort option");return{modelId:n.modelId,name:n.name,...n.effort?{effort:{levels:n.effort.levels.filter(i=>typeof i=="string"),default:n.effort.default}}:{}}}function TG(e,t){const n=e;if(!n||typeof n.cliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string")throw new wr(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function mL(e,t){const n=[e];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object"))for(const[r,o]of Object.entries(i)){if(vG.has(r))throw new wr(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const AG=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class sr extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function gL(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await ca(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new sr(t.status,"Invalid agent state response");return n.agentClis.map(i=>BG(i,t.status))}async function RG(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await ca(t);const n=await t.json();if(!Array.isArray(n.clis))throw new sr(t.status,"Invalid Agent CLI state response");return n}async function NG(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await ca(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new sr(t.status,"Invalid tenants response");return n.tenants.map(i=>PG(i,t.status))}async function LG(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await ca(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new sr(t.status,"Invalid jobs response");return n.tenants}async function MG(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await ca(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new sr(t.status,"Invalid agent sessions response");return n.sessions.map(i=>ym(i,t.status))}async function jG(e){const t=await fetch("/api/v1/operations",{signal:e});await ca(t);const n=await t.json();if(!Array.isArray(n.operations))throw new sr(t.status,"Invalid operations response");return{operations:n.operations.map(i=>$G(i,t.status))}}async function OG(e,t,n){const i=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:n});return await ca(i),ym(await i.json(),i.status)}async function DG(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await ca(n),ym(await n.json(),n.status)}async function IG(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ca(n)}function ym(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||Bb(n))throw new sr(t,"Invalid agent session response");return{sessionId:n.sessionId,terminalSessionId:typeof n.terminalSessionId=="string"?n.terminalSessionId:n.sessionId,cwdLabel:n.cwdLabel,label:typeof n.label=="string"?n.label:void 0,cliId:typeof n.cliId=="string"?n.cliId:void 0,cliLabel:typeof n.cliLabel=="string"?n.cliLabel:void 0,status:n.status,turnState:n.turnState==="running"||n.turnState==="ended"?n.turnState:"none",createdAt:n.createdAt,theaterId:typeof n.theaterId=="string"?n.theaterId:void 0,tenantId:typeof n.tenantId=="string"?n.tenantId:void 0,registrationId:typeof n.registrationId=="string"?n.registrationId:void 0,resumeAvailable:n.resumeAvailable===!0}}async function ca(e){if(!e.ok)throw new sr(e.status,`Agent plugin request failed: ${e.status}`)}function BG(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new sr(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function PG(e,t){const n=e;if(!n||typeof n.tenantId!="string"||typeof n.tenantLabel!="string"||typeof n.createdAt!="number"||typeof n.sessions!="number")throw new sr(t,"Invalid tenant response");return n}function $G(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||Bb(n)||Bb(n.payload))throw new sr(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,ts:n.ts}}function Bb(e){return Pb(e,new Set(AG))}function Pb(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Pb(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Pb(i,t))}const zG="active",$b=new Set(["done","error","aborted"]);function HG(e,t){let n=vL(zb(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=_L(n,i);return $b.has(t.status)&&!$b.has(n.status)&&(n={...n,status:t.status}),n}function _L(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:qG(e.recentEvents,t)};switch(t.type){case"job:registered":return UG(i,n);case"job:finalized":return{...i,status:Mn(n.status)??"done",finishedAt:Ga(n.finishedAt)??t.at,summary:Mn(n.summary),error:Mn(n.error)};case"track:begin":return zl(vL(i,n.request),n,t.id,r=>({...r,startedAt:Ga(n.startedAt)??t.at,requestPreview:Mn(n.requestPreview)}));case"track:status":return zl(i,n,t.id,r=>({...r,status:Mn(n.status)??r.status}));case"track:text":return zl(i,n,t.id,r=>{const o=r.text+(Mn(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Ga(n.textLength)??Mn(n.text)?.length??0),latestLine:GG(o)||r.latestLine}});case"track:thought":return zl(i,n,t.id,r=>{const o=r.thought+(Mn(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Ga(n.textLength)??Mn(n.text)?.length??0)}});case"track:tool":return zl(i,n,t.id,r=>({...r,status:"stream",tools:WG(r.tools,n)}));case"track:finalized":return zl(i,n,t.id,r=>{const o=z2(r.text,r.sentTextLength,Mn(n.fallbackText),Ga(n.fallbackTextLength)),u=z2(r.thought,r.sentThoughtLength,Mn(n.fallbackThought),Ga(n.fallbackThoughtLength));return{...r,status:Mn(n.status)??"done",finishedAt:Ga(n.finishedAt)??t.at,error:Mn(n.error),text:o.text,sentTextLength:o.sentLength,thought:u.text,sentThoughtLength:u.sentLength}});default:return i}}function vL(e,t){if(e.request)return e;const n=FG(t);return n?{...e,request:n}:e}function FG(e){if(typeof e!="object"||e===null)return;const t=e;if(!Array.isArray(t.blocks)||typeof t.additional!="string")return;const n=[];for(const i of t.blocks){if(typeof i!="object"||i===null)return;const r=i;if(typeof r.tag!="string"||typeof r.hint!="string"||typeof r.required!="boolean"||typeof r.present!="boolean"||typeof r.body!="string")return;n.push({tag:r.tag,hint:r.hint,required:r.required,present:r.present,body:r.body})}return{blocks:n,additional:t.additional}}function zb(e,t,n){return{jobId:t,tenantId:e,status:zG,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function Sc(e){return $b.has(e)}function UG(e,t){const n=Array.isArray(t.tracks)?t.tracks:[];let i=e.trackOrder,r=e.tracks;for(const o of n){if(!o.trackId)continue;const u=r[o.trackId],h={...u??yL(o.trackId),displayName:o.displayName??u?.displayName??o.trackId,displayCli:o.displayCli??u?.displayCli,model:o.model??u?.model,effort:o.effort??u?.effort,subtitle:o.subtitle??u?.subtitle,kind:o.kind??u?.kind,startedAt:o.startedAt??u?.startedAt};u||(i=[...i,o.trackId]),r={...r,[o.trackId]:h}}return{...e,label:Mn(t.label)??e.label,ownerCarrierId:Mn(t.ownerCarrierId)??e.ownerCarrierId,kind:Mn(t.kind)??e.kind,signatureCli:Mn(t.signatureCli)??e.signatureCli,startedAt:Ga(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function zl(e,t,n,i){const r=Mn(t.trackId);if(!r)return e;const o=e.tracks[r],u={...i(o??yL(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:u}}}function yL(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function WG(e,t){const n=Mn(t.toolId)??Mn(t.id);if(!n)return e;const i={id:n,name:Mn(t.name),input:t.input,output:t.output,status:Mn(t.status)},r=e.findIndex(o=>o.id===n);return r>=0?[...e.slice(0,r),{...e[r],...i},...e.slice(r+1)]:[...e,i]}function z2(e,t,n,i){return n?t>=(i??n.length)?{text:e,sentLength:t}:{text:n,sentLength:i??n.length}:{text:e,sentLength:t}}function qG(e,t){return[...e,t].slice(-120)}function GG(e){const t=e.trim();if(!t)return"";const n=t.split(`
214
+ `);return n[n.length-1]?.trim()??""}function Mn(e){return typeof e=="string"?e:void 0}function Ga(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const KG=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function VG(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
215
+
216
+ `);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=XG(r);o&&n.push(o),i=e.indexOf(`
217
+
218
+ `)}return n}}function YG(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const i=t.tenant?.tenantId;return!i||!t.truncation?null:{kind:"truncation",tenantId:i,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const i=F2(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=F2(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:ZG(t.reason)}:null}const n=H2(t.event)??H2(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function XG(e){const t=e.split(`
219
+ `),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
220
+ `);return!i&&n==="message"?null:{event:n,data:i}}function H2(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 F2(e){try{return ym(e,200)}catch{return null}}function ZG(e){return typeof e=="string"&&KG.has(e)?e:void 0}const j1={droppedCount:0},Hb=new Set;let bn={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function JG(){return iT(QG,bL)}function bL(){return bn}function QG(e){return Hb.add(e),()=>{Hb.delete(e)}}function gs(e){bn={...bn,...e},rK()}function SL(e){gs({agentClis:e})}function eK(e){const t={};for(const n of e)t[n.sessionId]=n;gs({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function Bp(e){const t=!!bn.sessions[e.sessionId];gs({sessions:{...bn.sessions,[e.sessionId]:e},sessionOrder:t?bn.sessionOrder:[e.sessionId,...bn.sessionOrder],turnState:{...bn.turnState,[e.sessionId]:e.turnState}})}function wL(e){const{[e]:t,...n}=bn.sessions,{[e]:i,...r}=bn.turnState;gs({sessions:n,sessionOrder:bn.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:bn.activeTerminalSessionId===e?null:bn.activeTerminalSessionId,turnState:r})}function xL(e){gs({activeTerminalSessionId:e})}function tK(e){gs({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...bn.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&bn.tenantJobs[t])]})}function nK(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=HG(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??j1}}gs({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...bn.tenantOrder.filter(n=>t[n])]})}function iK(e,t){const n=e.tenantId,i=e.jobId??aK(e),r=bn.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:j1},o=i?r.jobs[i]??zb(n,i,e.at):zb(n,"__unknown__",e.at),u=_L(o,e),h=i&&r.jobOrder.includes(i)?r.jobOrder:i?[i,...r.jobOrder]:r.jobOrder,p={...r,tenantLabel:t??r.tenantLabel,jobOrder:h,jobs:i?{...r.jobs,[i]:u}:r.jobs};return gs({tenantJobs:{...bn.tenantJobs,[n]:p},tenantOrder:bn.tenantOrder.includes(n)?bn.tenantOrder:[n,...bn.tenantOrder]}),{job:u,unknownTenant:!bn.tenantJobs[n]}}function sK(e,t,n){const i=bn.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:j1};gs({tenantJobs:{...bn.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function CL(e){const t=e.tenantId;if(!t)return[];const n=bn.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function rK(){for(const e of Hb)e()}function aK(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const U2=250,oK=5e3,Fb=new Map;function lK(e){const t=new AbortController;return cK(t.signal,e),()=>t.abort()}async function cK(e,t){let n=U2;for(;!e.aborted;){gs({connection:"connecting"});try{await fK(e,t);const i=await fetch("/plugins/terminal/agent/events",{signal:e});if(!i.ok||!i.body)throw new Error(`Agent stream failed: ${i.status}`);gs({connection:"live",connectionError:null}),n=U2,await uK(i.body.getReader(),e,t),e.aborted||gs({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;gs({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await mK(n,e),n=Math.min(n*2,oK)}}async function uK(e,t,n){const i=new TextDecoder,r=VG();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const u of r(i.decode(o.value,{stream:!0}))){const h=YG(u);if(h){if(h.kind==="truncation"&&h.truncation){sK(h.tenantId,h.tenantLabel,h.truncation);continue}if(h.kind==="session"&&h.session){Bp(h.session),Pp(n,h.session.sessionId,O1(h.session));continue}if(h.kind==="attention"&&h.session){Bp(h.session),h.reason!=="idle_prompt"&&Pp(n,h.session.sessionId,"awaiting");continue}h.event&&(iK(h.event,h.tenantLabel),hK(n,h.event.tenantId))}}}}function O1(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&dK(e)?"running":"idle"}function dK(e){return CL(e).some(t=>!Sc(t.status))}function Pp(e,t,n){const i=Fb.get(t);e.status.set(t,n),Fb.set(t,n),i!==n&&(n==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):n==="idle"&&(i==="running"||i==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function hK(e,t){const{sessions:n}=bL();for(const i of Object.values(n))i.tenantId===t&&Fb.get(i.sessionId)!=="awaiting"&&Pp(e,i.sessionId,O1(i))}async function fK(e,t){const[n,i,r,o,u]=await Promise.all([gL(e),MG(e),NG(e),LG(e),jG(e)]);SL(n),eK(i),tK(r),nK(o);for(const h of i)Pp(t,h.sessionId,O1(h));pK(u.operations,t)}function pK(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function mK(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const gK=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest"]);function _K(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return`${n}m ${i}s`}function vK(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function yK(e){return e.trackOrder.reduce((t,n)=>{const i=e.tracks[n];return i?t+Math.round((i.sentTextLength+i.sentThoughtLength)/4):t},0)}function kL(e){if(e)return gK.has(e)?e:void 0}function bK(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function Fd(e){return e==="err"||e==="error"}function wc(e,t){return!Sc(e)&&bK(t)}function EL(e,t){if(Fd(e.status))return{label:"Error",tone:"error"};if(e.status==="aborted")return{label:"Aborted",tone:"error"};if(e.status==="done")return{label:"Done",tone:"done"};if(t==="error")return{label:"Error",tone:"error"};if(t==="aborted")return{label:"Aborted",tone:"error"};if(t==="done")return{label:"Done",tone:"done"};const n=e.tools.at(-1);return n&&TL(n.status)==="live"?{label:`Using ${n.name??"tool"}`,tone:"live"}:e.text.length>0?{label:"Writing",tone:"live"}:e.thought.length>0?{label:"Reasoning",tone:"live"}:{label:"Working",tone:"live"}}function TL(e){return e==="done"||e==="completed"?"done":e==="error"||e==="failed"?"error":"live"}function SK(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e;for(const n of["file_path","path","file","command","query","url","pattern"]){const i=t[n];if(typeof i=="string")return i.slice(0,60)}return null}function D1(e,t){return Fd(e)?"error":e==="done"||e==="aborted"?e:Sc(t)?t:e}function wK(e,t){const n=new Set(e),i=t.filter(r=>n.has(r)?!1:(n.add(r),!0));return i.length===0?e:[...e,...i]}function xK(e,t,n){const i=new Map(e.map(o=>[o.jobId,o]));let r=!1;for(const o of t)i.get(o)?.expiresAt!==n&&(i.set(o,{jobId:o,expiresAt:n}),r=!0);return r?[...i.values()]:e}function CK(e,t,n){const i=new Set(t.map(o=>o.jobId)),r=e.filter(o=>o.expiresAt>n&&i.has(o.jobId));return r.length===e.length?e:r}function AL(e,t){const n=new Map(e.map(i=>[i.jobId,i]));return t.flatMap(i=>{const r=n.get(i);return r?[r]:[]})}function kK(e){const t=e.flatMap(r=>r.trackOrder.map(o=>({job:r,track:r.tracks[o]}))).filter(r=>!!r.track).sort((r,o)=>o.track.lastEventId-r.track.lastEventId),n=t.filter(({job:r,track:o})=>wc(r.status,o.status)),i=n.length>0?n:t;for(const{job:r,track:o}of i){if(o.latestLine)return{text:o.latestLine,thinking:!1};if(wc(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function EK(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=AL(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class bm extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function TK(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await I1(t),NL(await t.json(),t.status)}async function AK(e,t,n){const i=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t}),signal:n});return await I1(i),RL(await i.json(),i.status)}async function RK(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await I1(n),RL(await n.json(),n.status)}async function I1(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new bm(e.status,t)}function RL(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new bm(t,"Invalid model auth mutation response");return{state:NL(n.state,t)}}function NL(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new bm(t,"Invalid model auth state response");return{providers:n.providers.map(i=>NK(i,t))}}function NK(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new bm(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const Ub=new Set;let Wb={loading:!1,state:null,busyCli:null,error:null},na=0;function LK(){return v.useSyncExternalStore(MK,W2,W2)}function W2(){return Wb}function MK(e){return Ub.add(e),()=>Ub.delete(e)}async function jK(e){const t=++na;ia({loading:!0,error:null});try{const n=await TK(e);if(t!==na)return;ia({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==na)return;ia({loading:!1,error:B1(n)})}}async function OK(e,t){const n=++na;ia({busyCli:e,error:null});try{const i=await AK(e,t);return n!==na||(ia({state:i.state,busyCli:null,error:null}),await LL()),!0}catch(i){return n!==na||ia({busyCli:null,error:B1(i)}),!1}}async function DK(e){const t=++na;ia({busyCli:e,error:null});try{const n=await RK(e);return t!==na||(ia({state:n.state,busyCli:null,error:null}),await LL()),!0}catch(n){return t!==na||ia({busyCli:null,error:B1(n)}),!1}}async function LL(){try{SL(await gL())}catch{}}function ia(e){Wb={...Wb,...e};for(const t of Ub)t()}function B1(e){return e instanceof Error?e.message:String(e)}class ML extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function IK(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await jL(t),OL(await t.json(),t.status)}async function BK(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await jL(n),OL(await n.json(),n.status)}async function jL(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new ML(e.status,t)}function OL(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new ML(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode,kimiModel:PK(n.kimiModel)}}function PK(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.model!="string"||t.model.length===0?null:{model:t.model,...typeof t.effort=="string"?{effort:t.effort}:{}}}const qb=new Set;let $p={loading:!1,state:null,savingField:null,error:null},Jf=0;function P1(){return v.useSyncExternalStore($K,q2,q2)}function q2(){return $p}function $K(e){return qb.add(e),()=>{qb.delete(e)}}async function $1(e){const t=++Jf;cc({loading:!0,error:null});try{const n=await IK(e);if(t!==Jf)return;cc({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Jf)return;cc({loading:!1,error:DL(n)})}}async function z1(e,t){const n=$p.state;if(!n||e==="kimiModel"&&t===null)return!1;Jf+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:e==="codexLaunchMode"?{codexLaunchMode:i.codexLaunchMode}:{kimiModel:i.kimiModel};cc({state:i,savingField:e,error:null});try{const o=await BK(r);return cc({state:o,savingField:null,error:null}),!0}catch(o){return cc({state:n,savingField:null,error:DL(o)}),!1}}function cc(e){$p={...$p,...e};for(const t of qb)t()}function DL(e){return e instanceof Error?e.message:String(e)}function zK({job:e}){const t=e.request;return c.jsxs("section",{className:"request-details","aria-label":`Request for ${e.label??e.jobId}`,children:[c.jsxs("div",{className:"job-overlay-head",children:[c.jsx("span",{className:"job-overlay-kicker",children:e.status}),c.jsx("strong",{children:e.label??e.jobId})]}),t?c.jsxs("div",{className:"request-details-blocks",children:[t.blocks.map((n,i)=>c.jsx(HK,{block:n},`${n.tag}-${i}`)),t.additional.trim().length>0?c.jsxs("section",{className:"request-details-block request-details-additional","aria-label":"Additional request",children:[c.jsxs("header",{className:"request-details-block-head",children:[c.jsx("span",{className:"request-details-tag",children:"Additional"}),c.jsx("span",{className:"request-details-presence",children:"residual"})]}),c.jsx("pre",{children:t.additional})]}):null]}):c.jsx("p",{className:"request-details-unavailable",children:"Request unavailable for this legacy job."})]})}function HK({block:e}){const t=e.present?e.body.length===0?"present · empty":"present":e.required?"missing · required":"missing · optional";return c.jsxs("section",{className:"request-details-block","aria-label":`${e.tag} ${t}`,children:[c.jsxs("header",{className:"request-details-block-head",children:[c.jsx("span",{className:"request-details-tag",children:e.tag}),c.jsx("span",{className:"request-details-hint",children:e.hint}),c.jsx("span",{className:"request-details-required",children:e.required?"required":"optional"}),c.jsx("span",{className:`request-details-presence ${e.present?"is-present":"is-missing"}`,children:t})]}),e.present?c.jsx("pre",{children:e.body}):null]})}const FK=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],UK="/plugins/terminal/agent/ticket",WK="/plugins/terminal/ws",Av="fleet-plugin.terminal.stream-dock-expanded",qK="fleet-plugin.terminal.stream-dock-collapsed",GK=56,KK=4e3,VK={...hF,step:1,defaultValue:14},YK="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",XK=5e3,IL={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>ad(e.payload,"cliLabel")??void 0,render:e=>c.jsx(nV,{context:e}),canOpenCompanions:({api:e,operation:t})=>RN(e,t.id),companions:[{id:"session-analyst-chat",title:"Session Analyst",hideCaption:!0,render:e=>c.jsx(oG,{context:e})},{id:Gl,title:"Artifacts",hideCaption:!0,defaultHidden:!0,render:e=>c.jsx(PU,{context:e})}]},BL={id:"general",title:"General",render:()=>c.jsx(rV,{})},PL={id:"agent-cli",title:"Agent CLI",render:()=>c.jsx(aV,{})},$L={id:"agent.attention",title:"Agent input waiting"},ZK={id:"agent.ended",title:"Agent turn ended"},Cf={id:"terminal",operationKinds:[IL],settingsSections:[BL,PL],notificationKinds:[$L,ZK],install:e=>JK(e),closeOperation:async e=>{try{await IG(e)}finally{MU(e),wL(e)}},launch:async({theaterId:e,kind:t})=>{const n=await OG(e,t.id);return Bp(n),xL(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?c.jsx(kV,{}):e.id==="claude"?c.jsx(xV,{}):e.id==="codex"?c.jsx(CV,{}):c.jsx(wV,{})};function JK(e){return lK({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function zL(e,t){const n=v.useRef(null),i=v.useRef(null),r=v.useRef(!0),[o,u]=v.useState(!0),h=v.useCallback(f=>{r.current!==f&&(r.current=f,u(f))},[]);v.useEffect(()=>{const f=n.current;if(!f)return;const m=()=>{const _=f.scrollHeight-f.scrollTop-f.clientHeight;h(_<=GK)};return f.addEventListener("scroll",m,{passive:!0}),()=>f.removeEventListener("scroll",m)},[e,h]),v.useLayoutEffect(()=>{h(!0);const f=n.current;f&&(f.scrollTop=f.scrollHeight)},[e,h]),v.useLayoutEffect(()=>{const f=n.current;!f||!r.current||(f.scrollTop=f.scrollHeight)},[t]),v.useEffect(()=>{if(typeof ResizeObserver>"u")return;const f=n.current,m=i.current;if(!f||!m)return;const _=new ResizeObserver(()=>{r.current&&(f.scrollTop=f.scrollHeight)});return _.observe(m),()=>_.disconnect()},[e]);const p=v.useCallback(()=>{const f=n.current;f&&(f.scrollTop=f.scrollHeight,f.focus({preventScroll:!0}),h(!0))},[h]);return{containerRef:n,contentRef:i,pinned:o,jumpToLatest:p}}function QK(e){return Array.from(e.querySelectorAll("button, summary, [href], input, select, textarea, [tabindex]")).filter(t=>{if(t.tabIndex<0||t.hidden||t.closest("[hidden]")||t.matches(":disabled"))return!1;const n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"&&t.getClientRects().length>0})}function eV(){const[e,t]=v.useState(()=>{try{return localStorage.removeItem(qK),localStorage.getItem(Av)==="true"}catch{return!1}}),n=v.useCallback(i=>{try{i?localStorage.setItem(Av,"true"):localStorage.removeItem(Av)}catch{}t(i)},[]);return[e,n]}function HL(e,t){const[n,i]=v.useState(Date.now);return v.useEffect(()=>{if(e===void 0||t!==void 0)return;const r=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(r)},[e,t]),e===void 0?"":_K((t??n)-e)}function tV(e){const t=e.companionsOpen??!1,[n,i]=v.useState(!1);return v.useEffect(()=>{if(t||n)return;let r=!1,o=!1;const u=async()=>{if(o)return;o=!0;const p=await RN(e.api,e.operationId);o=!1,!r&&p&&i(!0)};u();const h=window.setInterval(()=>{u()},XK);return()=>{r=!0,window.clearInterval(h)}},[t,e.api,e.operationId,n]),t||n}function G2({context:e,ready:t}){const n=e.companionsOpen??!1,i=e.language??"en";return c.jsxs("button",{type:"button",className:`session-analyst-handle${t?"":" is-waiting"}`,"aria-label":$e(i,n?"Exit Session Analyst":"Open Session Analyst"),"aria-pressed":n,"aria-disabled":!t,disabled:!t,title:t?void 0:$e(i,"Send a message in this session first"),onClick:()=>{t&&e.onRequestCompanions?.(!e.companionsOpen)},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),c.jsx("span",{className:"session-analyst-handle__label",children:$e(i,n?"EXIT":"ANALYZE")})]})}function nV({context:e}){const n=JG().sessions[e.operationId]??mV(e),[i,r]=v.useState(!1),[o,u]=v.useState("request"),[h,p]=v.useState([]),[f,m]=v.useState([]),_=v.useId(),b=v.useRef(null),S=v.useRef(null),w=v.useRef(null),x=v.useRef(new Set),C=v.useRef(!0),D=tV(e);v.useEffect(()=>{const A=e.companionsOpen??!1,B=C.current;C.current=A,B&&!A&&jU(e.operationId)},[e.companionsOpen,e.operationId]);const z=CL(n),F=z.filter(A=>!Sc(A.status)),N=EK(F,z,f),I=AL(z,h),j=`${i}:${o}`,U=I.map(A=>`${A.jobId}:${A.lastEventId}`).join(","),G=zL(j,U);v.useLayoutEffect(()=>{const A=x.current,B=z.filter(M=>A.has(M.jobId)&&Sc(M.status)).map(M=>M.jobId);x.current=new Set(F.map(M=>M.jobId)),B.length!==0&&m(M=>xK(M,B,Date.now()+KK))},[F,z]),v.useEffect(()=>{if(f.length===0)return;const A=Math.min(...f.map(M=>M.expiresAt)),B=window.setTimeout(()=>{m(M=>CK(M,z,Date.now()))},Math.max(0,A-Date.now()));return()=>window.clearTimeout(B)},[z,f]),v.useEffect(()=>{i&&p(A=>wK(A,F.map(B=>B.jobId)))},[F,i]);const W=v.useCallback(()=>{r(!1),p([]),w.current?.focus()},[]),Z=v.useCallback(()=>{p(N.map(A=>A.jobId)),u("request"),r(!0)},[N]),V=v.useCallback(A=>{u(A)},[]),O=v.useCallback(A=>{const B=["request","activity"],M=B.indexOf(o);let k;if(A.key==="ArrowLeft"&&(k=(M+B.length-1)%B.length),A.key==="ArrowRight"&&(k=(M+1)%B.length),A.key==="Home"&&(k=0),A.key==="End"&&(k=B.length-1),k===void 0)return;A.preventDefault();const T=B[k];u(T),document.getElementById(`${_}-${T}`)?.focus()},[o,_]);return v.useLayoutEffect(()=>{if(!i)return;const A=window.requestAnimationFrame(()=>b.current?.focus());return()=>window.cancelAnimationFrame(A)},[i]),v.useEffect(()=>{if(!i)return;const A=B=>{if(B.key==="Escape"){B.stopPropagation(),W();return}if(B.key==="Tab"){const M=S.current;if(!M)return;const k=QK(M),T=k[0],R=k[k.length-1];B.shiftKey&&document.activeElement===T?(B.preventDefault(),R?.focus()):!B.shiftKey&&document.activeElement===R&&(B.preventDefault(),T?.focus())}};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[i,W]),n.status==="dormant"?c.jsxs("div",{className:"agent-stream-host",children:[c.jsx(G2,{context:e,ready:D}),c.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{pV(n.sessionId)},children:[c.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),c.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]})]}):c.jsxs("div",{className:"agent-stream-host",children:[c.jsx(G2,{context:e,ready:D}),c.jsx(_1,{operationId:n.sessionId,ticketPath:UK,wsPath:WK,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,theme:e.theme,onExit:()=>wL(n.sessionId)}),N.length>0?c.jsx(iV,{activeJobs:N,onOpenDetail:Z,detailBtnRef:w}):null,i?c.jsxs("div",{ref:S,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[c.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:W}),c.jsxs("div",{className:"job-overlay-card",children:[c.jsx("button",{ref:b,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:W,children:"×"}),c.jsxs("div",{className:"job-overlay-tabs",role:"tablist","aria-label":"Carrier stream details",children:[c.jsx("button",{id:`${_}-request`,type:"button",role:"tab","aria-selected":o==="request","aria-controls":`${_}-request-panel`,tabIndex:o==="request"?0:-1,onClick:()=>V("request"),onKeyDown:O,children:"Request"}),c.jsx("button",{id:`${_}-activity`,type:"button",role:"tab","aria-selected":o==="activity","aria-controls":`${_}-activity-panel`,tabIndex:o==="activity"?0:-1,onClick:()=>V("activity"),onKeyDown:O,children:"Activity"})]}),c.jsx("div",{id:`${_}-request-panel`,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-request`,hidden:o!=="request",tabIndex:o==="request"?0:-1,children:I.length===0?c.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):I.map(A=>c.jsx(zK,{job:A},A.jobId))}),c.jsx("div",{id:`${_}-activity-panel`,ref:o==="activity"?G.containerRef:void 0,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-activity`,hidden:o!=="activity",tabIndex:o==="activity"?0:-1,children:c.jsx("div",{className:"job-overlay-panel-content",ref:G.contentRef,children:I.length===0?c.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):I.map(A=>c.jsx(hV,{job:A},A.jobId))})}),o==="activity"&&!G.pinned?c.jsx("button",{type:"button",className:"follow-button",onClick:G.jumpToLatest,children:"↓ Follow"}):null]})]}):null]})}function iV({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=eV(),o=e[0],u=HL(o?.startedAt,o?.finishedAt),h=e.reduce((O,A)=>O+yK(A),0),p=vK(h),f=e.length===1&&o?o.label:void 0,m=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",_=kK(e),b=e.map(O=>`${O.jobId}:${O.lastEventId}`).join(","),S=`${i}:${e.map(O=>O.jobId).join(",")}`,{containerRef:w,pinned:x,jumpToLatest:C}=zL(S,b),D=e.some(O=>O.trackOrder.some(A=>{const B=O.tracks[A];return B?wc(O.status,B.status):!1})),z=e.some(O=>!Sc(O.status)),F=e.some(O=>O.status==="error"||O.trackOrder.some(A=>Fd(O.tracks[A]?.status??""))),N=z?"job-dock-dot":F?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle",I=F?"is-error":z?"is-live":"is-complete",j=[...new Set(e.map(O=>kL(O.ownerCarrierId)).filter(O=>!!O))],U=j.slice(0,4),G=Math.max(0,j.length-U.length),W=e.flatMap(O=>O.trackOrder.flatMap(A=>{const B=O.tracks[A];return B?[{job:O,track:B}]:[]})),Z=W.slice(0,6),V=Math.max(0,W.length-Z.length);return c.jsxs("div",{className:"job-dock",children:[c.jsxs("div",{className:`job-dock-strip ${I}`,children:[c.jsx("span",{className:N,"aria-hidden":"true"}),c.jsxs("span",{className:"job-dock-carrier",title:f,children:[U.length>0?c.jsx("span",{className:"job-dock-captain-stack","aria-hidden":"true",children:U.map(O=>c.jsx("span",{className:"job-dock-captain-dot","data-captain":O},O))}):null,c.jsx("span",{className:"job-dock-captain-tag",children:m}),G>0?c.jsxs("span",{className:"job-dock-captain-tag",children:["+",G]}):null]}),c.jsxs("span",{className:"job-dock-seg","aria-hidden":"true",children:[Z.map(({job:O,track:A})=>c.jsx("i",{"data-tone":_V(A,O.status)},`${O.jobId}:${A.trackId}`)),V>0?c.jsxs("span",{children:["+",V]}):null]}),c.jsxs("span",{className:"job-dock-strip-line",style:i?{display:"none"}:void 0,"aria-hidden":"true",children:[_.thinking?c.jsx("span",{className:"thinking-chip",children:"thinking…"}):_.text,!i&&D&&_.text?c.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),c.jsxs("span",{className:"job-dock-meta",children:[u?c.jsx("span",{children:u}):null,p?c.jsx("span",{children:p}):null]}),c.jsx("button",{type:"button",className:"job-dock-grip","aria-label":i?"Collapse stream dock":"Expand stream dock","aria-expanded":i,onClick:()=>r(!i),children:i?"▼":"▲"}),c.jsx("button",{ref:n,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),c.jsxs("div",{className:`job-dock-body-wrap${i?"":" is-collapsed"}`,children:[c.jsx("div",{ref:w,className:"job-dock-body",tabIndex:-1,children:e.map(O=>O.trackOrder.map(A=>{const B=O.tracks[A];return B?c.jsx(sV,{track:B,job:O},`${O.jobId}:${A}`):null}))}),x?null:c.jsx("button",{type:"button",className:"follow-button",onClick:C,children:"↓ Follow"})]})]})}function sV({track:e,job:t}){const n=wc(t.status,e.status),r=gV(e.text),o=!r&&n&&!!e.thought,u=kL(t.ownerCarrierId),h=EL(e,t.status),p=HL(e.startedAt??t.startedAt,e.finishedAt??t.finishedAt);return c.jsxs("div",{className:"job-dock-card","data-captain":u,"data-tone":h.tone,children:[c.jsxs("span",{className:"job-dock-card-who",children:[u?c.jsx("span",{className:"job-dock-captain-dot","data-captain":u,"aria-hidden":"true"}):null,c.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}),c.jsxs("span",{className:"job-dock-card-copy",children:[c.jsx("span",{className:"job-dock-card-phase",children:h.label}),r?c.jsx("span",{className:"job-dock-card-line",children:r}):null,o?c.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]}),c.jsx("span",{className:"job-dock-card-meta",children:p}),c.jsx("span",{className:"job-dock-card-bar","aria-hidden":"true",children:c.jsx("i",{})})]})}function rV(){const{renderer:e,font:t}=xN();return c.jsxs(c.Fragment,{children:[c.jsx(cV,{}),c.jsx(vV,{terminalFont:t}),c.jsx(yV,{terminalRenderer:e})]})}function aV(){const[e,t]=v.useState([]),[n,i]=v.useState(null),r=P1();return v.useEffect(()=>{const o=new AbortController;return RG(o.signal).then(u=>t(u.clis)).catch(u=>{o.signal.aborted||i(u instanceof Error?u.message:String(u))}),()=>o.abort()},[]),v.useEffect(()=>{const o=new AbortController;return $1(o.signal),()=>o.abort()},[]),c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[c.jsx("div",{className:"agent-cli-head",children:c.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),c.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),n?c.jsx("p",{className:"settings-error",children:n}):null,c.jsx("div",{className:"agent-cli-list",children:e.map(o=>c.jsx(dV,{cli:o,codexLaunchMode:r.state?.codexLaunchMode,disabled:r.savingField!==null,onCodexLaunchModeChange:u=>{z1("codexLaunchMode",u)}},o.id))}),r.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:r.error}):null,c.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."}),c.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),c.jsx(oV,{})]})}function oV(){const e=LK(),t=P1(),[n,i]=v.useState(null);v.useEffect(()=>{const m=new AbortController;return jK(m.signal),()=>m.abort()},[]),v.useEffect(()=>{const m=new AbortController;return fL(m.signal).then(_=>i(_.cliTypes.find(b=>b.id==="claude-kimi")??null)).catch(()=>{}),()=>m.abort()},[]),v.useEffect(()=>{const m=new AbortController;return $1(m.signal),()=>m.abort()},[]);const r=t.state?.kimiModel??null,o=r?.model??n?.defaultModel,u=n?.models.find(m=>m.modelId===o),h=r?.effort??u?.effort?.default,p=t.savingField!==null,f=(m,_)=>{z1("kimiModel",_?{model:m,effort:_}:{model:m})};return c.jsxs("section",{className:"global-settings-card","aria-label":"Model sign-in",children:[c.jsxs("div",{className:"model-auth-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Settings for Kimi"}),c.jsx("p",{className:"global-settings-help",children:"Register a Kimi API key to run carriers and terminal sessions through Claude Code against the Kimi endpoint. The key is validated and stored locally, and is never returned to the browser."})]}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?c.jsx("p",{className:"global-settings-help",children:"Loading sign-in state."}):null,e.state?.providers.map(m=>c.jsx(lV,{provider:m,busy:e.busyCli===m.cli},m.cli)),n&&o?c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"terminal-carriers-runtime-row",children:[c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-model-label",children:"Default model"}),c.jsx(Ni,{"aria-labelledby":"kimi-default-model-label",value:o,disabled:p||!t.state,options:n.models.map(m=>({value:m.modelId,label:m.name})),onChange:m=>{const _=n.models.find(b=>b.modelId===m);_&&f(_.modelId,_.effort?r?.effort??_.effort.default:void 0)}})]}),u?.effort?c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-effort-label",children:"Default effort"}),c.jsx(Ni,{"aria-labelledby":"kimi-default-effort-label",value:h??u.effort.default,disabled:p||!t.state,options:u.effort.levels.map(m=>({value:m,label:m})),onChange:m=>f(u.modelId,m)})]}):null]}),c.jsx("p",{className:"global-settings-help",children:"Used for Kimi sessions without an explicit carrier model. Applies to newly launched sessions."})]}):null,c.jsx("p",{className:"global-settings-foot",children:"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched."})]})}function lV({provider:e,busy:t}){const[n,i]=v.useState(""),r=async()=>{await OK(e.cli,n)&&i("")};return c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"model-auth-row-head",children:[c.jsx("span",{className:"model-auth-name",children:e.displayName}),c.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?"Signed in":"Not signed in"})]}),e.signedIn?c.jsx("div",{className:"model-auth-actions",children:c.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{DK(e.cli)},children:t?"Working…":"Sign out"})}):c.jsxs("form",{className:"model-auth-form",onSubmit:o=>{o.preventDefault(),r()},children:[c.jsx("input",{type:"password",className:"model-auth-input",placeholder:"API key",value:n,autoComplete:"off",spellCheck:!1,disabled:t,"aria-label":`${e.displayName} API key`,onChange:o=>i(o.target.value)}),c.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||n.trim().length===0,children:t?"Verifying…":"Sign in"})]})]})}function cV(){const e=P1(),t=e.state,n=e.savingField!==null;return v.useEffect(()=>{const i=new AbortController;return $1(i.signal),()=>i.abort()},[]),c.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?c.jsx(c.Fragment,{children:c.jsx(uV,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:n,onToggle:()=>{z1("enableMetaphor",!t.enableMetaphor)}})}):c.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),c.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function uV({title:e,help:t,onLabel:n,offLabel:i,value:r,disabled:o,onToggle:u}){return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:e}),c.jsx("p",{className:"global-settings-help",children:t})]}),c.jsx("button",{type:"button",className:`global-settings-toggle ${r?"is-on":""}`,disabled:o,"aria-pressed":r,onClick:u,children:c.jsx("span",{children:r?n:i})})]})}function dV({cli:e,codexLaunchMode:t,disabled:n,onCodexLaunchModeChange:i}){return c.jsxs("div",{className:"agent-cli-row",children:[c.jsx("span",{className:"agent-cli-name",children:e.displayName}),c.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?c.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[c.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:n,onClick:()=>i("acp"),children:"ACP"}),c.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:n,onClick:()=>i("app-server"),children:"App Server"})]}):null,e.available&&e.version?c.jsx("span",{className:"agent-cli-version",children:e.version}):null,c.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function hV({job:e}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"job-overlay-head",children:[c.jsx("span",{className:"job-overlay-kicker",children:e.status}),c.jsx("strong",{children:e.label??e.jobId})]}),c.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const n=e.tracks[t];return n?c.jsx(fV,{track:n,jobStatus:e.status},n.trackId):null})})]})}function fV({track:e,jobStatus:t}){const n=SV(e.status,t),i=EL(e,t),r=D1(e.status,t);return c.jsxs("article",{className:n?`track-card ${n}`:"track-card",children:[c.jsxs("header",{className:"track-card-head",children:[c.jsx("span",{className:"track-card-title",children:e.displayName}),c.jsx("span",{className:"track-card-status",children:r})]}),e.thought?c.jsxs("details",{className:"track-card-thinking",children:[c.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),c.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:c.jsx("pre",{children:e.thought})})]}):null,e.text?c.jsx(hL,{className:"track-card-output markdown-body",text:e.text,streaming:i.tone==="live"}):null,e.error?c.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?c.jsx("div",{className:"track-card-tools",role:"list","aria-label":"Tools",children:e.tools.map(o=>{const u=SK(o.input),h=`is-${TL(o.status)}`;return c.jsxs("span",{className:`track-card-tool-chip ${h}`,role:"listitem",children:[c.jsx("i",{"aria-hidden":"true"}),c.jsx("strong",{children:o.name??o.id}),u?c.jsx("span",{children:u}):null]},o.id)})}):null]})}async function pV(e){Bp(await DG(e)),xL(e)}function mV(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:ad(e.operation.payload,"cliId")??void 0,cliLabel:ad(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:ad(e.operation.payload,"tenantId")??void 0,registrationId:ad(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function ad(e,t){const n=e[t];return typeof n=="string"?n:null}function gV(e){const t=e.trim();if(!t)return"";const n=t.split(`
221
+ `);return n[n.length-1]?.trim()??""}function _V(e,t){const n=D1(e.status,t);return Fd(n)||n==="aborted"?"error":n==="done"?"done":wc(t,e.status)?"live":void 0}function vV({terminalFont:e}){const[t,n]=v.useState([]),[i,r]=v.useState(!0),[o,u]=v.useState(null),h=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??ac.id:ac.id}:{source:"system",familyName:e.customName};v.useEffect(()=>{const f=new AbortController;return r(!0),u(null),KA({signal:f.signal}).then(m=>{f.signal.aborted||n(m.fonts.filter(_=>_.monospace).map(_=>({family:_.family,monospace:_.monospace})))}).catch(m=>{f.signal.aborted||bV(m)||(n([]),u("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{f.signal.aborted||r(!1)}),()=>f.abort()},[]);const p=f=>{if(f.source==="system"){wF(f.familyName);return}const m=Cd.find(_=>_.id===f.id);m&&SF(m.id)};return c.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[c.jsx("div",{className:"global-settings-row",children:c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",c.jsx("span",{className:"new-badge",children:"New"})]}),c.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."})]})}),c.jsx("div",{"aria-describedby":"terminal-font-help",children:c.jsx(qA,{builtIns:Cd.map(f=>({id:f.id,label:f.name,family:f.family,aliases:[f.familyName],description:f.meta})),installedFonts:t,selected:h,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:ac.family,previewText:YK,size:e.size,sizeRange:VK,loading:i,error:o,onSelectionChange:p,onSizeCommit:xF})}),c.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 yV({terminalRenderer:e}){return c.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),c.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."})]}),c.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:FK.map(t=>{const n=t.id===e;return c.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>bF(t.id),children:t.label},t.id)})})]})})}function bV(e){return e instanceof DOMException&&e.name==="AbortError"}function SV(e,t){if(wc(t,e))return"track-card--live";const n=D1(e,t);return Fd(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function wV(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function xV(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.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 CV(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}function kV(){return c.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}const Gb=new Set;let xr={loading:!1,state:null,options:null,activeCarrierId:null,savingActionId:null,error:null};function EV(){return v.useSyncExternalStore(TV,xc,xc)}function xc(){return xr}function TV(e){return Gb.add(e),()=>{Gb.delete(e)}}async function Qf(e){Ja({loading:!0,error:null});try{const[t,n]=await Promise.all([yG(e),fL(e)]);FL(t,n)}catch(t){if(e?.aborted)return;Ja({loading:!1,error:UL(t)})}}function AV(e){Ja({activeCarrierId:e,error:null})}async function kf(e){const t=F1();return!t||xr.savingActionId!==null?!1:H1("carrier-patch",()=>bG(t.carrierId,e))}async function RV(e,t){const n=F1();return!n||xr.savingActionId!==null?!1:H1(`taskforce-save:${e}`,()=>SG(n.carrierId,e,t))}async function NV(e){const t=F1();return!t||xr.savingActionId!==null?!1:H1(`taskforce-remove:${e}`,()=>wG(t.carrierId,e))}function FL(e,t){const n=LV(e,xr.activeCarrierId);Ja({loading:!1,state:e,options:t,activeCarrierId:n,error:null})}async function H1(e,t){Ja({savingActionId:e,error:null});try{const n=await t();return FL(n.state,xr.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),Ja({savingActionId:null}),!0}catch(n){const i=UL(n);return Ja({error:i}),await Qf(),Ja({savingActionId:null,error:i}),!1}}function F1(){return xr.state?.carriers.find(e=>e.carrierId===xr.activeCarrierId)??null}function LV(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function Ja(e){xr={...xr,...e};for(const t of Gb)t()}function UL(e){return e instanceof Error?e.message:String(e)}const MV=50,WL=2400,jV={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)"},OV={id:"carriers",title:"Carriers",render:()=>c.jsx(DV,{})};function DV(){const e=EV(),t=e.state?.carriers.find(j=>j.carrierId===e.activeCarrierId)??null,[n,i]=v.useState(!1),[r,o]=v.useState(""),[u,h]=v.useState("idle"),[p,f]=v.useState({}),m=p.carrierId===t?.carrierId?p:{},_=m.cli??t?.cliType,b=e.options?.cliTypes.find(j=>j.id===_)??null,S=m.model??t?.model,w=b?.models.find(j=>j.modelId===S)??null,x=e.savingActionId!==null;v.useEffect(()=>{const j=new AbortController;return Qf(j.signal),()=>j.abort()},[]),v.useEffect(()=>{i(!1),o(t?.displayName??""),h("idle"),f({})},[t?.carrierId]),v.useEffect(()=>{if(u!=="saved")return;const j=window.setTimeout(()=>h("idle"),WL);return()=>window.clearTimeout(j)},[u]);async function C(j){const U=xc().activeCarrierId;h("saving");const G=await j();return xc().activeCarrierId===U&&(f({}),h(G?"saved":"idle")),G}async function D(){!t||x||(i(!1),r!==t.displayName&&await C(()=>kf({displayName:r})))}function z(){o(t?.displayName??""),i(!1)}async function F(j){const U=e.options?.cliTypes.find(W=>W.id===j),G=U?.models.find(W=>W.modelId===U.defaultModel)??U?.models[0]??null;!t||!U||!G||(f({carrierId:t.carrierId,cli:j,model:G.modelId,effort:G.effort?.default??""}),await C(()=>kf({cli:j,model:{model:G.modelId,...G.effort?.default?{effort:G.effort.default}:{}}})))}async function N(j){if(!t)return;const U=b?.models.find(G=>G.modelId===j)??null;f({carrierId:t.carrierId,model:j,effort:U?.effort?.default??""}),await C(()=>kf({model:{model:j,...U?.effort?.default?{effort:U.effort.default}:{}}}))}async function I(j){t&&(f({carrierId:t.carrierId,effort:j}),await C(()=>kf({model:{model:t.model,effort:j}})))}return c.jsxs(c.Fragment,{children:[e.error?c.jsx("p",{className:"terminal-carriers-error",role:"alert",children:e.error}):null,c.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":"Carrier list",children:[e.loading&&!e.state?c.jsx("p",{className:"terminal-carriers-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?c.jsx("p",{className:"terminal-carriers-empty",children:"No carriers registered."}):null,e.state?.carriers.map(j=>c.jsx(IV,{carrier:j,active:j.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??null,onSelect:()=>AV(j.carrierId)},j.carrierId))]}),t&&e.options&&b?c.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:KL(t.carrierId),children:[c.jsxs("div",{className:"terminal-carriers-detail-head",children:[c.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[c.jsxs("div",{className:"terminal-carriers-captain-id",children:[c.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),c.jsx("div",{className:`terminal-carriers-name-line ${n?"is-editing":""}`,children:n?c.jsxs(c.Fragment,{children:[c.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":"Display name",value:r,maxLength:MV,disabled:x,onChange:j=>o(j.target.value),onBlur:j=>{const U=j.relatedTarget;U instanceof HTMLElement&&U.closest("[data-display-name-action]")||D()},onKeyDown:j=>{j.key==="Enter"?(j.preventDefault(),D()):j.key==="Escape"&&(j.preventDefault(),z())}}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":"Save display name",disabled:x,onClick:()=>{D()},children:c.jsx($V,{})}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":"Cancel display name edit",onClick:z,children:c.jsx(zV,{})})]}):c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"terminal-carriers-captain-name",children:t.displayName}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Edit display name",disabled:x,onClick:()=>{o(t.displayName),i(!0)},children:c.jsx(PV,{})})]})}),c.jsx("div",{className:"terminal-carriers-captain-role",children:t.role})]}),c.jsxs("div",{className:"terminal-carriers-detail-actions",children:[c.jsx("div",{className:`terminal-carriers-save-status ${u==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:u==="saving"?"Saving…":u==="saved"?"Saved ✓":""}),c.jsx("div",{className:"terminal-carriers-save-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:e.loading||x,onClick:()=>{Qf()},children:"Refresh"})})]})]}),c.jsxs("div",{className:"terminal-carriers-body",children:[c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:"Identity"}),c.jsx("div",{className:"terminal-carriers-mission",children:t.roleDescription})]}),c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:"Runtime"}),c.jsxs("div",{className:"terminal-carriers-runtime",children:[c.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:c.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[c.jsx("span",{className:"terminal-carriers-label",id:"carrier-cli-label",children:"CLI"}),c.jsx(Ni,{"aria-labelledby":"carrier-cli-label",value:m.cli??t.cliType,disabled:x,options:e.options.cliTypes.map(j=>({value:j.id,label:j.displayName})),onChange:j=>{F(j)}})]})}),c.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[c.jsx(qL,{id:"carrier-model",label:"Model",models:b.models,value:m.model??t.model,disabled:x,onChange:j=>{N(j)}}),c.jsx(GL,{id:"carrier-effort",model:w,value:m.effort??t.effort??"",disabled:x,onChange:j=>{I(j)}})]})]})]}),t.taskForceCapable?c.jsx(BV,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,stateGeneration:e.state?.generation??0}):null]})]},t.carrierId):c.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[c.jsx("p",{className:"terminal-carriers-empty",children:"Select a carrier."}),c.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:e.loading,onClick:()=>{Qf()},children:"Refresh"})]})]})}function IV({carrier:e,active:t,minBackends:n,onSelect:i}){const r=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return c.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:KL(e.carrierId),onClick:i,children:[c.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),c.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),r?c.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function qL({id:e,label:t,models:n,value:i,disabled:r=!1,onChange:o}){const u=`${e}-label`;return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:u,children:t}),c.jsx(Ni,{"aria-labelledby":u,value:i,disabled:r,options:n.map(h=>({value:h.modelId,label:h.name})),onChange:o})]})}function GL({id:e,model:t,value:n,disabled:i=!1,onChange:r}){if(!t?.effort)return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",children:"Effort"}),c.jsx("p",{className:"terminal-carriers-help",children:"Not supported for this model."})]});const o=`${e}-label`;return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:o,children:"Effort"}),c.jsx(Ni,{"aria-labelledby":o,value:n||t.effort.default,disabled:i,options:t.effort.levels.map(u=>({value:u,label:u})),onChange:r})]})}function BV({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,stateGeneration:r}){const o=e.taskforce.backends.length,[u,h]=v.useState(o>0),[p,f]=v.useState(!1),[m,_]=v.useState(""),[b,S]=v.useState(null),[w,x]=v.useState({}),[C,D]=v.useState({}),z=e.taskforce.backends.length>=n,F=t.filter(Z=>!e.taskforce.backends.some(V=>V.cliType===Z.id)),N=m||F[0]?.id||"",I=i!==null;v.useEffect(()=>{S(null)},[r]),v.useEffect(()=>{if(!b)return;const Z=V=>{const O=V.target;(!(O instanceof Element)||!O.closest(`[data-remove-cli="${b}"]`))&&S(null)};return document.addEventListener("click",Z,!0),()=>document.removeEventListener("click",Z,!0)},[b]),v.useEffect(()=>{const Z=Object.entries(w).filter(([,O])=>O==="saved").map(([O])=>O);if(Z.length===0)return;const V=window.setTimeout(()=>{x(O=>{const A={...O};for(const B of Z)A[B]="idle";return A})},WL);return()=>window.clearTimeout(V)},[w]);async function j(Z,V,O,A={}){const B=e.carrierId;D(k=>({...k,...A})),x(k=>({...k,[Z]:"saving"}));const M=await RV(Z,{model:V,...O?{effort:O}:{}});return xc().activeCarrierId===B&&(D({}),x(k=>({...k,[Z]:M?"saved":"idle"})),M&&S(null)),M}async function U(Z,V){if(!e.taskforce.backends.find(M=>M.cliType===Z.id))return;const B=(Z.models.find(M=>M.modelId===V)??null)?.effort?.default??"";await j(Z.id,V,B,{[`tf:${Z.id}:model`]:V,[`tf:${Z.id}:effort`]:B})}async function G(Z,V,O){await j(Z,V,O,{[`tf:${Z}:effort`]:O})}async function W(Z){if(b!==Z){S(Z);return}const V=e.carrierId;x(A=>({...A,[Z]:"saving"}));const O=await NV(Z);xc().activeCarrierId===V&&(D({}),x(A=>({...A,[Z]:O?"saved":"idle"})),O&&S(null))}return c.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${u?"is-expanded":""}`,children:[c.jsxs("div",{className:"terminal-carriers-section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"terminal-carriers-resp-title",children:"Task Force"}),c.jsx("p",{className:"terminal-carriers-help",children:o>0?`${o} backend${o===1?"":"s"} configured${z?" · active":` · needs ${n}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${n} to activate.`})]}),c.jsx("div",{className:"terminal-carriers-tf-head-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":u,onClick:()=>h(Z=>!Z),children:u?"Hide":"Configure"})})]}),u?c.jsxs("div",{className:"terminal-carriers-tf-list",children:[e.taskforce.backends.length===0?c.jsx("p",{className:"terminal-carriers-tf-empty",children:"No Task Force backend configured."}):null,e.taskforce.backends.map(Z=>{const V=t.find(R=>R.id===Z.cliType);if(!V)return null;const O=C[`tf:${V.id}:model`]??Z.model,A=C[`tf:${V.id}:effort`]??Z.effort??"",B=V.models.find(R=>R.modelId===O)??V.models[0]??null,M=w[V.id]??"idle",k=b===V.id,T=e.taskforce.backends.length-1<n?"Confirm — TF deactivates":"Confirm remove";return c.jsxs("div",{className:"terminal-carriers-tf-item is-active",children:[c.jsxs("div",{className:"terminal-carriers-tf-title",children:[c.jsx("span",{className:`terminal-carriers-live-dot ${z?"is-live":""}`,"aria-hidden":"true"}),c.jsx("strong",{children:V.displayName}),c.jsx("span",{className:`terminal-carriers-tf-status ${M==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:M==="saving"?"Saving…":M==="saved"?"Saved ✓":""})]}),c.jsx(qL,{id:`tf-${V.id}-model`,label:"Model",models:V.models,value:O,disabled:I,onChange:R=>{U(V,R)}}),c.jsx(GL,{id:`tf-${V.id}-effort`,model:B,value:A,disabled:I,onChange:R=>{G(V.id,O,R)}}),c.jsx("div",{className:"terminal-carriers-tf-actions",children:c.jsx("button",{type:"button",className:`terminal-carriers-ghost-button terminal-carriers-tf-remove ${k?"is-armed":""}`,"data-remove-cli":V.id,"aria-label":k?`Confirm removal of ${V.displayName} backend`:void 0,disabled:I,onClick:()=>{W(V.id)},children:k?T:"Remove"})})]},V.id)}),c.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[p&&F.length>0?c.jsx(Ni,{className:"terminal-carriers-tf-add-select",label:"Task Force CLI to add",value:N,disabled:I,options:F.map(Z=>({value:Z.id,label:Z.displayName})),onChange:Z=>_(Z)}):null,c.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:F.length===0||I,onClick:()=>{if(!p){f(!0);return}const Z=N,V=t.find(A=>A.id===Z),O=V?.models.find(A=>A.modelId===V.defaultModel)??V?.models[0]??null;!V||!O||j(V.id,O.modelId,O.effort?.default??"").then(A=>{A&&(_(""),f(!1))})},children:"Add"})]})]}):null]})}function KL(e){return{"--cap-color":jV[e]??"var(--brass)"}}function PV(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.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"}),c.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function $V(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:c.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function zV(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),c.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const HV="global-shell:theater:",FV="/plugins/terminal/global/ticket",UV="/plugins/terminal/ws",WV=168,qV={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},GV={id:"global-shell",title:"Shell",icon:KV,preferredExtraWidth:WV,render:e=>c.jsx("div",{style:qV,children:c.jsx(_1,{operationId:`${HV}${encodeURIComponent(e.theaterId??"")}`,ticketPath:FV,wsPath:UV,theme:"instrument",active:!0})})};function KV(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const VV="/plugins/terminal/shell/ticket",YV="/plugins/terminal/ws",VL={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>v.createElement(XV,{context:e})},Rv={id:"terminal",operationKinds:[VL],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:()=>c.jsx(ZV,{})};function XV({context:e}){return c.jsx(_1,{operationId:e.operationId,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,ticketPath:VV,wsPath:YV,theme:e.theme,onExit:e.onClose})}function ZV(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),c.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 JV=new Set(["agent"]),QV={id:"terminal",operationKinds:[VL,IL],settingsSections:[BL,PL,OV],notificationKinds:[$L],railPanels:[GV],install:e=>(kN(),yF(e.settings),Cf.install?.(e)),closeOperation:async e=>{const t=await tY(e);if(t?.type==="shell"){await Rv.closeOperation?.(e);return}t&&JV.has(t.type)&&await Cf.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?Rv.launch?.(e)??{id:""}:Cf.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?Rv.renderLaunchIcon?.(e):Cf.renderLaunchIcon?.(e)},eY=[QV];async function tY(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const n=await t.json();return typeof n.operation?.type=="string"?{type:n.operation.type}:null}const 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"},nY={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},K2={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}},iY={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}},sY={shape:"default",tone:se.default},Kb={angle:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.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"}),c.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),c.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.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"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:c.jsxs(c.Fragment,{children:[c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),c.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"}),c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),c.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"}),c.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.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:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:c.jsxs(c.Fragment,{children:[c.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"}),c.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:c.jsxs(c.Fragment,{children:[c.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"}),c.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"}),c.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"}),c.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 rY({name:e}){const t=oY(e);return c.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:Kb[t.shape]})}function aY({name:e,open:t}){const n=nY[e.toLowerCase()]??se.folder;return c.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?Kb.folderOpen:Kb.folderClosed})}function oY(e){const t=e.toLowerCase(),n=iY[t];if(n)return n;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 K2["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=K2[r];if(o)return o}return sY}const lY=200,Ef=30,V2=5,YL="fleet-console.fileExplorer.showHidden",Y2=500;function Ys(e,t){return e===t}async function cY({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:r,onFolderResult:o}){const u=[],h=new Map(t),p=new Set,f=new Set;let m=0;const _=b=>{for(const S of b)if(!(!dY(S,i)||p.has(S.relativePath))){if(p.size>=Y2)return;p.add(S.relativePath),u.push(S)}};for(_(e);u.length>0&&r();){const b=u.shift();if(!b)return;const S=h.get(b.relativePath);if(S){if(f.has(S.relativePath))continue;f.add(S.relativePath),_(S.entries);continue}if(m>=Y2)return;m+=1;try{const w=await n.listFolder(b.relativePath);if(!r())return;if(h.set(b.relativePath,w),o(b.relativePath,w),f.has(w.relativePath))continue;f.add(w.relativePath),_(w.entries)}catch{}}}function XL(e,t,n,i,r,o,u,h,p=new Set){const f=[];for(const m of e){if(!h&&m.name.startsWith("."))continue;const _=o.get(m.relativePath),b=_?.entries,S=_?.relativePath??m.relativePath,w=m.kind==="dir"&&p.has(S),x=m.kind==="dir"&&!w&&ZL(b??[],o,u,h);if(u&&!m.name.toLowerCase().includes(u)&&!x)continue;const C=i.has(m.relativePath)||!!(u&&x);if(f.push({entry:m,depth:t,isSelected:n===m.relativePath,isExpanded:C,isLoading:r.has(m.relativePath)}),m.kind==="dir"&&C&&!w&&b){const D=new Set(p);D.add(S),f.push(...XL(b,t+1,n,i,r,o,u,h,D))}}return f}function uY({contextKey:e,files:t,theaterId:n,selectedPath:i,onSelect:r}){const[o,u]=v.useState(null),[h,p]=v.useState(null),[f,m]=v.useState(""),[_,b]=v.useState(new Set),[S,w]=v.useState(new Set),[x,C]=v.useState(new Map),[D,z]=v.useState(""),[F,N]=v.useState(0),[I,j]=v.useState(600),[U,G]=v.useState(()=>hY()),W=v.useRef(null),Z=v.useRef(_);Z.current=_;const V=v.useRef(f);V.current=f;const O=v.useRef(t);O.current=t;const A=v.useRef(e);A.current=e;const B=v.useRef(x);B.current=x;const M=v.useRef(0),k=!!D;v.useEffect(()=>{n&&(u(null),p(null),m(""),b(new Set),C(new Map),z(""),N(0))},[e,n]),v.useEffect(()=>{if(!n)return;const Ie=e;t.listFolder(f||void 0).then(Ce=>{Ys(Ie,A.current)&&(u(Ce),p(null))}).catch(Ce=>{Ys(Ie,A.current)&&p(Ce instanceof Error?Ce.message:"Unable to load folder")})},[e,n,f,t]),v.useEffect(()=>{const Ie=++M.current;if(!k||!o)return;let Ce=!0;const Me=e,je=()=>Ce&&Ie===M.current&&Ys(Me,A.current);return cY({entries:o.entries,cachedResults:B.current,files:t,showHidden:U,isCurrent:je,onFolderResult:(ze,bt)=>{je()&&C(pt=>new Map(pt).set(ze,bt))}}),()=>{Ce=!1}},[e,t,k,o,U]),v.useEffect(()=>{const Ie=W.current;if(!Ie)return;const Ce=new ResizeObserver(()=>j(Ie.clientHeight));return Ce.observe(Ie),j(Ie.clientHeight),()=>Ce.disconnect()},[]),v.useEffect(()=>{if(!n)return;let Ie=!0;const Ce=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,Me=new EventSource(Ce),je=()=>{const bt=e;O.current.listFolder(V.current||void 0).then(pt=>{Ys(bt,A.current)&&(u(pt),p(null))}).catch(()=>{})},ze=()=>{je();for(const bt of Z.current){const pt=e;O.current.listFolder(bt).then(vt=>{Ys(pt,A.current)&&C(lt=>new Map(lt).set(bt,vt))}).catch(()=>{})}};return Me.addEventListener("change",bt=>{let pt;try{pt=JSON.parse(bt.data)}catch{return}if(typeof pt=="string"&&((pt===""||pt===V.current)&&je(),pt!==""&&Z.current.has(pt))){const vt=e;O.current.listFolder(pt).then(lt=>{Ys(vt,A.current)&&C(de=>new Map(de).set(pt,lt))}).catch(()=>{})}}),Me.onopen=()=>{if(Ie){Ie=!1;return}ze()},()=>{Me.close()}},[e,n,t]);const T=v.useCallback(Ie=>{const Ce=Ie.relativePath,Me=!_.has(Ce);if(b(je=>{const ze=new Set(je);return ze.has(Ce)?(ze.delete(Ce),ze):(ze.add(Ce),ze)}),Me){const je=e;w(ze=>new Set(ze).add(Ce)),t.listFolder(Ce).then(ze=>{Ys(je,A.current)&&(C(bt=>new Map(bt).set(Ce,ze)),w(bt=>{const pt=new Set(bt);return pt.delete(Ce),pt}))}).catch(()=>{Ys(je,A.current)&&w(ze=>{const bt=new Set(ze);return bt.delete(Ce),bt})})}},[e,t,_]),R=v.useCallback(Ie=>{Ie.kind==="dir"?T(Ie):r(Ie)},[T,r]),$=v.useCallback(Ie=>{N(Ie.currentTarget.scrollTop)},[]),K=v.useCallback(()=>{G(Ie=>{const Ce=!Ie;try{localStorage.setItem(YL,Ce?"1":"0")}catch{}return Ce})},[]),L=v.useCallback(()=>{if(!n)return;const Ie=e;t.listFolder(f||void 0).then(Ce=>{Ys(Ie,A.current)&&(u(Ce),p(null))}).catch(Ce=>{Ys(Ie,A.current)&&p(Ce instanceof Error?Ce.message:"Unable to load folder")});for(const Ce of _)t.listFolder(Ce).then(Me=>{Ys(Ie,A.current)&&C(je=>new Map(je).set(Ce,Me))}).catch(()=>{})},[e,t,f,_,n]),q=D.toLowerCase(),H=v.useMemo(()=>o?XL(o.entries,0,i,_,S,x,q,U):[],[o,i,_,S,x,q,U]),ne=!U&&o!==null&&o.entries.length>0&&H.length===0&&!D,oe=H.length>lY,Se=oe?Math.max(0,Math.floor(F/Ef)-V2):0,xe=oe?Math.min(H.length,Math.ceil((F+I)/Ef)+V2):H.length,fe=H.slice(Se,xe),De=H.length*Ef,rt=Se*Ef;return n?h&&!o?c.jsx("div",{className:"fexp-tree-error",children:h}):o?c.jsxs("div",{className:"fexp-tree-container",children:[c.jsxs("div",{className:"fexp-filter",children:[c.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:D,onChange:Ie=>z(Ie.target.value),"aria-label":"Filter files"}),D&&c.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>z(""),"aria-label":"Clear filter",children:"✕"}),c.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:L,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),c.jsx("button",{type:"button",className:`fexp-hidden-toggle${U?" is-active":""}`,onClick:K,"aria-pressed":U,"aria-label":U?"Hide hidden files":"Show hidden files",title:U?"Hide hidden files":"Show hidden files",children:U?c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),c.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),c.jsxs("div",{ref:W,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:oe?$:void 0,children:[!1,oe?c.jsx("div",{style:{height:De,position:"relative"},children:c.jsx("div",{style:{transform:`translateY(${rt}px)`},children:fe.map(Ie=>c.jsx(X2,{row:Ie,onEntryClick:R},Ie.entry.relativePath))})}):fe.map(Ie=>c.jsx(X2,{row:Ie,onEntryClick:R},Ie.entry.relativePath)),H.length===0&&D&&c.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),H.length===0&&!D&&o.entries.length===0&&c.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),ne&&c.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):c.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):c.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function ZL(e,t,n,i,r=new Set){for(const o of e)if(!(!i&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(n))return!0;if(o.kind==="dir"){const u=t.get(o.relativePath);if(u&&!r.has(u.relativePath)){const h=new Set(r);if(h.add(u.relativePath),ZL(u.entries,t,n,i,h))return!0}}}return!1}function dY(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function X2({row:e,onEntryClick:t}){const{entry:n,depth:i,isSelected:r,isExpanded:o,isLoading:u}=e,h=n.kind==="dir",p=i*16,f=v.useCallback(()=>t(n),[n,t]);return c.jsxs("button",{className:`fexp-tree-row${r?" is-cur":""}${h?" is-dir":" is-file"}`,style:{paddingLeft:`${p+12}px`},type:"button",role:"treeitem","aria-selected":r,"aria-expanded":h?o:void 0,onClick:f,children:[c.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:h?c.jsx(aY,{name:n.name,open:o}):c.jsx(rY,{name:n.name})}),c.jsx("span",{className:"fexp-tree-name",children:n.name}),u&&c.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function hY(){try{return localStorage.getItem(YL)==="1"}catch{return!1}}function fY({name:e,sizeHint:t}){return c.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[c.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),c.jsx("p",{className:"fexp-bin-name",children:e}),t&&c.jsx("p",{className:"fexp-bin-meta",children:t}),c.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function pY(e,t){switch(t){case"typescript":case"javascript":return gY(e);case"json":return _Y(e);case"python":return yY(e);case"css":case"scss":case"sass":case"less":return bY(e);case"html":case"xml":return SY(e);case"bash":case"shell":return wY(e);case"yaml":return xY(e);default:return[{kind:"text",value:e}]}}const mY=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 gY(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
222
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=ro(e,n,"`","`");t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=ro(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])||e[n]==="."&&/[0-9]/.test(e[n+1]??"")){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_$]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_$][\w$]*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);mY.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}function _Y(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:r}=ro(e,n,'"','"'),u=e.slice(n+r).trimStart().startsWith(":");t.push({kind:u?"attr":"str",value:i}),n+=r;continue}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(e.startsWith("true",n)||e.startsWith("false",n)||e.startsWith("null",n)){const i=e.slice(n).match(/^(true|false|null)/);if(i){t.push({kind:"key",value:i[0]}),n+=i[0].length;continue}}if(/[{}[\]:,]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}const vY=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 yY(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
223
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=ro(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_]\w*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);vY.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function bY(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
224
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=ro(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==="."||e[n]==="#"||e[n]===":"){const i=e.slice(n).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(i){t.push({kind:"tag",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z-]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z-][\w-]*/);if(i){const r=i[0];e.slice(n+r.length).trimStart().startsWith(":")?t.push({kind:"attr",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function SY(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("<!--",n)){const i=e.indexOf("-->",n+4),r=i===-1?e.slice(n):e.slice(n,i+3);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="<"){t.push({kind:"punct",value:"<"}),n++,e[n]==="/"&&(t.push({kind:"punct",value:"/"}),n++);const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);i&&(t.push({kind:"tag",value:i[0]}),n+=i[0].length);continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=ro(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);if(i){const r=e.slice(n+i[0].length).trimStart();t.push({kind:r.startsWith("=")?"attr":"text",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function wY(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
225
+ `,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=ro(e,n,e[n],e[n]);t.push({kind:"str",value:r}),n+=o;continue}if(/[a-zA-Z_]/.test(e[n])){const r=e.slice(n).match(/^[a-zA-Z_][\w]*/);if(r){t.push({kind:i.has(r[0])?"key":"text",value:r[0]}),n+=r[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function xY(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
226
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=ro(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_][\w-]*/);if(i){e.slice(n+i[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:i[0]}):["true","false","null","yes","no","on","off"].includes(i[0])?t.push({kind:"key",value:i[0]}):t.push({kind:"text",value:i[0]}),n+=i[0].length;continue}}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function ro(e,t,n,i){let r=t+n.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(i,r)){r+=i.length;break}if(i!=="`"&&e[r]===`
227
+ `)break;r++}return{slice:e.slice(t,r),length:r-t}}function CY({content:e,lang:t,truncated:n}){const i=v.useMemo(()=>kY(e,t),[e,t]);return c.jsxs("div",{className:"fexp-code-wrap",children:[n&&c.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),c.jsx("div",{className:"fexp-code-scroll",children:c.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:c.jsx("tbody",{children:i.map((r,o)=>c.jsxs("tr",{className:"fexp-code-row",children:[c.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:o+1}),c.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:r}})]},o))})})})]})}function kY(e,t){return e.split(`
228
+ `).map(i=>EY(i,t))}function EY(e,t){return t==="plaintext"||t==="markdown"?Z2(e)||" ":pY(e,t).map(i=>{const r=Z2(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function Z2(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function TY({src:e,name:t}){return c.jsxs("div",{className:"fexp-img-wrap",children:[c.jsx("div",{className:"fexp-img-stage",children:c.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),c.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}const AY=new Set([".png",".jpg",".jpeg",".webp",".gif"]),RY=new Set(["img.shields.io"]),NY=/^[a-z][a-z0-9+.-]*:/i;function J2(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||NY.test(n))return null;const i=JL(n);if(!i)return null;const r=jY(i);return r===null?null:OY(r,t)}function LY(e){const t=JL(e).toLowerCase();return[...AY].some(n=>t.endsWith(n))}function Q2(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function MY(e){try{const t=new URL(e);return t.protocol==="https:"&&RY.has(t.hostname)}catch{return!1}}function JL(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function jY(e){try{return decodeURI(e)}catch{return null}}function OY(e,t){const n=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/"),r=i.includes("/")?i.slice(0,i.lastIndexOf("/")):"",o=n.startsWith("/")?n:`${r}/${n}`,u=[];for(const h of o.split("/"))if(!(!h||h===".")){if(h===".."){if(u.length===0)return null;u.pop();continue}u.push(h)}return u.length>0?u.join("/"):null}function DY({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:r}){const o=v.useMemo(()=>{const _=Hs(e).html,b=new DOMParser().parseFromString(_,"text/html");return Nv(b.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i}),b.body.innerHTML},[e,n,i]),u=v.useRef(null);v.useEffect(()=>{const _=u.current;if(!_)return;vm(_),Nv(_,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i});const b=new MutationObserver(()=>Nv(_,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i}));return b.observe(_,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>b.disconnect()},[o,n,i]);const h=v.useCallback(_=>{const b=_.target.closest('[data-action="copy-code"]');if(!b)return;const S=b.closest("pre")?.getAttribute("data-code");if(!S)return;navigator.clipboard?.writeText(S);const w=b.textContent;b.textContent="Copied",window.setTimeout(()=>{b.textContent=w},1200)},[]),p=v.useCallback(_=>{const S=_.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(_.preventDefault(),t(w))},[t]),f=v.useCallback(_=>{if(_.key!=="Enter"&&_.key!==" ")return;const S=_.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(_.preventDefault(),t(w))},[t]),m=v.useCallback(_=>{h(_),p(_)},[h,p]);return c.jsxs("div",{className:"fexp-md-wrap",children:[r&&c.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),c.jsx("div",{ref:u,className:"markdown-body",onClick:m,onKeyDown:f,dangerouslySetInnerHTML:{__html:o}})]})}function Nv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=J2(i,t.currentRelativePath);r?(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("tabindex","0"),n.setAttribute("data-fexp-open-path",r),n.removeAttribute("aria-disabled")):i&&!/^(https?:|mailto:|#)/i.test(i)&&(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}for(const n of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const i=n.getAttribute("src")??"",r=n.getAttribute("data-fexp-local-image-path");if(n.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&r&&i===Q2(t.theaterId,r)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&MY(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=J2(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&LY(o)){n.setAttribute("src",Q2(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&IY(n)}}function IY(e){const t=e.getAttribute("alt")?.trim(),n=e.ownerDocument.createElement("span");n.className="fexp-md-blocked-image",n.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(n)}const BY=360,U1=248,W1=200,zp=160,Hp=4;function PY(e){return e-W1-Hp>=zp}function $Y(e,t,n){const i=n-W1-Hp;return i<zp?e:Math.max(zp,Math.min(i,e-t))}function zY(e){const t=W1+Hp;return`minmax(0, 1fr) ${Hp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function HY(e){return e?BY:null}const QL="fleet-console.file-explorer.treePaneWidth",q1={selectedPath:null,viewState:{kind:"none"}},FY={...q1,treePaneWidth:U1},eM=new Map,e5=new Map,Vb=new Set;let Fp=KY();function UY(e){return v.useSyncExternalStore(GY,()=>qY(e),()=>FY)}function t5(e,t){e&&iM(e,{selectedPath:t})}function Fa(e,t){e&&iM(e,{viewState:t})}function WY(e){Fp=sM(e);try{localStorage.setItem(QL,String(Fp))}catch{}tM()}function tM(){for(const e of Vb)e()}function nM(e){return eM.get(e)??q1}function qY(e){const t=e??"__none__",n=e!=null?nM(e):q1,i=e5.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===Fp)return i;const r={...n,treePaneWidth:Fp};return e5.set(t,r),r}function iM(e,t){eM.set(e,{...nM(e),...t}),tM()}function GY(e){return Vb.add(e),()=>{Vb.delete(e)}}function KY(){try{return sM(Number(localStorage.getItem(QL)))}catch{return U1}}function sM(e){return!Number.isFinite(e)||e<=0?U1:Math.max(zp,Math.round(e))}const VY=new Set([".png",".jpg",".jpeg",".webp",".gif"]),YY={id:"file-explorer",title:"Files",icon:JY,render:e=>c.jsx(ZY,{...e})};function XY(e){return{listFolder:async t=>{if(!e)throw new Error("no_theater");const n=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:t??""})});if(!n.ok){const i=await n.json();throw new Error(i.error??"list_failed")}return n.json()}}}function ZY(e){const{theaterId:t}=e,n=t??"",{selectedPath:i,viewState:r,treePaneWidth:o}=UY(n),u=v.useRef(o);u.current=o;const h=v.useRef(null),[p,f]=v.useState(!1),m=v.useMemo(()=>XY(t),[t]),_=v.useCallback(async(C,D)=>{if(!t){Fa(t,{kind:"error",message:"no_theater"});return}t5(n,C);const z=D??C.split("/").filter(Boolean).at(-1)??C,F=z.slice(z.lastIndexOf(".")).toLowerCase();if(VY.has(F)){const N=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(C)}`:"";Fa(n,{kind:"image",relativePath:C,name:z,src:N});return}Fa(n,{kind:"loading"});try{const N=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:C})});if(!N.ok){const j=await N.json();throw new Error(j.error??"read_failed")}const I=await N.json();if(I.binary){Fa(n,{kind:"binary",name:z});return}Fa(n,{kind:"code",relativePath:I.relativePath,content:I.content,lang:I.lang,truncated:I.truncated})}catch(N){const I=N instanceof Error?N.message:"Unable to load file";I==="binary_file"?Fa(n,{kind:"binary",name:z}):Fa(n,{kind:"error",message:I})}},[n,t]),b=v.useCallback(async C=>{C.kind==="file"&&await _(C.relativePath,C.name)},[_]),S=v.useCallback(()=>{Fa(n,{kind:"none"}),t5(n,null)},[n]),w=v.useCallback(C=>{C.preventDefault();const D=h.current;if(!D)return;const z=D.getBoundingClientRect().width;if(!PY(z))return;const F=C.clientX,N=u.current;f(!0);const I=U=>{const G=U.clientX-F,W=$Y(N,G,z);u.current=W,WY(W)},j=()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",j),f(!1)};document.addEventListener("pointermove",I),document.addEventListener("pointerup",j)},[]),x=r.kind!=="none";return v.useLayoutEffect(()=>{e.requestExtraWidth?.(HY(x))},[e,x]),c.jsxs("div",{ref:h,className:`fexp-root${x?" is-split":" is-tree-only"}${p?" is-dragging":""}`,style:x?{gridTemplateColumns:zY(o)}:void 0,children:[x&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fexp-viewer-pane",children:[c.jsxs("div",{className:"fexp-viewer-head",children:[c.jsx("span",{className:"fexp-viewer-filename",children:r.kind!=="loading"&&r.kind!=="error"?"relativePath"in r?r.relativePath:r.name:""}),c.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:S,"aria-label":"Close viewer",children:"✕"})]}),c.jsxs("div",{className:"fexp-viewer-body",children:[r.kind==="loading"&&c.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),r.kind==="error"&&c.jsx("div",{className:"fexp-viewer-error",children:r.message}),r.kind==="code"&&r.lang==="markdown"&&c.jsx(DY,{content:r.content,onOpenPath:_,relativePath:r.relativePath,theaterId:t,truncated:r.truncated}),r.kind==="code"&&r.lang!=="markdown"&&c.jsx(CY,{content:r.content,lang:r.lang,truncated:r.truncated}),r.kind==="image"&&c.jsx(TY,{src:r.src,name:r.name}),r.kind==="binary"&&c.jsx(fY,{name:r.name})]})]}),c.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),c.jsx("div",{className:"fexp-tree-pane",children:c.jsx(uY,{files:m,theaterId:t,contextKey:n,selectedPath:i,onSelect:b},n)})]})}function JY(){return c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:c.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 QY={id:"file-explorer",railPanels:[YY]},eX=[QY],tX={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function nX(e){const t={dirs:{},files:[]};for(const n of e){const i=n.path.split("/");i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]={dirs:{},files:[]}),r=r.dirs[o];r.files.push(n)}return t}function rM({files:e,selectedPath:t,onSelect:n}){const i=nX(e);return c.jsx(aM,{node:i,depth:0,selectedPath:t,onSelect:n})}function aM({node:e,depth:t,selectedPath:n,onSelect:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>c.jsx(iX,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>c.jsx(sX,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function iX({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,u]=v.useState(!1),h=v.useCallback(()=>u(_=>!_),[]);let p=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const _=Object.keys(f.dirs)[0];p+="/"+_,f=f.dirs[_]}const m=n*16+12;return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`},onClick:h,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.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"})}),c.jsx("span",{className:"repository-folder-name",children:p})]}),!o&&c.jsx(aM,{node:f,depth:n+1,selectedPath:i,onSelect:r})]})}function sX({entry:e,depth:t,selectedPath:n,onSelect:i}){const r=e.path===n,o=v.useCallback(()=>i(e),[e,i]),u=t*16+12,h=e.path.split("/").pop()??e.path;return c.jsxs("button",{type:"button",className:`repository-file-row${r?" is-cur":""}`,style:{paddingLeft:`${u}px`},title:e.path,onClick:o,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:tX[e.status]??e.status}),c.jsx("span",{className:"repository-file-name",children:c.jsx("span",{className:"repository-file-fn",children:h})}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const n5="fleet-console.diff.changesCollapsed",rX={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function aX(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function oX(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function oM({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:r,filterText:o}){const[u,h]=v.useState(()=>oX(n5)),p=v.useCallback(()=>{h(_=>{const b=!_;try{localStorage.setItem(n5,b?"1":"0")}catch{}return b})},[]),f=v.useMemo(()=>e.kind==="ok"?aX(e.files,o):[],[o,e]);if(e.kind==="loading")return c.jsx("div",{className:"repository-sections-loading",children:"Loading…"});if(e.kind==="notice"){const _=e.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=e.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return c.jsxs("div",{className:"repository-sections-notice",children:[c.jsx("strong",{className:"repository-notice-title",children:_}),c.jsx("span",{className:"repository-notice-body",children:b}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]})}if(e.kind==="error")return c.jsxs("div",{className:"repository-sections-error",children:[c.jsx("span",{children:e.message}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]});const m=o?`${f.length}/${e.files.length}`:String(e.files.length);return c.jsx("div",{className:"repository-sections",children:c.jsxs("div",{className:`repository-section${u?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-section-head",onClick:p,children:[c.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-section-name",children:"Changes"}),c.jsx("span",{className:"repository-count-badge",children:m})]}),!u&&c.jsx("div",{className:"repository-section-rows",children:f.length===0?c.jsx("div",{className:"repository-empty-row",children:o?"No matching items":"No changes"}):n==="tree"?c.jsx(rM,{files:f,selectedPath:i,onSelect:r}):f.map(_=>c.jsx(lM,{entry:_,isSelected:_.path===i,onSelect:r},_.path))})]})})}function lM({entry:e,isSelected:t,onSelect:n}){const i=v.useCallback(()=>n(e),[e,n]),r=e.path.endsWith("/")?e.path.slice(0,-1):e.path,o=r.lastIndexOf("/"),u=o>=0?r.slice(0,o+1):"",h=(o>=0?r.slice(o+1):r)+(e.path.endsWith("/")?"/":"");return c.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:i,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":rX[e.status]??e.status,children:e.status}),c.jsxs("span",{className:"repository-file-name",children:[c.jsx("span",{className:"repository-file-fn",children:h}),u&&c.jsx("span",{className:"repository-file-dir",children:u})]}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const lX=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 cX(e){let t="",n=0;const i=(r,o)=>`<span class="repository-token-${r}">${o}</span>`;for(;n<e.length;){const r=e[n];if(r==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(r==="/"&&e[n+1]==="/"||r==="#"){t+=i("comment",e.slice(n));break}if(r==='"'||r==="'"||r==="`"){const o=r,u=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(u,n));continue}if(/[0-9]/.test(r)&&!/[A-Za-z0-9_$]/.test(e[n-1]??"")){const o=n;for(;n<e.length&&/[0-9.xXa-fA-F]/.test(e[n]);)n++;t+=i("number",e.slice(o,n));continue}if(/[A-Za-z_$]/.test(r)){const o=n;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;const u=e.slice(o,n);t+=lX.has(u)?i("keyword",u):/^[A-Z]/.test(u)?i("type",u):u;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=i("punctuation",r),n++;continue}t+=r,n++}return t}const uX=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,dX=/^diff --git a\/(.+) b\/(.+)$/;function hX(e){if(!e)return[];const t=e.split(`
229
+ `);t[t.length-1]===""&&t.pop();const n=[];let i=0,r=0,o=!0;for(const u of t)if(!u.startsWith("\\")){if(u.startsWith("diff --git ")){const h=dX.exec(u),p=h?.[1],f=h?.[2]??u,m=p!==void 0&&p!==f?p:void 0;n.push({kind:"file-label",text:f,oldPath:m}),o=!0;continue}if(o){if(u.startsWith("new file mode")||u.startsWith("deleted file mode")||u.startsWith("old mode")||u.startsWith("new mode")||u.startsWith("rename from ")||u.startsWith("rename to ")||u.startsWith("similarity index")||u.startsWith("dissimilarity index")){n.push({kind:"meta",text:u});continue}if(u.startsWith("index ")||u.startsWith("--- ")||u.startsWith("+++ "))continue;if(!u.startsWith("@@")){u!==""&&n.push({kind:"ctx",text:` ${u}`});continue}}if(u.startsWith("@@")){o=!1;const h=uX.exec(u);if(h){i=parseInt(h[1]??"0",10),r=parseInt(h[2]??"0",10);const p=h[3]?.trimEnd()??"",f=`@@ -${h[1]??""} +${h[2]??""} @@${p?` ${p.trimStart()}`:""}`;n.push({kind:"hunk-label",text:f})}else n.push({kind:"hunk-label",text:u});continue}u.startsWith("+")?n.push({kind:"add",text:u,newLine:r++}):u.startsWith("-")?n.push({kind:"del",text:u,oldLine:i++}):n.push({kind:"ctx",text:u,oldLine:i++,newLine:r++})}return n}function Tf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Up({ctx:e,repoRel:t,file:n,mode:i,commit:r,compare:o}){const[u,h]=v.useState({kind:"loading"});if(v.useEffect(()=>{if(!e.theaterId){h({kind:"error",message:"no_theater"});return}let _=!1;return h({kind:"loading"}),o?e.api.fetch("repository","compare-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:o.theaterId,repoRel:o.repoRel,base:o.base,head:o.head,filePath:n.path,...n.oldPath?{oldPath:n.oldPath}:{}})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||h({kind:"ok",result:S})}).catch(b=>{_||h({kind:"error",message:b instanceof Error?b.message:"unknown"})}):r?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:r.theaterId,repoRel:r.repoRel,ref:r.fullHash,filePath:n.path,...n.oldPath??r.oldPath?{oldPath:n.oldPath??r.oldPath}:{}})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||h({kind:"ok",result:S})}).catch(b=>{_||h({kind:"error",message:b instanceof Error?b.message:"unknown"})}):e.api.fetch("repository","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,filePath:n.path,mode:i})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||h({kind:"ok",result:S})}).catch(b=>{_||h({kind:"error",message:b instanceof Error?b.message:"unknown"})}),()=>{_=!0}},[e.api,e.theaterId,n.oldPath,n.path,i,r,o,t]),u.kind==="loading")return c.jsx("div",{className:"repository-hunk-loading",children:"Loading…"});if(u.kind==="error")return c.jsx("div",{className:"repository-hunk-error",children:u.message});const{result:p}=u,m=hX(p.content).filter(_=>_.kind!=="file-label");return c.jsxs("div",{className:"repository-hunk-wrap",children:[p.truncated&&c.jsx("div",{className:"repository-truncated-badge",children:"Diff truncated"}),c.jsx("div",{className:"repository-hunk-scroll",children:c.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:c.jsx("tbody",{children:m.map((_,b)=>c.jsx("tr",{className:`repository-line repository-line-${_.kind}`,children:_.kind==="hunk-label"?c.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:Tf(_.text)}}):_.kind==="meta"?c.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:Tf(_.text)}}):_.kind==="file-label"?c.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:Tf(_.text)}}):c.jsxs(c.Fragment,{children:[c.jsx("td",{className:"repository-gutter repository-gutter-old",children:_.oldLine??""}),c.jsx("td",{className:"repository-gutter repository-gutter-new",children:_.newLine??""}),c.jsx("td",{className:"repository-marker",children:_.kind==="add"?"+":_.kind==="del"?"−":""}),c.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:cX(Tf(_.text.length>0?_.text.slice(1):_.text))}})]})},b))})})})]})}const G1=140,cM=120,uM=160,Cr=4,dM=null;function hM({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const u=n-r-o;return u<i?dM:Math.max(i,Math.min(u,e-t))}function fM(e){const t=G1+Cr;return`minmax(0, 1fr) ${Cr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function fX(e){const t=uM+Cr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Cr}px minmax(0, 1fr)`}function pM(e,t,n,i,r,o=Cr){const u=n-r-o;return u<i?dM:Math.max(i,Math.min(u,e+t))}function pX(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Cr}px minmax(120px, 1fr)`}function mX(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Cr}px minmax(140px, 1fr)`}function K1({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let r=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",u),t.removeEventListener("blur",u)},u=()=>{r&&(r=!1,o(),i())},h=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",u),t.addEventListener("blur",u),h}const gX="fleet-console.repository.compare.",_X=248,vX=220;function mM(e,t){return`${gX}${e}.${t}`}function yX(e,t){try{const n=localStorage.getItem(mM(e,t));if(!n)return null;const i=JSON.parse(n);return typeof i!="object"||i===null?null:{base:typeof i.base=="string"?i.base:"",head:typeof i.head=="string"?i.head:""}}catch{return null}}function bX(e,t,n,i){try{localStorage.setItem(mM(e,t),JSON.stringify({base:n,head:i}))}catch{}}function SX({ctx:e,repoRel:t,refs:n,refsError:i=!1,onRetryRefs:r,onFileOpenChange:o}){const[u,h]=v.useState(""),[p,f]=v.useState(""),[m,_]=v.useState({kind:"idle"}),[b,S]=v.useState(null),[w,x]=v.useState(_X),[C,D]=v.useState(!1),z=v.useRef(w),F=v.useRef(null),N=v.useRef(null),I=v.useRef(!1),j=v.useRef(0),U=v.useMemo(()=>n.remotes.filter(L=>!X1(L.ref)),[n.remotes]),G=n.branches.find(L=>L.current)??null,W=G===null,Z=v.useCallback(L=>L==="HEAD"?W:n.branches.some(q=>q.ref===L)||U.some(q=>q.ref===L)||n.tags.some(q=>q.ref===L),[n.branches,n.tags,U,W]);v.useEffect(()=>{const L=n.branches.length>0||U.length>0||n.tags.length>0,q=G?.ref??"HEAD";if(!I.current){if(!L||!e.theaterId)return;I.current=!0;const H=yX(e.theaterId,t);h(H&&Z(H.base)?H.base:""),f(H&&Z(H.head)?H.head:q);return}h(H=>H&&!Z(H)?"":H),f(H=>H&&!Z(H)?q:H)},[e.theaterId,G,Z,n.branches.length,n.tags.length,U.length,t]),v.useEffect(()=>{o?.(b!==null)},[o,b]),v.useEffect(()=>()=>N.current?.(),[]);const V=v.useCallback((L,q)=>{const H=L==="base"?q:u,ne=L==="head"?q:p;L==="base"?h(q):f(q),e.theaterId&&bX(e.theaterId,t,H,ne)},[u,e.theaterId,p,t]),O=v.useCallback(()=>{if(!e.theaterId||!u||!p||u===p)return;const L=++j.current;S(null),_({kind:"loading"}),fetch("/plugins/repository/compare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,base:u,head:p})}).then(async q=>{if(L!==j.current)return;if(!q.ok){const ne=await q.json();if(L!==j.current)return;const oe=ne.error??"git_failed";_(oe==="no_git_repo"||oe==="git_unavailable"?{kind:"notice",reason:oe}:{kind:"error",message:oe});return}const H=await q.json();L===j.current&&_({kind:"ok",base:u,head:p,files:H.files,...H.mergeBase?{mergeBase:H.mergeBase}:{},...H.truncated?{truncated:!0}:{}})}).catch(q=>{L===j.current&&_({kind:"error",message:q instanceof Error?q.message:"unknown"})})},[u,e.theaterId,p,t]),A=v.useCallback(L=>{L.preventDefault();const q=F.current;if(!q)return;const H=q.getBoundingClientRect().width,ne=L.clientX,oe=z.current;N.current?.(),D(!0),N.current=K1({documentTarget:document,windowTarget:window,onMove:Se=>{const fe=hM({startWidth:oe,dx:Se.clientX-ne,containerWidth:H,listPaneMinWidth:vX,hunkPaneMinWidth:G1,dividerWidth:Cr});fe!==null&&(z.current=fe,x(fe))},onFinish:()=>{D(!1),N.current=null}})},[]),B=v.useMemo(()=>{const L=[];W&&L.push({value:"HEAD",label:"HEAD"});for(const q of n.branches)L.push({value:q.ref,label:`LOCAL · ${q.label}`});for(const q of U)L.push({value:q.ref,label:`REMOTES · ${q.label}`});for(const q of n.tags)L.push({value:q.ref,label:`TAGS · ${q.label}`});return L},[n.branches,n.tags,U,W]),M=v.useMemo(()=>[{value:"",label:"Select base…",disabled:!0},...B],[B]),k=(L,q)=>c.jsx(Ni,{label:L==="base"?"Base ref":"Head ref",value:q,options:L==="base"?M:B,onChange:H=>V(L,H)}),T=u!==""&&p!==""&&u!==p,R=m.kind==="ok"?m.base:null,$=m.kind==="ok"?m.head:null,K=v.useMemo(()=>R&&$&&e.theaterId?{base:R,head:$,theaterId:e.theaterId,repoRel:t}:null,[R,$,e.theaterId,t]);return c.jsxs("div",{className:"repository-compare",children:[i?c.jsxs("div",{className:"history-error",children:["Unable to load refs",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:r,children:"Retry"})]}):c.jsxs("div",{className:"repository-compare-controls",children:[k("base",u),c.jsx("span",{className:"repository-compare-arrow","aria-hidden":"true",children:"…"}),k("head",p),c.jsx("button",{type:"button",className:"repository-refresh-btn repository-compare-run",disabled:!T,onClick:O,children:"Compare"})]}),c.jsxs("div",{ref:F,className:`repository-root${b?" has-hunk":""}${C?" is-dragging":""}`,style:b?{gridTemplateColumns:fM(w)}:void 0,children:[b&&K?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:b.path}),c.jsx("button",{type:"button",onClick:()=>S(null),children:"✕"})]}),c.jsx(Up,{ctx:e,repoRel:t,file:b,mode:"unified",compare:K})]}):null,b?c.jsx("div",{className:"repository-divider",onPointerDown:A,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane repository-compare-results",children:[m.kind==="idle"&&c.jsx("div",{className:"history-empty",children:"Select base and head refs, then run Compare."}),m.kind==="loading"&&c.jsx("div",{className:"history-empty",children:"Comparing…"}),m.kind==="ok"&&m.files.length===0&&c.jsx("div",{className:"history-empty",children:"No differences between the selected refs."}),m.kind==="error"&&m.message==="no_merge_base"&&c.jsx("div",{className:"history-empty",children:"The selected refs share no common history."}),(m.kind==="notice"||m.kind==="error"&&m.message!=="no_merge_base"||m.kind==="ok"&&m.files.length>0)&&c.jsxs(c.Fragment,{children:[m.kind==="ok"&&m.mergeBase&&c.jsxs("div",{className:"repository-compare-meta",children:["merge-base ",c.jsx("span",{children:m.mergeBase})]}),c.jsx(oM,{state:m.kind==="ok"?{kind:"ok",files:m.files}:m,onRetry:O,viewMode:"list",selectedPath:b?.path??null,onSelect:S,filterText:""}),m.kind==="ok"&&m.truncated&&c.jsx("div",{className:"history-truncated",children:"Comparison capped — file list truncated."})]})]})]})]})}function i5(e,t){const n=Array.from(e.toLowerCase()),i=Array.from(t),r=[];let o=0;for(const u of n){let h=-1;for(let p=o;p<i.length;p+=1)if(i[p].toLowerCase()===u){h=p;break}if(h<0)return null;r.push(h),o=h+1}return r}function gM(){return Object.create(null)}function s5(){return{dirs:gM(),repos:[]}}function wX(e){const t=s5();for(const n of e){const i=n.relPath.replaceAll("\\","/").split("/").filter(o=>o.length>0);if(i.length===0)continue;i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]=s5()),r=r.dirs[o];r.repos.push(n)}return _M(t),t}function _M(e){e.repos.sort((n,i)=>n.name.localeCompare(i.name));const t=Object.entries(e.dirs).sort(([n],[i])=>n.localeCompare(i));e.dirs=gM();for(const[n,i]of t)_M(i),e.dirs[n]=i}function xX(e,t){let n=e,i=t;for(;Object.keys(i.dirs).length===1&&i.repos.length===0;){const r=Object.keys(i.dirs)[0];n+="/"+r,i=i.dirs[r]}return{label:n,node:i}}function vM(e){let t=e.repos.length;for(const n of Object.values(e.dirs))t+=vM(n);return t}const Yb=new Set;let V1={file:null};function yM(){for(const e of Yb)e()}function CX(e){return Yb.add(e),()=>{Yb.delete(e)}}function r5(){return V1}function kX(e,t){const n=v.useSyncExternalStore(CX,r5,r5);return!n.file||n.file.theaterId!==e||n.file.repoRel!==t?null:n.file}function EX(e,t,n){V1={file:{entry:e,theaterId:t,repoRel:n}},yM()}function Lv(){V1={file:null},yM()}const Xb=12,Hl=28,Mv=3,TX=5,a5=["var(--id-cerulean)","var(--id-plum)","var(--id-amber)","var(--id-teal)","var(--id-moss)","var(--id-indigo)","var(--id-rose)","var(--id-crimson)"];function qu(e){return e*Xb+6}function Lo(e){return a5[e%a5.length]??"var(--ink-fog)"}function AX({node:e}){const t=Math.max(e.activeLaneCount,1),n=e.collapsed?10:0,i=t*Xb+n,r=qu(e.lane),o=Hl/2;return c.jsxs("svg",{width:i,height:Hl,viewBox:`0 0 ${i} ${Hl}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(u=>c.jsx("line",{x1:qu(u),y1:0,x2:qu(u),y2:Hl,stroke:Lo(u),strokeWidth:1.5},`pt-${u}`)),e.connectAbove&&c.jsx("line",{x1:r,y1:0,x2:r,y2:o-Mv,stroke:Lo(e.lane),strokeWidth:1.5}),e.connectBelow&&c.jsx("line",{x1:r,y1:o+Mv,x2:r,y2:Hl,stroke:Lo(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(u=>c.jsx("line",{x1:qu(u),y1:0,x2:r,y2:o,stroke:Lo(u),strokeWidth:1.5,strokeLinecap:"round"},`mf-${u}`)),e.branchToLanes.map(u=>c.jsx("line",{x1:r,y1:o,x2:qu(u),y2:Hl,stroke:Lo(u),strokeWidth:1.5,strokeLinecap:"round"},`bt-${u}`)),e.isHead&&c.jsx("circle",{cx:r,cy:o,r:TX,fill:"none",stroke:Lo(e.lane),strokeWidth:1.5}),c.jsx("circle",{cx:r,cy:o,r:Mv,fill:Lo(e.lane)}),e.collapsed&&c.jsx("text",{x:t*Xb+2,y:o+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const jv=8;function RX(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],n=[];let i=!1,r=0;for(let o=0;o<e.length;o++){const u=e[o],h=u.fullHash,p=[...u.parents],f=[];for(let C=0;C<t.length;C++)t[C]===h&&f.push(C);let m,_=!1;const b=[];if(f.length===0){const C=t.indexOf(null);C>=0?m=C:t.length<jv?(m=t.length,t.push(null)):(i=!0,m=jv-1,t[m]=null,_=!0)}else{m=Math.min(...f);for(const C of f)C!==m&&(b.push(C),t[C]=null)}const S=[];if(p.length===0)t[m]=null;else{t[m]=_?null:p[0]??null;for(const C of p.slice(1))if(!(t.indexOf(C)>=0)){const z=t.indexOf(null);if(z>=0)t[z]=C,S.push(z);else if(t.length<jv){const F=t.length;t.push(C),S.push(F)}else i=!0}}const w=t.map((C,D)=>({h:C,i:D})).filter(({h:C,i:D})=>C!==null&&D!==m).map(({i:C})=>C),x=Math.max(m,...w,...b,...S);r=Math.max(r,x),n.push({lane:m,activeLaneCount:x+1,collapsed:i,isHead:u.refs.some(C=>C==="HEAD"||C.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:p.length>0&&t[m]===p[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}function bM(e,t=new Date){const n=new Date(e*1e3);if(!Number.isFinite(n.getTime()))return"—";const i=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),u=Math.round((r-o)/864e5);return u===0?`Today ${i}`:u===1?`Yesterday ${i}`:`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function Y1(e){const t=[];for(const n of e.refs)if(n==="HEAD")t.push({label:"HEAD",kind:"head"});else if(n.startsWith("HEAD -> refs/heads/"))t.push({label:n.slice(19),kind:"branch"});else if(n.startsWith("HEAD -> "))t.push({label:n.slice(8),kind:"branch"});else if(n.startsWith("tag: refs/tags/"))t.push({label:n.slice(15),kind:"tag"});else if(n.startsWith("tag: "))t.push({label:n.slice(5),kind:"tag"});else if(n.startsWith("refs/remotes/")){const i=n.slice(13);i.endsWith("/HEAD")||t.push({label:i,kind:"remote"})}else n.startsWith("refs/worktrees/")?t.push({label:n.slice(15),kind:"worktree"}):n.startsWith("refs/heads/")?t.push({label:n.slice(11),kind:"branch"}):t.push({label:n,kind:"branch"});return t}const NX=230,Rd=160,LX=222,Zb=148,MX=4,jX=180,SM="fleet-console.repository.workspace.dockHeight",wM="fleet-console.repository.workspace.treeWidth";function OX(e){try{const t=Number.parseFloat((e??globalThis.localStorage).getItem(wM)??"");if(Number.isFinite(t)&&t>=Zb)return t}catch{}return LX}function DX(e,t){try{(t??globalThis.localStorage).setItem(wM,String(e))}catch{}}function IX(e,t,n){const i=n-jX-MX;return i<Zb?null:Math.max(Zb,Math.min(i,e+t))}function BX(e){try{const t=Number.parseFloat((e??globalThis.localStorage).getItem(SM)??"");if(Number.isFinite(t)&&t>=Rd)return t}catch{}return NX}function PX(e,t){try{(t??globalThis.localStorage).setItem(SM,String(e))}catch{}}function $X(e,t){const n=t-180-4;return n<=Rd?Math.max(0,n):Math.max(Rd,Math.min(n,e))}function zX(e,t,n){const i=n-180-4;return i<Rd?null:Math.max(Rd,Math.min(i,e-t))}function HX(e){return`minmax(180px, 1fr) 4px ${e}px`}function FX(e){return[{id:"context",label:"CONTEXT",count:e.context},{id:"working",label:"WORKING",count:e.changes},{id:"worktrees",label:"WORKTREES",count:e.worktrees},{id:"branches",label:"BRANCHES",count:e.branches},{id:"tags",label:"TAGS",count:e.tags},{id:"stashes",label:"STASHES",count:e.stashes}]}const xM="fleet-console.history.logHeight",o5="fleet-console.history.headerHeight",l5="fleet-console.history.fileListWidth",CM="fleet-console.history.filesView",UX=240,WX=214,qX=180;function GX(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function KX(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.subject.toLowerCase().includes(n)||i.authorName.toLowerCase().includes(n)||i.shortHash.toLowerCase().includes(n)||i.fullHash.toLowerCase().includes(n)||i.refs.some(r=>r.toLowerCase().includes(n))||Y1(i).some(r=>r.label.toLowerCase().includes(n))):e}function VX(e){return e==="Escape"}function YX(e){return e.reduce((t,n)=>({files:t.files+1,additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{files:0,additions:0,deletions:0})}function XX(e,t,n){return e.files>0&&!t&&!n}function c5({current:e}){return e?c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.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 ZX({entry:e,checkouts:t,selected:n,graphNode:i,onSelect:r}){const o=Y1(e),u=GX(e,t);return c.jsxs("button",{type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>r(e),children:[c.jsxs("span",{className:"history-commit-badges",children:[o.map(h=>{const p=h.kind==="branch"?t.find(f=>f.branch===h.label):null;return c.jsxs("span",{className:`history-badge history-badge--${h.kind}`,children:[p&&c.jsx(c5,{current:p.isCurrent}),h.label]},`${h.kind}:${h.label}`)}),u&&c.jsxs("span",{className:"history-badge history-badge--worktree",children:[c.jsx(c5,{current:u.isCurrent}),"detached"]})]}),c.jsx("span",{className:"history-commit-subject",children:e.subject}),c.jsx("span",{className:"history-commit-sha",children:e.shortHash}),c.jsx("span",{className:"history-commit-time",children:bM(e.authorAt)}),c.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:c.jsx(AX,{node:i})})]})}function JX({ctx:e,repoRel:t,target:n,workspace:i,onSelectCommit:r,onClose:o}){const[u,h]=v.useState({kind:"loading"}),[p,f]=v.useState("details"),[m,_]=v.useState(null),[b,S]=v.useState(!1),[w,x]=v.useState(()=>Jb(o5,WX)),[C,D]=v.useState(()=>Jb(l5,qX)),[z,F]=v.useState(nZ),N=v.useRef(null),I=v.useRef(null),j=v.useRef(null),U=v.useRef(w),G=v.useRef(C),W=v.useMemo(()=>({fullHash:n.fullHash,theaterId:e.theaterId??"",repoRel:t}),[n.fullHash,e.theaterId,t]);v.useEffect(()=>{let O=!1;return h({kind:"loading"}),e.api.fetch("repository","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,ref:n.fullHash})}).then(async A=>{if(!A.ok)throw new Error((await A.json()).error??"git_failed");return A.json()}).then(A=>{O||(h({kind:"ok",result:A}),_(A.files[0]?.path??null))}).catch(A=>{O||h({kind:"error",message:A instanceof Error?A.message:"unknown"})}),()=>{O=!0}},[e.api,e.theaterId,t,n.fullHash]),v.useEffect(()=>()=>j.current?.(),[]);const Z=v.useCallback((O,A)=>{O.preventDefault();const B=A==="y"?N.current:I.current;if(!B)return;const M=A==="y"?U.current:G.current,k=A==="y"?O.clientY:O.clientX,T=A==="y"?B.getBoundingClientRect().height:B.getBoundingClientRect().width;j.current?.(),j.current=K1({documentTarget:document,windowTarget:window,onMove:R=>{const $=R,K=pM(M,(A==="y"?$.clientY:$.clientX)-k,T,120,120);K!==null&&(A==="y"?(U.current=K,x(K)):(G.current=K,D(K)))},onFinish:()=>{const R=A==="y"?U.current:G.current;try{localStorage.setItem(A==="y"?o5:l5,String(R))}catch{}j.current=null}})},[]),V=u.kind==="loading"?c.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):u.kind==="error"?c.jsx("div",{className:"history-inspector-empty history-inspector-error",children:u.message}):(()=>{const{meta:O,files:A}=u.result,B=A.find(L=>L.path===m)??A[0]??null,M=A.reduce((L,q)=>L+q.additions,0),k=A.reduce((L,q)=>L+q.deletions,0),T=n.entry,R=(L,q)=>{_(L.path),q&&f("changes")},$=L=>{F(L);try{localStorage.setItem(CM,L)}catch{}},K=()=>{const L=navigator.clipboard?.writeText(n.fullHash);L&&L.then(()=>{S(!0),window.setTimeout(()=>S(!1),1200)}).catch(()=>{})};return i?c.jsxs("div",{className:"repository-ws-dock",children:[c.jsx(Ov,{files:A,selectedPath:m,additions:M,deletions:k,viewMode:z,onViewMode:$,onSelect:L=>R(L,!1)}),c.jsxs("div",{className:"repository-ws-dock-main",children:[c.jsxs("div",{className:"repository-ws-dock-meta",children:[c.jsx(u5,{meta:O,entry:T,fullHash:n.fullHash,copied:b,onCopy:K,onParent:L=>r({fullHash:L})}),c.jsx("button",{type:"button",className:"history-detail-close repository-ws-dock-close","aria-label":"Close inspector",title:"Close inspector",onClick:o,children:"✕"})]}),B?c.jsxs("div",{className:"history-file-diff",children:[c.jsxs("div",{className:"history-file-repository-head",children:[c.jsx("span",{title:B.path,children:B.path}),c.jsxs("div",{children:[c.jsx("button",{type:"button","aria-label":"Previous file",disabled:A.indexOf(B)===0,onClick:()=>R(A[A.indexOf(B)-1],!1),children:"‹"}),c.jsx("button",{type:"button","aria-label":"Next file",disabled:A.indexOf(B)===A.length-1,onClick:()=>R(A[A.indexOf(B)+1],!1),children:"›"})]})]}),c.jsx(Up,{ctx:e,repoRel:t,file:B,mode:"unified",commit:W})]}):c.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})]}):p==="details"?c.jsxs("div",{ref:N,className:"history-details-tab",style:{gridTemplateRows:pX(w)},children:[c.jsx(u5,{meta:O,entry:T,fullHash:n.fullHash,copied:b,onCopy:K,onParent:L=>r({fullHash:L})}),c.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:L=>Z(L,"y")}),c.jsx(Ov,{files:A,selectedPath:m,additions:M,deletions:k,viewMode:z,onViewMode:$,onSelect:L=>R(L,!0)})]}):c.jsx("div",{className:"history-changes-tab",children:c.jsxs("div",{ref:I,className:"history-changes-columns",style:{gridTemplateColumns:mX(C)},children:[c.jsx(Ov,{files:A,selectedPath:m,additions:M,deletions:k,viewMode:z,onViewMode:$,onSelect:L=>R(L,!1)}),c.jsx("div",{className:"history-divider",onPointerDown:L=>Z(L,"x")}),B?c.jsxs("div",{className:"history-file-diff",children:[c.jsxs("div",{className:"history-file-repository-head",children:[c.jsx("span",{title:B.path,children:B.path}),c.jsxs("div",{children:[c.jsx("button",{type:"button","aria-label":"Previous file",disabled:A.indexOf(B)===0,onClick:()=>R(A[A.indexOf(B)-1],!1),children:"‹"}),c.jsx("button",{type:"button","aria-label":"Next file",disabled:A.indexOf(B)===A.length-1,onClick:()=>R(A[A.indexOf(B)+1],!1),children:"›"})]})]}),c.jsx(Up,{ctx:e,repoRel:t,file:B,mode:"unified",commit:W})]}):c.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return c.jsx("div",{className:`history-inspector${i?" repository-ws-inspector":""}`,onKeyDown:O=>{VX(O.key)&&(O.preventDefault(),o())},children:i?V:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"history-segmented",children:[c.jsx("button",{type:"button","aria-pressed":p==="details",onClick:()=>f("details"),children:"Details"}),c.jsxs("button",{type:"button","aria-pressed":p==="changes",onClick:()=>f("changes"),children:["Changes ",u.kind==="ok"&&c.jsx("span",{children:u.result.files.length})]}),c.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:o,children:"✕"})]}),V]})})}function u5({meta:e,entry:t,fullHash:n,copied:i,onCopy:r,onParent:o}){return c.jsxs("div",{className:"history-inspector-head",children:[c.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&c.jsx("pre",{className:"history-inspector-message",children:e.body}),c.jsxs("div",{className:"history-author",children:[c.jsx("span",{className:"history-avatar",children:iZ(e.authorName)}),c.jsxs("span",{children:[c.jsx("b",{children:e.authorName}),c.jsx("small",{children:e.authorEmail})]}),c.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??bM(e.authorAt)})]}),c.jsxs("div",{className:"history-inspector-ids",children:[c.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:r,children:[n,c.jsx("span",{children:i?"copied":"copy"})]}),e.parents.map(u=>c.jsxs("button",{type:"button",className:"history-parent",onClick:()=>o(u.full),children:["parent ",u.short]},u.full))]}),t&&c.jsx("div",{className:"history-ref-chips",children:Y1(t).map(u=>c.jsx("span",{className:`history-badge history-badge--${u.kind}`,children:u.label},`${u.kind}:${u.label}`))})]})}function Ov({files:e,selectedPath:t,additions:n,deletions:i,viewMode:r,onViewMode:o,onSelect:u}){return c.jsxs("section",{className:"history-commit-files",children:[c.jsxs("div",{className:"history-files-title",children:[c.jsx("span",{className:"history-files-label",children:"Changed files"}),c.jsxs("span",{className:"history-files-stats",children:[e.length," ",c.jsxs("i",{children:["+",n]})," ",c.jsxs("em",{children:["−",i]})]}),c.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${r==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":r==="list",onClick:()=>o("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${r==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":r==="tree",onClick:()=>o("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx("div",{className:"history-files-scroll",children:r==="tree"?c.jsx(rM,{files:e,selectedPath:t,onSelect:u}):e.map(h=>c.jsx(lM,{entry:h,isSelected:h.path===t,onSelect:u},h.path))})]})}function QX({ctx:e,repoRel:t,active:n=!0,refFilter:i=null,wipFiles:r,workspace:o=!1,workspaceMain:u,workspaceMainVisible:h=!1,onInspectorOpenChange:p,onClearRef:f,onWip:m}){return c.jsx(eZ,{ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,workspace:o,workspaceMain:u,workspaceMainVisible:h,onInspectorOpenChange:p,onClearRef:f,onWip:m},`${e.theaterId??""}:${t}`)}function eZ({ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,workspace:o,workspaceMain:u,workspaceMainVisible:h,onInspectorOpenChange:p,onClearRef:f,onWip:m}){const[_,b]=v.useState({kind:"loading"}),[S,w]=v.useState(null),[x,C]=v.useState(""),[D,z]=v.useState(0),[F,N]=v.useState(tZ),[I,j]=v.useState(BX),[U,G]=v.useState(!1),W=v.useRef(null),Z=v.useRef(null),V=v.useRef(F),O=v.useRef(I);v.useEffect(()=>{w(null)},[i]);const[A,B]=v.useState(n);v.useEffect(()=>{n&&B(!0)},[n]),v.useEffect(()=>{if(!A)return;if(!e.theaterId){b({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let L=!1;return b({kind:"loading"}),e.api.fetch("repository","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,...i?{ref:i}:{}})}).then(async q=>{if(!q.ok)throw new Error((await q.json()).error??"git_failed");return q.json()}).then(q=>{L||b({kind:"ok",commits:q.commits,checkouts:q.checkouts,truncated:q.truncated??!1})}).catch(q=>{L||b({kind:"error",message:q instanceof Error?q.message:"unknown"})}),()=>{L=!0}},[e.api,e.theaterId,A,D,i,t]),v.useEffect(()=>{p?.(n&&S!==null)},[n,p,S]),v.useEffect(()=>()=>Z.current?.(),[]),v.useLayoutEffect(()=>{if(!o||S===null)return;const L=W.current;if(!L)return;const q=()=>{const ne=$X(O.current,L.getBoundingClientRect().height);ne!==O.current&&(O.current=ne,j(ne))};q();const H=new ResizeObserver(q);return H.observe(L),()=>H.disconnect()},[o,S]);const M=v.useCallback(L=>{L.preventDefault();const q=W.current;if(!q)return;const H=o?O.current:V.current,ne=L.clientY,oe=q.getBoundingClientRect().height;Z.current?.(),G(!0),Z.current=K1({documentTarget:document,windowTarget:window,onMove:Se=>{const xe=Se.clientY-ne,fe=o?zX(H,xe,oe):pM(H,xe,oe,cM,uM,Cr);fe!==null&&(o?(O.current=fe,j(fe)):(V.current=fe,N(fe)))},onFinish:()=>{if(o)PX(O.current);else try{localStorage.setItem(xM,String(V.current))}catch{}G(!1),Z.current=null}})},[o]),k=v.useMemo(()=>_.kind==="ok"?KX(_.commits,x):[],[x,_]),T=_.kind==="ok"?RX(k):null,R=v.useMemo(()=>YX(r),[r]),$=XX(R,x,i),K=S?o?HX(I):fX(F):void 0;return c.jsxs("div",{ref:W,className:`history-root${o?" repository-ws-history":""}${U?" is-dragging":""}`,style:K?{gridTemplateRows:K}:void 0,children:[c.jsxs("div",{className:"history-list-pane",hidden:o&&h,children:[c.jsxs("div",{className:"history-toolbar",children:[c.jsxs("div",{className:"history-filter",children:[c.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:x,onChange:L=>C(L.target.value)}),x&&c.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>C(""),children:"✕"})]}),i&&c.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:f,children:[i," ✕"]}),_.kind==="ok"&&c.jsx("span",{className:"history-count",children:x?`${k.length}/${_.commits.length}`:_.commits.length})]}),c.jsxs("div",{className:"history-list",children:[$&&c.jsxs("button",{type:"button",className:"repository-wip-row",onClick:m,children:["Uncommitted changes ",c.jsxs("span",{children:[R.files," files · +",R.additions," −",R.deletions]})]}),_.kind==="loading"&&c.jsx("div",{className:"history-empty",children:"Loading…"}),_.kind==="error"&&c.jsxs("div",{className:"history-error",children:[_.message,c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>z(L=>L+1),children:"Retry"})]}),_.kind==="ok"&&_.commits.length===0&&c.jsx("div",{className:"history-empty",children:"No history"}),_.kind==="ok"&&_.commits.length>0&&k.length===0&&c.jsx("div",{className:"history-empty",children:"No matching items"}),_.kind==="ok"&&T&&k.map((L,q)=>c.jsx(ZX,{entry:L,checkouts:_.checkouts,selected:S?.fullHash===L.fullHash,graphNode:T.nodes[q],onSelect:H=>w({fullHash:H.fullHash,entry:H})},L.fullHash)),_.kind==="ok"&&(_.truncated||_.commits.length>=200)&&c.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),u!==void 0&&c.jsx("div",{className:"repository-ws-main",hidden:!h,children:u}),S&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":o?"Resize commit detail dock":"Resize commit log",onPointerDown:M}),c.jsx("div",{className:"history-detail-pane",children:c.jsx(JX,{ctx:e,repoRel:t,target:S,workspace:o,onSelectCommit:w,onClose:()=>w(null)})})]})]})}function tZ(){return Jb(xM,UX,cM)}function nZ(){try{const e=localStorage.getItem(CM);if(e==="list"||e==="tree")return e}catch{}return"list"}function Jb(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function iZ(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const kM="fleet-console.diff.viewMode",EM="fleet-console.diff.listPaneWidth",TM="fleet-console.repository.source",Sm="fleet-console.repository.repo.",AM="fleet-console.repository.scanDepth",RM=1,NM=8,sZ=3,rZ=248,LM=220;function aZ(){try{const e=localStorage.getItem(kM);if(e==="list"||e==="tree")return e}catch{}return"list"}function oZ(){try{const e=localStorage.getItem(TM);if(e==="changes"||e==="history"||e==="compare")return e}catch{}return"history"}function lZ(e){try{return localStorage.getItem(`${Sm}${e}`)??""}catch{return""}}function cZ(e,t,n){try{const i=`${Sm}${e}`,r=localStorage.getItem(i);if(r===null)return"";if(t.some(o=>o.relPath===r)||n.some(o=>o.relPath===r))return r;localStorage.removeItem(i)}catch{}return""}function uZ(){try{const e=Number.parseInt(localStorage.getItem(AM)??"",10);if(Number.isInteger(e)&&e>=RM&&e<=NM)return e}catch{}return sZ}function dZ(e){try{localStorage.setItem(AM,String(e))}catch{}}function hZ(e,t){try{localStorage.setItem(`${Sm}${e}`,t)}catch{}}function fZ(e){try{localStorage.removeItem(`${Sm}${e}`)}catch{}}function pZ(e){try{localStorage.setItem(TM,e)}catch{}}function mZ(){try{const e=localStorage.getItem(EM),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(LM,t)}catch{}return rZ}function gZ(e){return e.entry.status==="U"?"untracked":"unified"}function _Z({ctx:e}){return c.jsx(bZ,{ctx:e},e.theaterId)}function vZ(e,t,n){return!e||n===t?{transition:!1,landing:"history"}:{transition:!0,landing:"history"}}function X1(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function yZ(e,t){const n=(i,r)=>i.map(o=>({key:o.ref,source:r,primary:o.label,ref:o.ref,current:o.current}));return e==="branches"?[{label:"LOCAL",rows:n(t.branches,"branches")},{label:"REMOTES",rows:n(t.remotes.filter(i=>!X1(i.ref)),"branches")}]:e==="tags"?[{rows:n(t.tags,"tags")}]:[{rows:t.stashes.map(i=>({key:i.name,source:e,primary:i.subject||i.name,sub:i.name,ref:null,current:!1}))}]}function bZ({ctx:e}){const[t,n]=v.useState([]),[i,r]=v.useState(!1),[o,u]=v.useState(0),[h,p]=v.useState(!1),[f,m]=v.useState(uZ),_=v.useCallback(ee=>{m(ee),dZ(ee)},[]),[b,S]=v.useState(!1),[w,x]=v.useState([]),[C,D]=v.useState(!1),[z,F]=v.useState(0),[N,I]=v.useState(null),[j,U]=v.useState(()=>e.theaterId?lZ(e.theaterId):""),G=v.useRef(j),[W,Z]=v.useState(oZ),[V,O]=v.useState(OX),A=v.useRef(V),[B,M]=v.useState(!1),k=v.useRef(null),[T,R]=v.useState(null),[$,K]=v.useState({branches:[],remotes:[],tags:[],stashes:[]}),[L,q]=v.useState(!1),[H,ne]=v.useState(0),[oe,Se]=v.useState({kind:"loading"}),[xe,fe]=v.useState(0),[De,rt]=v.useState(aZ),[Ie,Ce]=v.useState(""),[Me,je]=v.useState(0),ze=kX(e.theaterId??null,j),[bt,pt]=v.useState(mZ),vt=v.useRef(bt),lt=v.useRef(null),[de,ut]=v.useState(!1),tt=v.useCallback(ee=>{Z(ee),pZ(ee)},[]),Vt=v.useCallback(ee=>{ee.preventDefault();const le=k.current;if(!le)return;const Be=le.getBoundingClientRect().width,Le=ee.clientX,Fe=A.current;M(!0);const it=ue=>{const be=IX(Fe,ue.clientX-Le,Be);be!==null&&(A.current=be,O(be))},X=()=>{document.removeEventListener("pointermove",it),document.removeEventListener("pointerup",X),M(!1),DX(A.current)};document.addEventListener("pointermove",it),document.addEventListener("pointerup",X)},[]),st=v.useCallback((ee,le,Be="changes")=>{e.theaterId&&(le&&hZ(e.theaterId,ee),Lv(),R(null),Ce(""),Se({kind:"loading"}),K({branches:[],remotes:[],tags:[],stashes:[]}),G.current=ee,U(ee),tt(Be))},[e.theaterId,tt]);v.useEffect(()=>{if(!e.theaterId)return;let ee=!1;return r(!1),S(!1),e.api.fetch("repository","repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:f})}).then(le=>le.json()).then(le=>{ee||(n(le.repos),p(le.truncated===!0),S(!0))}).catch(()=>{ee||r(!0)}),()=>{ee=!0}},[e.api,e.theaterId,o,f]),v.useEffect(()=>{if(!e.theaterId)return;let ee=!1;const le=j;return x([]),D(!1),I(null),e.api.fetch("repository","worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:le})}).then(Be=>Be.json()).then(Be=>{ee||(x(Be.worktrees),I(le))}).catch(Be=>{if(ee)return;if((typeof Be=="object"&&Be!==null&&"status"in Be?Be.status:null)===400&&le!==""){fZ(e.theaterId),st("",!1);return}D(!0)}),()=>{ee=!0}},[e.api,e.theaterId,j,st,z]),v.useEffect(()=>{if(!e.theaterId||!b||N!==j)return;const ee=cZ(e.theaterId,t,w);ee!==G.current&&st(ee,!1)},[e.theaterId,j,t,b,st,w,N]),v.useEffect(()=>{if(!e.theaterId)return;let ee=!1;return K({branches:[],remotes:[],tags:[],stashes:[]}),q(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:j})}).then(le=>le.ok?le.json():Promise.reject()).then(le=>{ee||K(le)}).catch(()=>{ee||q(!0)}),()=>{ee=!0}},[e.api,e.theaterId,j,H]),v.useEffect(()=>{if(!e.theaterId){Se({kind:"error",message:"no_theater"});return}let ee=!1;return Se({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:j})}).then(async le=>{if(!le.ok){const Fe=(await le.json()).error??"git_failed";ee||Se(Fe==="no_git_repo"||Fe==="git_unavailable"?{kind:"notice",reason:Fe}:{kind:"error",message:Fe});return}const Be=await le.json();ee||Se({kind:"ok",files:Be.files})}).catch(le=>{ee||Se({kind:"error",message:le instanceof Error?le.message:"unknown"})}),()=>{ee=!0}},[xe,e.theaterId,j]),v.useLayoutEffect(()=>()=>Lv(),[]);const zt=v.useCallback(ee=>{e.theaterId&&EX(ee,e.theaterId,j)},[e.theaterId,j]),Ft=v.useCallback(ee=>{const le=vZ(e.theaterId,j,ee.relPath);if(!le.transition){R(null),je(Be=>Be+1),tt(le.landing);return}st(ee.relPath,!0,le.landing)},[e.theaterId,j,tt,st]),we=v.useCallback(()=>Lv(),[]),Oe=v.useCallback(ee=>{rt(ee);try{localStorage.setItem(kM,ee)}catch{}},[]),cn=v.useCallback(ee=>{ee.preventDefault();const le=lt.current;if(!le)return;const Be=le.getBoundingClientRect().width,Le=ee.clientX,Fe=vt.current;ut(!0);const it=ue=>{const be=hM({startWidth:Fe,dx:ue.clientX-Le,containerWidth:Be,listPaneMinWidth:LM,hunkPaneMinWidth:G1,dividerWidth:Cr});be!==null&&(vt.current=be,pt(be))},X=()=>{document.removeEventListener("pointermove",it),document.removeEventListener("pointerup",X),ut(!1);try{localStorage.setItem(EM,String(vt.current))}catch{}};document.addEventListener("pointermove",it),document.addEventListener("pointerup",X)},[]),ti=ze?gZ(ze):null,ni=v.useCallback(()=>fe(ee=>ee+1),[]),We=oe.kind==="ok"?oe.files:[],gt=t.find(ee=>ee.relPath===j)??w.find(ee=>ee.relPath===j),xt=c.jsxs("div",{ref:lt,className:`repository-root${ze?" has-hunk":""}${de?" is-dragging":""}`,style:ze?{gridTemplateColumns:fM(bt)}:void 0,children:[ze&&ti?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:ze.entry.path}),c.jsx("button",{type:"button",onClick:we,children:"✕"})]}),c.jsx(Up,{ctx:e,repoRel:j,file:ze.entry,mode:ti})]}):null,ze?c.jsx("div",{className:"repository-divider",onPointerDown:cn,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane",children:[c.jsxs("div",{className:"repository-toolbar",children:[c.jsxs("div",{className:"repository-filter",children:[c.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:Ie,onChange:ee=>Ce(ee.target.value)}),Ie?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear filter",onClick:()=>Ce(""),children:"✕"}):null]}),c.jsxs("div",{className:"repository-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${De==="list"?" is-active":""}`,title:"List view","aria-pressed":De==="list",onClick:()=>Oe("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${De==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":De==="tree",onClick:()=>Oe("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx(oM,{state:oe,onRetry:ni,viewMode:De,selectedPath:ze?.entry.path??null,onSelect:zt,filterText:Ie})]})]}),Tt=c.jsx(SX,{ctx:e,repoRel:j,refs:$,refsError:L,onRetryRefs:()=>ne(ee=>ee+1)},`${e.theaterId??""}:${j}`),$t=W==="changes"||W==="compare",Cn=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"repository-source-fill",hidden:W!=="changes",children:xt}),c.jsx("div",{className:"repository-source-fill",hidden:W!=="compare",children:Tt})]});return c.jsxs("div",{className:"repository-unified is-workspace",children:[c.jsxs("div",{className:`repository-identity${j?" is-subcontext":""}`,children:[c.jsx(jM,{}),c.jsx("strong",{children:gt?.name??"Repository"}),gt?.branch&&c.jsx("span",{children:gt.branch})]}),c.jsxs("div",{ref:k,className:`repository-ws-layout${B?" is-dragging":""}`,style:{"--ws-tree-width":`${V}px`},children:[c.jsx(SZ,{repos:t,reposError:i,reposTruncated:h,scanDepth:f,worktrees:w,worktreesError:C,refs:$,refsError:L,changedFiles:oe,selectedRel:j,source:W,refFilter:T,onRepository:Ft,onScanDepth:_,onRetryRepos:()=>u(ee=>ee+1),onRetryWorktrees:()=>F(ee=>ee+1),onRetryRefs:()=>ne(ee=>ee+1),onSource:tt,onRef:ee=>{R(ee),tt("history")}}),c.jsx("div",{className:"repository-divider repository-ws-tree-divider",onPointerDown:Vt,role:"separator","aria-orientation":"vertical","aria-label":"Resize source tree"}),c.jsx(QX,{ctx:e,repoRel:j,active:!0,refFilter:T,wipFiles:We,workspace:!0,workspaceMain:Cn,workspaceMainVisible:$t,onClearRef:()=>R(null),onWip:()=>tt("changes")},`${e.theaterId??""}:${j}:${Me}`)]})]})}function SZ({repos:e,reposError:t,reposTruncated:n,scanDepth:i,worktrees:r,worktreesError:o,refs:u,refsError:h,changedFiles:p,selectedRel:f,source:m,refFilter:_,onRepository:b,onScanDepth:S,onRetryRepos:w,onRetryWorktrees:x,onRetryRefs:C,onSource:D,onRef:z}){const[F,N]=v.useState(""),I=e.filter(T=>T.kind==="root").sort((T,R)=>T.name.localeCompare(R.name)),j=e.filter(T=>T.kind==="nested"),U=wX(j),G=T=>i5(F,T.name)??i5(F,T.relPath),W=F?I.filter(T=>G(T)!==null):I,Z=F?j.filter(T=>G(T)!==null):j,V=W.length+Z.length,O=u.branches.length+u.remotes.filter(T=>!X1(T.ref)).length,A=p.kind==="ok"?p.files.length:0,B=FX({context:e.length,changes:A,worktrees:r.length,branches:O,tags:u.tags.length,stashes:u.stashes.length}),M=T=>{const R=B.find($=>$.id===T);return c.jsxs("div",{className:"repository-ws-section-head",children:[c.jsx("span",{children:R.label}),c.jsx("i",{children:R.count})]})},k=T=>yZ(T,u).map(R=>c.jsxs("div",{className:"repository-ws-ref-group",children:[R.label&&c.jsx("span",{className:"repository-ws-ref-subhead",children:R.label}),R.rows.map($=>c.jsxs("button",{type:"button",className:`repository-ws-tree-row${$.current?" is-current":""}${m==="history"&&$.ref===_?" is-active":""}`,disabled:$.ref===null,onClick:()=>$.ref&&z($.ref),children:[c.jsx(Kl,{source:$.source}),c.jsx("span",{children:$.primary}),$.current&&c.jsx("i",{children:"HEAD"}),$.sub&&c.jsx("i",{children:$.sub})]},$.key))]},R.label??T));return c.jsxs("aside",{className:"repository-ws-tree",children:[c.jsx(wZ,{query:F,onQuery:N,totalCount:e.length,matchedCount:V,scanDepth:i,onScanDepth:S,truncated:n,onEnter:()=>{const T=W[0]??Z[0];T&&b(T)}}),c.jsxs("div",{className:"repository-ws-tree-scroll",children:[c.jsxs("section",{className:"repository-ws-section",children:[M("context"),t?c.jsx(Dv,{label:"Unable to load repositories",onRetry:w}):c.jsxs(c.Fragment,{children:[W.map(T=>c.jsx(Qb,{repo:T,depth:0,selectedRel:f,onRepository:b},T.relPath)),F?Z.map(T=>c.jsx(Qb,{repo:T,depth:0,selectedRel:f,onRepository:b},T.relPath)):c.jsx(MM,{node:U,depth:0,selectedRel:f,onRepository:b}),F&&V===0&&c.jsx("div",{className:"repository-empty-row",children:"No matching repositories"})]})]}),c.jsxs("section",{className:"repository-ws-section",children:[M("working"),c.jsxs("button",{type:"button",className:`repository-ws-tree-row${m==="history"?" is-active":""}`,onClick:()=>D("history"),children:[c.jsx(Kl,{source:"history"}),c.jsx("span",{children:"History"})]}),c.jsxs("button",{type:"button",className:`repository-ws-tree-row${m==="changes"?" is-active":""}`,onClick:()=>D("changes"),children:[c.jsx(Kl,{source:"changes"}),c.jsx("span",{children:"Changes"}),c.jsx("i",{children:A})]}),c.jsxs("button",{type:"button",className:`repository-ws-tree-row${m==="compare"?" is-active":""}`,onClick:()=>D("compare"),children:[c.jsx(Kl,{source:"compare"}),c.jsx("span",{children:"Compare"})]})]}),c.jsxs("section",{className:"repository-ws-section",children:[M("worktrees"),o?c.jsx(Dv,{label:"Unable to load worktrees",onRetry:x}):r.map(T=>c.jsxs("button",{type:"button",className:`repository-ws-tree-row${T.relPath===f?" is-current":""}`,title:T.relPath,onClick:()=>b(T),children:[c.jsx(Kl,{source:"worktrees"}),c.jsx("span",{children:T.name}),T.current&&c.jsx("i",{children:"HEAD"})]},T.relPath))]}),c.jsxs("section",{className:"repository-ws-section",children:[M("branches"),h?c.jsx(Dv,{label:"Unable to load refs",onRetry:C}):k("branches")]}),c.jsxs("section",{className:"repository-ws-section",children:[M("tags"),!h&&k("tags")]}),c.jsxs("section",{className:"repository-ws-section",children:[M("stashes"),!h&&k("stashes")]})]})]})}function Dv({label:e,onRetry:t}){return c.jsxs("div",{className:"repository-ws-tree-error",children:[c.jsx("span",{children:e}),c.jsx("button",{type:"button",onClick:t,children:"Retry"})]})}function Kl({source:e}){const t=e==="repositories"?"M3 5h12v9H3zM5 3h8v2":e==="worktrees"?"M5 3v12M5 6h7M5 12h7":e==="changes"?"M3 4h12M3 9h12M3 14h12":e==="history"?"M4 4v10h10M7 7h6v5":e==="compare"?"M5.5 3v9M3 9.5l2.5 2.5L8 9.5M12.5 15V6M10 8.5L12.5 6L15 8.5":e==="branches"?"M5 3v12M5 6h7M5 12h7":e==="tags"?"M3 4h8l4 4-7 7-5-5z":"M4 5h10v9H4zM6 3h6";return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function wZ({query:e,onQuery:t,totalCount:n,matchedCount:i,scanDepth:r,onScanDepth:o,truncated:u,onEnter:h}){return c.jsxs("div",{className:"repository-discovery",children:[c.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Find repositories…","aria-label":"Find repositories",value:e,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key!=="Enter"||p.nativeEvent.isComposing||h()}}),e?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear search",onClick:()=>t(""),children:"✕"}):null,c.jsxs("span",{className:"repository-discovery-depth",children:["Depth",c.jsx("button",{type:"button",className:"repository-depth-step","aria-label":"Scan shallower",disabled:r<=RM,onClick:()=>o(r-1),children:"−"}),c.jsx("output",{className:"repository-depth-value",children:r}),c.jsx("button",{type:"button",className:"repository-depth-step","aria-label":"Scan deeper",disabled:r>=NM,onClick:()=>o(r+1),children:"+"})]}),c.jsx("span",{className:"repository-scan-count",children:e?`${i} of ${n}`:`${n} found${u?" · limit reached":""}`})]})}function MM({node:e,depth:t,selectedRel:n,onRepository:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>c.jsx(xZ,{dirKey:r,node:o,depth:t,selectedRel:n,onRepository:i},r)),e.repos.map(r=>c.jsx(Qb,{repo:r,depth:t,selectedRel:n,onRepository:i},r.relPath))]})}function xZ({dirKey:e,node:t,depth:n,selectedRel:i,onRepository:r}){const[o,u]=v.useState(!1),h=v.useCallback(()=>u(b=>!b),[]),{label:p,node:f}=xX(e,t),m=n*16+12,_=vM(f);return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`,gridTemplateColumns:"12px 15px 1fr auto"},onClick:h,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.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"})}),c.jsx("span",{className:"repository-folder-name",children:p}),c.jsx("span",{className:"repository-folder-count",children:_})]}),!o&&c.jsx(MM,{node:f,depth:n+1,selectedRel:i,onRepository:r})]})}function Qb({repo:e,depth:t,selectedRel:n,onRepository:i,nameMatch:r}){const o=t*16+30;return c.jsxs("button",{type:"button",title:e.relPath,className:`repository-ref-row${e.relPath===n?" is-current":""}`,style:{paddingLeft:`${o}px`},onClick:()=>i(e),children:[c.jsx(Kl,{source:"repositories"}),c.jsx("span",{className:"repository-ref-name",children:r?Array.from(e.name).map((u,h)=>r.includes(h)?c.jsx("b",{className:"repository-ref-hl",children:u},h):u):e.name}),e.relPath===n&&c.jsx("span",{className:"repository-ref-mark",children:"✓"}),e.branch&&c.jsx("span",{className:"repository-ref-sub",children:e.branch})]})}function jM(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),c.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const CZ={id:"repository",title:"Repository",icon:()=>c.jsx(jM,{}),render:e=>c.jsx(_Z,{ctx:e})},kZ={id:"repository",railPanels:[CZ]},EZ=[kZ],Af=["claude-code","codex","cursor","opencode"],TZ={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},AZ="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function RZ({source:e,skill:t,theaterId:n,onCancel:i,onStarted:r,jobLog:o}){const[u,h]=v.useState(n?"project":"global"),[p,f]=v.useState(!0),[m,_]=v.useState(new Set(Af)),{status:b,start:S}=o,w=b==="running",x=b==="done",C=b==="error",D=v.useCallback(()=>{f(!0),_(new Set(Af))},[]),z=v.useCallback(N=>{f(!1),_(I=>{const j=new Set(I);return j.has(N)?j.delete(N):j.add(N),j})},[]),F=v.useCallback(()=>{const N=p?Af:Array.from(m);if(N.length===0)return;const I={source:e,skill:t,scope:u,agents:N};u==="project"&&n&&(I.theaterId=n),S("/plugins/skills/install",I),r(u)},[p,m,e,t,u,n,S,r]);return c.jsxs("div",{className:"skills-install-flow",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${u==="project"?" is-active":""}`,onClick:()=>h("project"),disabled:!n||w||x,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),c.jsx("button",{type:"button",className:`skills-scope-btn${u==="global"?" is-active":""}`,onClick:()=>h("global"),disabled:w||x,children:"Global"})]}),c.jsxs("div",{className:"skills-agents-row",children:[c.jsx("button",{type:"button",className:`skills-agent-chip${p?" is-active":""}`,onClick:D,disabled:w||x,children:"All agents"}),Af.map(N=>c.jsx("button",{type:"button",className:`skills-agent-chip${!p&&m.has(N)?" is-active":""}`,onClick:()=>z(N),disabled:w||x,children:TZ[N]},N))]}),c.jsx("p",{className:"skills-permission-warning",children:AZ}),!w&&!x&&!C&&c.jsxs("div",{className:"skills-card-actions",children:[c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:"Cancel"}),c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:F,disabled:!p&&m.size===0,children:"Install now"})]})]})}const NZ=4e3;function OM({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:u}){const[h,p]=v.useState(!1),f=v.useRef(null),m=v.useRef(null);v.useEffect(()=>{e==="running"&&p(!1)},[e]),v.useEffect(()=>{const C=f.current;C&&(C.scrollTop=C.scrollHeight)},[t]),v.useEffect(()=>{if(e==="done")return m.current=setTimeout(()=>{p(!1),o()},NZ),()=>{m.current&&(clearTimeout(m.current),m.current=null)}},[e,o]);const _=v.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),p(!1),o()},[o]),b=v.useCallback(()=>p(C=>!C),[]);if(e==="idle")return null;const S=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",w=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",x=e==="running"?n:e==="done"?i:r;return c.jsxs("div",{className:"skills-dock",children:[h&&c.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((C,D)=>c.jsx("div",{className:"skills-dock-log-line",children:C},D)),e==="done"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",r]})]}),c.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${h?" is-open":""}`,"aria-expanded":h,onClick:b,onKeyDown:C=>{C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),b())},children:[c.jsx("span",{className:S,"aria-hidden":"true"}),c.jsx("span",{className:w,"aria-live":"polite",children:x}),e==="running"&&t.length>0&&c.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:C=>{C.stopPropagation(),_()},children:"✕"}),e==="error"&&c.jsxs(c.Fragment,{children:[u!=null&&c.jsx("button",{type:"button",className:"skills-dock-retry",onClick:C=>{C.stopPropagation(),u()},children:"Retry"}),c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:C=>{C.stopPropagation(),_()},children:"✕"})]}),c.jsx("span",{className:`skills-dock-chevron${h?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const LZ={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},e0=new Set;let fi=LZ;function ao(){for(const e of e0)e()}function MZ(e){return e0.add(e),()=>{e0.delete(e)}}function d5(){return fi}function Z1(){return v.useSyncExternalStore(MZ,d5,d5)}function Rf(e){fi={...fi,activeTab:e},ao()}function h5(e){fi={...fi,scope:e},ao()}function jZ(e){fi={...fi,filterText:e},ao()}function OZ(e){fi={...fi,searchQuery:e},ao()}function Vl(e,t){fi={...fi,searchResults:e,searchLoading:t},ao()}function Wp(e){return e??""}function t0(e,t){return e.installedContextKey===t}function Iv(e,t,n){fi.installedContextKey===e&&(fi={...fi,installedList:t,installedLoading:n},ao())}function n0(e){fi={...fi,installFormOpenId:e},ao()}function DZ(e){fi={...fi,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},ao()}const f5=750;function DM(){const[e,t]=v.useState({status:"idle",lines:[]}),n=v.useRef(null),i=v.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);v.useEffect(()=>()=>i(),[i]);const r=v.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=v.useCallback((u,h)=>{i(),t({status:"running",lines:[]}),(async()=>{const p=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).catch(()=>null);if(!p?.ok){t({status:"error",lines:[]});return}const{jobId:f}=await p.json();let m=0;const _=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${m}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();m=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{_()},f5):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{_()},f5)})()},[i]);return{...e,start:o,reset:r}}const IZ=300,ep=2;function BZ(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function PZ(e){if(e.length<ep){Vl([],!1);return}Vl([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Vl([],!1);return}const n=await t.json();Vl(n.skills??[],!1)}catch{Vl([],!1)}}function $Z({result:e,theaterId:t,isFormOpen:n,onInstallClick:i,onReadMore:r,onInstallStarted:o,jobLog:u}){const h={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return c.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>r(h,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&c.jsx("span",{className:"skills-card-installs",children:BZ(e.installs)})]}),c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("div",{className:"skills-card-actions",children:c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:i,children:n?"Cancel":"Install"})}),n&&c.jsx(RZ,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:p=>o(e.name,p),jobLog:u})]})}function zZ({theaterId:e,onReadMore:t,onInstallSuccess:n}){const{searchQuery:i,searchResults:r,searchLoading:o,installFormOpenId:u}=Z1(),h=v.useRef(null),p=DM(),[f,m]=v.useState(null),_=v.useCallback(S=>{if(OZ(S),h.current&&clearTimeout(h.current),S.length<ep){Vl([],!1);return}h.current=setTimeout(()=>{PZ(S)},IZ)},[]);v.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),v.useEffect(()=>{p.status!=="done"||!f||(n(f.name,f.scope),n0(null),m(null))},[p.status,f,n]);const b=f?`Installing ${f.name}…`:"Installing…";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:i,onChange:S=>_(S.target.value),"aria-label":"Search skills registry"}),o&&c.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!o&&i.length>=ep&&r.length===0&&c.jsxs("div",{className:"skills-empty-state",children:['No results for "',i,'".']}),!o&&i.length>0&&i.length<ep&&c.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),c.jsx("div",{className:"skills-card-list",children:r.map(S=>c.jsx($Z,{result:S,theaterId:e,isFormOpen:u===S.id,onInstallClick:()=>n0(u===S.id?null:S.id),onReadMore:t,onInstallStarted:(w,x)=>m({name:w,scope:x}),jobLog:p},S.id))})]}),c.jsx(OM,{status:p.status,lines:p.lines,runningLabel:b,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:p.reset})]})}const HZ=2600;function FZ({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:r}){const[o,u]=v.useState(!1),h=v.useRef(null),p=v.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),f=v.useCallback(()=>{o?(p(),u(!1),i?.(e.name,e.scope)):(u(!0),h.current=setTimeout(()=>u(!1),HZ))},[o,p,i,e.name,e.scope]);return v.useEffect(()=>()=>p(),[p]),c.jsxs("div",{className:"skills-card",children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),c.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),c.jsxs("div",{className:"skills-card-actions",children:[n&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>n(e.scope),disabled:r,children:r?"Updating…":"Update all"}),i&&c.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${o?" is-armed":""}`,onClick:f,"aria-label":o?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:o?"Remove?":"✕"})]})]})}async function UZ(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function WZ({theaterId:e,onReadMore:t,refreshKey:n}){const i=Z1(),{scope:r,filterText:o}=i,u=Wp(e),h=t0(i,u)?i.installedList:[],p=t0(i,u)&&i.installedLoading,f=DM(),m=v.useRef(null),_=v.useCallback(z=>{const F=Wp(z);Iv(F,[],!0),UZ(z).then(N=>Iv(F,N,!1)).catch(()=>Iv(F,[],!1))},[]);v.useEffect(()=>{_(e)},[e,_,n]),v.useEffect(()=>{(f.status==="done"||f.status==="error")&&_(e)},[f.status,e,_]);const b=v.useCallback(z=>{const F=z;m.current=F;const N={scope:F};F==="project"&&e&&(N.theaterId=e),f.start("/plugins/skills/update",N)},[e,f]),S=v.useCallback((z,F)=>{const N={scope:F,skill:z};F==="project"&&e&&(N.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}).then(()=>_(e)).catch(()=>null)},[e,_]),w=v.useCallback(()=>{m.current&&b(m.current)},[b]),x=r==="project"&&!e?"global":r,C=h.filter(z=>z.scope!==x?!1:o?z.name.toLowerCase().includes(o.toLowerCase()):!0),D=f.status==="running"&&m.current===x;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${x==="project"?" is-active":""}`,onClick:()=>h5("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),c.jsx("button",{type:"button",className:`skills-scope-btn${x==="global"?" is-active":""}`,onClick:()=>h5("global"),children:"Global"})]}),c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:z=>jZ(z.target.value),"aria-label":"Filter installed skills"}),p&&c.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!p&&C.length===0&&c.jsx("div",{className:"skills-empty-state",children:o?"No skills match the filter.":`No ${x} skills installed.`}),c.jsx("div",{className:"skills-card-list",children:C.map(z=>c.jsx(FZ,{skill:z,onReadMore:t,onUpdate:b,onRemove:S,isUpdating:D},`${z.scope}:${z.name}`))})]}),c.jsx(OM,{status:f.status,lines:f.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:f.reset,onRetry:w})]})}function Bv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";n&&!/^(https?:|mailto:|#)/i.test(n)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function qZ({content:e}){const t=v.useMemo(()=>{const r=Hs(e).html,o=new DOMParser().parseFromString(r,"text/html");return Bv(o.body),o.body.innerHTML},[e]),n=v.useRef(null);v.useEffect(()=>{const r=n.current;if(!r)return;Bv(r);const o=new MutationObserver(()=>Bv(r));return o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>o.disconnect()},[t]);const i=v.useCallback(r=>{const o=r.target.closest('[data-action="copy-code"]');if(!o)return;const u=o.closest("pre")?.getAttribute("data-code");if(!u)return;navigator.clipboard?.writeText(u);const h=o.textContent;o.textContent="Copied",window.setTimeout(()=>{o.textContent=h},1200)},[]);return c.jsx("div",{ref:n,className:"markdown-body",onClick:i,dangerouslySetInnerHTML:{__html:t}})}const GZ=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),KZ="Skills run with full agent permissions. Review before use.";function VZ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(GZ)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function YZ({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:r}){const[o,u]=v.useState(null),[h,p]=v.useState(!1),f=v.useRef(null),m=v.useRef(null),_=v.useRef(null);if(v.useEffect(()=>{e&&f.current===null&&(f.current=document.activeElement)},[e]),v.useEffect(()=>{if(!e){u(null);return}p(!0),u(null);let S=!1;return(async()=>{try{let x;if(t){const D={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(D.theaterId=n),x=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)})}else x=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n})});if(S)return;if(!x.ok){p(!1);return}const C=await x.json();S||(u(C.markdown??""),p(!1))}catch{S||p(!1)}})(),()=>{S=!0}},[e,t,n]),v.useEffect(()=>{if(!e)return;const S=w=>{w.key==="Escape"?(w.preventDefault(),i()):w.key==="Tab"&&VZ(w,_.current),w.stopImmediatePropagation()};return m.current?.focus(),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0);const w=f.current;f.current=null,w?.focus?.()}},[e,i]),v.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const b=e.displayPath||e.source||null;return aa.createPortal(c.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:c.jsxs("div",{ref:_,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:S=>S.stopPropagation(),children:[c.jsxs("div",{className:"skills-overlay-header",children:[c.jsx("span",{className:"skills-overlay-title",children:e.name}),b&&c.jsx("span",{className:"skills-overlay-meta",children:b}),c.jsx("button",{ref:m,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"skills-overlay-body",children:[h&&c.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!h&&o===null&&c.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),o!==null&&c.jsx(qZ,{content:o})]}),c.jsxs("div",{className:"skills-overlay-footer",children:[c.jsx("p",{className:"skills-permission-warning",children:KZ}),!t&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),r()},children:"Install"})]})]})}),document.body)}const XZ=3200;function ZZ({message:e,onDismiss:t}){return v.useEffect(()=>{if(!e)return;const n=setTimeout(t,XZ);return()=>clearTimeout(n)},[e,t]),e?c.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function JZ({ctx:e}){const t=Wp(e.theaterId);return c.jsx(QZ,{ctx:e},t)}function QZ({ctx:e}){const{theaterId:t}=e,n=Z1(),{activeTab:i}=n,r=Wp(e.theaterId),[o,u]=v.useState(null),[h,p]=v.useState(null),[f,m]=v.useState(0),_=t0(n,r)?n.installedList.length:0;v.useLayoutEffect(()=>{DZ(r)},[r]);const b=v.useCallback(C=>{u({skill:C,isInstalled:!0})},[]),S=v.useCallback((C,D)=>{u({skill:C,isInstalled:!1,registryId:D})},[]),w=v.useCallback((C,D)=>{p(`Installed ${C} to ${D}`),m(z=>z+1),Rf("installed")},[]),x=v.useCallback(()=>{o?.registryId&&(n0(o.registryId),Rf("find")),u(null)},[o]);return c.jsxs("div",{className:"skills-root",children:[c.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[c.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>Rf("installed"),children:["Installed",_>0?` ${_}`:""]}),c.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>Rf("find"),children:"Find"})]}),i==="installed"?c.jsx(WZ,{theaterId:t,onReadMore:b,refreshKey:f}):c.jsx(zZ,{theaterId:t,onReadMore:S,onInstallSuccess:w}),c.jsx(ZZ,{message:h,onDismiss:()=>p(null)}),c.jsx(YZ,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>u(null),onInstall:x})]})}function eJ(){return c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:c.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 tJ={id:"skills",title:"Skills",icon:eJ,render:e=>c.jsx(JZ,{ctx:e})},nJ={id:"skills",railPanels:[tJ]},iJ=[nJ],IM=[...eY,...eX,...EZ,...iJ],sJ=PM(IM),BM=v.createContext(sJ),rJ=BM.Provider;async function aJ(){const e=[...IM],t=new Set(e.map(i=>i.id)),n=await oJ();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await lJ(i);if(r){if(t.has(r.id)){console.warn(`Skipping external plugin with duplicate id: ${r.id}`);continue}t.add(r.id),e.push(r)}}return PM(e)}function Mc(){return v.useContext(BM)}async function oJ(){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(uJ):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function lJ(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return cJ(n)?n:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function PM(e){const t=new Set,n=[];for(const i of e)for(const r of i.railPanels??[]){if(t.has(r.id)){console.warn(`Skipping rail panel with duplicate id: ${r.id}`);continue}t.add(r.id),n.push(r)}return{plugins:e,operationKinds:e.flatMap(i=>i.operationKinds??[]),settingsSections:e.flatMap(i=>i.settingsSections??[]),notificationKinds:e.flatMap(i=>i.notificationKinds??[]),railPanels:n}}function cJ(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function uJ(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)}let $M=!1;const i0=new Set;function dJ(){return v.useSyncExternalStore(hJ,p5,p5)}function p5(){return $M}function zM(e){$M=fJ(e)?e.fullscreen:!1;for(const t of i0)t()}function m5(){zM({fullscreen:!1})}function hJ(e){return i0.add(e),()=>i0.delete(e)}function fJ(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Object.keys(t).length===1&&typeof t.fullscreen=="boolean"}const HM="(display-mode: fullscreen)",pJ=480,mJ=480,gJ=()=>!0;function _J(){return typeof window<"u"&&window.matchMedia(HM).matches}function vJ(e=gJ){const t=dJ(),[n,i]=v.useState(_J),r=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||r&&t,u=v.useRef(o);u.current=o;const h=v.useRef(!1),p=v.useRef(null),[f,m]=v.useState(o),[_,b]=v.useState(!0),[S,w]=v.useState(!1),x=v.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]),C=v.useCallback(N=>{x(),!(!u.current||h.current)&&(p.current=setTimeout(()=>{p.current=null,u.current&&!h.current&&e()&&b(!1)},N))},[e,x]),D=v.useCallback(()=>{x(),u.current&&b(!0)},[x]),z=v.useCallback(()=>C(mJ),[C]),F=v.useCallback(()=>{const N=!h.current;h.current=N,w(N),N&&(x(),b(!0))},[x]);return v.useEffect(()=>{const N=window.matchMedia(HM),I=()=>i(N.matches);return I(),N.addEventListener("change",I),()=>N.removeEventListener("change",I)},[]),v.useLayoutEffect(()=>(x(),m(o),b(!0),o&&!h.current&&C(pJ),x),[x,o,C]),{isFullscreen:f,isVisible:_,isPinned:S,reveal:D,hideAfterLeave:z,togglePin:F}}function yJ({operationsViewVisible:e}){const t=ir(),n=Mc(),i=LA(),r=WA(),o=SJ(),u=`${o}${o==="⌘"?"":"+"}B`,h=`${o}${o==="⌘"?"⌥":"+Alt+"}B`,p=N0(),f=FT(),m=Qp(),_=t.theaters.find(We=>We.id===t.activeTheaterId)??null,b=_8(t.operations,t.activeOperationId,t.activeTheaterId),S=b?n.plugins.find(We=>We.id===b.pluginId):null,w=typeof b?.payload.cliId=="string"?b.payload.cliId:null,x=typeof b?.payload.cliLabel=="string"?b.payload.cliLabel:w,C=b?S?.operationKinds?.find(We=>We.type===b.type)??null:null,D=b&&S?.renderLaunchIcon?S.renderLaunchIcon({id:w??b.type,type:b.type,title:C?.title??b.type}):null,z=v.useRef(null),F=v.useRef(null),N=v.useRef(null),I=v.useRef(null),j=v.useRef({edge:!1,band:!1}),U=v.useRef(null),G=v.useRef(null),W=v.useRef(null),Z=v.useRef(null),V=v.useRef(null),[O,A]=v.useState(null),[B,M]=v.useState(0),[k,T]=v.useState(!1),[R,$]=v.useState(null),[K,L]=v.useState(null),[q,H]=v.useState(!1),[ne,oe]=v.useState(null),[Se,xe]=v.useState(null),fe=()=>{$(null),L(null),H(!1),oe(null),xe(null)},De=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",rt=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",Ie=v.useCallback(()=>{const We=document.activeElement;return!(We instanceof Node&&(N.current?.contains(We)||I.current?.contains(We)))&&!j.current.edge&&!j.current.band},[]),Ce=vJ(Ie),Me=b?.id??null,je=v.useRef(null);je.current=Me;const ze=K0({currentTitle:b?.title??"",onCommit:We=>{const gt=dk(U.current,je.current);U.current=null,gt&&AT(gt,We).then(()=>Qi(null)).then(ms).catch(()=>{})}});v.useEffect(()=>{!ze.renaming||dk(U.current,Me)||(U.current=null,ze.cancel())},[ze,Me]),v.useEffect(()=>{if(!k)return;const We=new AbortController;return $(null),L(null),H(!0),tD(We.signal).then($).catch(gt=>{We.signal.aborted||L(gt instanceof Error?gt.message:"Unable to load environment details.")}).finally(()=>{We.signal.aborted||H(!1)}),()=>We.abort()},[k]),v.useEffect(()=>{if(!k)return;const We=xt=>{const Tt=xt.target;!(Tt instanceof Node)||z.current?.contains(Tt)||F.current?.contains(Tt)||(T(!1),fe())},gt=xt=>{xt.key==="Escape"&&(T(!1),fe(),z.current?.focus())};return document.addEventListener("pointerdown",We),document.addEventListener("keydown",gt),()=>{document.removeEventListener("pointerdown",We),document.removeEventListener("keydown",gt)}},[k]),v.useEffect(()=>{if(O===null)return;const We=O==="theater"?G:W,gt=Tt=>{const $t=Tt.target;!($t instanceof Node)||We.current?.contains($t)||V.current?.contains($t)||A(null)},xt=Tt=>{Tt.key==="Escape"&&(A(null),We.current?.focus())};return document.addEventListener("pointerdown",gt),document.addEventListener("keydown",xt),()=>{document.removeEventListener("pointerdown",gt),document.removeEventListener("keydown",xt)}},[O]),v.useEffect(()=>{A(null)},[t.activeTheaterId,t.activeOperationId]),v.useLayoutEffect(()=>{if(O===null)return;const We=()=>{const gt=Z.current,xt=V.current;if(!gt||!xt)return;const Tt=O==="operation"?W.current?.offsetLeft??0:0;M(y8(Tt,gt.getBoundingClientRect().left,xt.getBoundingClientRect().width,window.innerWidth))};return We(),window.addEventListener("resize",We),()=>window.removeEventListener("resize",We)},[O]),v.useEffect(()=>{t.channel!=="local"&&(T(!1),$(null),L(null),H(!1),oe(null),xe(null))},[t.channel]);const bt=We=>{navigator.clipboard.writeText(We).then(()=>{oe(We),xe(null)}).catch(()=>{xe(We),oe(null)})},pt=()=>{b&&(A(null),U.current=b.id,ze.begin())},vt=We=>{T(!1),fe(),A(gt=>gt===We?null:We)},lt=We=>{O===null||!v8(We.currentTarget,We.relatedTarget)||A(null)},de=We=>{A(null),G.current?.focus(),We!==t.activeTheaterId&&z0(We)},ut=We=>{A(null),W.current?.focus(),_c(We)},tt=()=>{A(null),G.current?.focus(),UI()},Vt=()=>{_&&(A(null),W.current?.focus(),qI(_.id))},st=g8(t.operations,t.groups,t.activeTheaterId,p.operationOrder),zt=()=>{Ie()&&Ce.hideAfterLeave()},Ft=We=>{const gt=We.relatedTarget;(!(gt instanceof Node)||!N.current?.contains(gt)&&!I.current?.contains(gt))&&!j.current.edge&&!j.current.band&&Ce.hideAfterLeave()},we=()=>{j.current.edge=!0,Ce.reveal()},Oe=()=>{j.current.edge=!1,zt()},cn=()=>{j.current.band=!0,Ce.reveal()},ti=()=>{j.current.band=!1,zt()},ni=Ce.isFullscreen&&!Ce.isVisible;return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:I,type:"button",className:`command-band-edge-reveal${Ce.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:we,onPointerLeave:Oe,onFocus:Ce.reveal,onBlur:Ft,onKeyDown:We=>{We.key==="Tab"&&Ce.reveal()}}),c.jsxs("header",{ref:N,className:`command-band${e?" is-operations":" is-utility"}${Ce.isFullscreen?" is-fullscreen":""}${Ce.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`},"aria-hidden":ni||void 0,inert:ni||void 0,onPointerEnter:cn,onPointerLeave:ti,onFocus:Ce.reveal,onBlur:Ft,children:[c.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[c.jsx(Y8,{className:"command-band-brand"}),t.channel==="local"?c.jsxs("div",{className:"command-band-environment",children:[c.jsxs("button",{ref:z,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":k,onClick:()=>{A(null),fe(),T(We=>!We)},children:[c.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),c.jsx("span",{className:"command-band-local-chip-label",children:De?rt:"Local"})]}),k?c.jsx("div",{ref:F,children:c.jsx(bJ,{environment:R,error:K,loading:q,copiedValue:ne,copyFailedValue:Se,desktopShell:De,onCopy:bt})}):null]}):null,e?c.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>sc(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${u})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${u})`,children:c.jsx(g5,{side:"left"})}):null,c.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:fA,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:c.jsx(wJ,{})})]}),e?c.jsxs("div",{className:"command-band-formation-group",role:"group","aria-label":"Formation view",children:[c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>qT({x:0,y:0,zoom:1}),disabled:t.activeTheaterId===null,"aria-label":"Reset canvas view",title:"Reset canvas view",children:c.jsx(CJ,{})}),c.jsx("span",{className:"command-band-formation-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>B_("grid"),disabled:t.activeTheaterId===null,"aria-pressed":m&&f==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:c.jsx(xJ,{})}),c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>B_("columns"),disabled:t.activeTheaterId===null,"aria-pressed":m&&f==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:c.jsx(kJ,{})}),c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>B_("rows"),disabled:t.activeTheaterId===null,"aria-pressed":m&&f==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:c.jsx(EJ,{})})]}):null,c.jsx("div",{className:"command-band-center",children:e&&_?c.jsxs("div",{ref:Z,className:"command-band-switcher",onBlur:lt,children:[c.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${_.label}`,children:[c.jsxs("button",{ref:G,type:"button",className:`command-band-theater-segment command-band-segment-trigger${O==="theater"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":O==="theater",title:"Switch Theater",onClick:()=>vt("theater"),children:[c.jsx("span",{className:"command-band-theater-mark",children:Y0(_.label)}),c.jsx("span",{className:"command-band-segment-label",children:_.label}),c.jsx($_,{})]}),c.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),b?c.jsxs(c.Fragment,{children:[ze.renaming?c.jsx("input",{ref:ze.inputRef,className:"command-band-rename-input",value:ze.draftTitle,"aria-label":`${b.title} 이름 변경`,onChange:We=>ze.setDraftTitle(We.target.value),onKeyDown:ze.handleKeyDown,onBlur:ze.handleBlur}):c.jsxs("button",{ref:W,type:"button",className:`command-band-operation-name command-band-segment-trigger${O==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":O==="operation",title:"Switch operation — double-click to rename",onClick:()=>vt("operation"),onDoubleClick:pt,children:[c.jsx("span",{className:"command-band-segment-label",children:b.title}),c.jsx($_,{})]}),x?c.jsxs("span",{className:"command-band-operation-attribute",title:C?.title??x,children:[D?c.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:D}):null,x]}):null]}):c.jsxs("button",{ref:W,type:"button",className:`command-band-operation-placeholder command-band-segment-trigger${O==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":O==="operation",title:"Select operation",onClick:()=>vt("operation"),children:[c.jsx("span",{className:"command-band-segment-label",children:"Select operation…"}),c.jsx($_,{})]})]}),O==="theater"?c.jsx(sB,{theaters:t.theaters,operations:t.operations,activeTheaterId:t.activeTheaterId,addingTheater:t.addingTheater,onSelectTheater:de,onAddTheater:tt,style:{left:B},containerRef:V}):null,O==="operation"?c.jsx(rB,{operations:st,activeOperationId:b?.id??null,theaterLabel:_.label,onSelectOperation:ut,onRenameOperation:b?pt:null,onNewOperation:Vt,style:{left:B},containerRef:V}):null]}):null}),c.jsxs("div",{className:"command-band-right",children:[Ce.isFullscreen?c.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:Ce.togglePin,"aria-label":"Pin command band","aria-pressed":Ce.isPinned,title:Ce.isPinned?"Unpin command band":"Pin command band",children:c.jsx(TJ,{})}):null,e?c.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:X0,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${h})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${h})`,children:c.jsx(g5,{side:"right"})}):null]})]})]})}function bJ({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:r,desktopShell:o,onCopy:u}){if(n)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:"Loading environment details…"});if(t)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:t});if(!e)return null;const h=[["Channel",e.channel],["Version",e.version],["Reachable on",`127.0.0.1:${e.effectivePort}`],["Data root",e.dataDir],["Runtime lock",e.lockFile],...o?[["Desktop data",`${e.dataDir}/desktop`]]:[]];return c.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:[c.jsx("div",{className:"command-band-environment-title",children:"Environment"}),h.map(([p,f])=>c.jsxs("div",{className:"command-band-environment-row",children:[c.jsx("span",{children:p}),c.jsx("code",{children:f}),c.jsx("button",{type:"button",onClick:()=>u(f),children:i===f?"Copied":r===f?"Copy failed":"Copy"})]},p)),c.jsx("div",{className:"command-band-environment-footer",children:"Development and published channels keep separate data roots."})]})}function SJ(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function wJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function xJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function CJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function kJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function EJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function g5({side:e}){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function TJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const AJ=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function RJ({state:e}){const[t,n]=v.useState(!1),i=v.useRef(null),r=v.useRef(null),o=v.useRef(null),u=e.theaters.length>0;if(v.useEffect(()=>{if(e.onboardingOpen)return i.current=document.activeElement,r.current?.focus(),()=>{const m=i.current;i.current=null,m?.focus?.()}},[e.onboardingOpen]),v.useEffect(()=>{if(!e.onboardingOpen)return;const m=_=>{t||(_.key==="Escape"?(_.preventDefault(),ku()):_.key==="Tab"&&NJ(_,o.current),_.stopImmediatePropagation())};return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const h=()=>{n(!0)},p=()=>{n(!1)},f=async m=>{n(!1),dA();try{const _=await TT(m),b=await ET(_);hA(b)}catch(_){Cy(_ instanceof Error?_.message:String(_))}};return c.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[c.jsx("button",{type:"button",className:"commissioning-scrim",onClick:ku,"aria-label":"Close setup guide"}),c.jsxs("section",{className:"commissioning-card",ref:o,children:[c.jsxs("header",{className:"commissioning-header",children:[c.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),c.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),c.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),c.jsxs("ol",{className:"commissioning-steps",children:[c.jsxs("li",{className:`commissioning-step commissioning-step--primary ${u?"is-complete":"is-current"}`,children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:u?"✓":"01"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Register a Theater"}),c.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),u?c.jsx(_d,{ref:m=>{r.current=m},className:"commissioning-primary-action",to:"/operations",onClick:ku,children:"Go to Operations →"}):c.jsx("button",{ref:m=>{r.current=m},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:h,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?c.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Open an Operation"}),c.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."}),c.jsx(_d,{className:"commissioning-secondary-link",to:"/operations",onClick:ku,children:"Go to Operations"})]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Monitor Carriers"}),c.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),c.jsxs("footer",{className:"commissioning-footer",children:[c.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),c.jsx("button",{type:"button",className:"commissioning-skip",onClick:ku,children:"Skip for now"})]})]}),c.jsx(wA,{open:t,onCancel:p,onConfirm:f})]})}function NJ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(AJ)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}let s0=null;function LJ(e){s0=e}function MJ(){const e=s0;return s0=null,e}const jJ=[{id:"instrument",label:"Instrument"},{id:"maritime",label:"Maritime"},{id:"carbon",label:"Carbon"}];function OJ(e){return e.startsWith(">")}function _5(e){return e.slice(1)}function DJ(e,t){const n=[],i=e.theaters.find(r=>r.id===e.activeTheaterId)??null;for(const r of e.theaters)n.push({commandId:`switch-theater:${r.id}`,label:`Switch theater: ${r.label}`,current:r.id===e.activeTheaterId,action:{kind:"switch-theater",theaterId:r.id}});i&&n.push({commandId:"new-operation",label:`New Operation in ${i.label}`,current:!1,action:{kind:"new-operation"}});for(const r of t)n.push({commandId:`open-rail-panel:${r.id}`,label:`Open panel: ${r.title}`,current:!1,action:{kind:"open-rail-panel",panelId:r.id}});n.push({commandId:"toggle-rail",label:"Toggle Activity Rail",current:!1,action:{kind:"toggle-rail"}}),n.push({commandId:"toggle-sidebar",label:"Toggle sidebar",current:!1,action:{kind:"toggle-sidebar"}});for(const r of jJ)n.push({commandId:`switch-theme:${r.id}`,label:`Switch theme: ${r.label}`,current:r.id===e.activeTheme,action:{kind:"switch-theme",theme:r.id}});return n.push({commandId:"open-settings",label:"Open Settings",current:!1,action:{kind:"open-settings"}}),n.push({commandId:"open-keyboard-shortcuts",label:"Open keyboard shortcuts",current:!1,action:{kind:"open-keyboard-shortcuts"}}),e.releaseNotes.length>0&&n.push({commandId:"whats-new",label:"What's new",current:!1,action:{kind:"whats-new"}}),n}function IJ(e,t){const n=$0(t);return n.length===0?e:e.filter(i=>{const r=i.label.toLocaleLowerCase();return n.every(o=>r.includes(o))})}const BJ="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",v5="operation-search-listbox",FM="__unassigned__",y5="operation-search-heading-commands";function PJ({state:e,railPanels:t}){const n=Tc(),i=vs(),[r,o]=v.useState(""),[u,h]=v.useState(0),p=v.useRef(null),f=v.useRef(null),m=v.useRef(null),_=v.useRef(new Map),b=OJ(r),S=v.useMemo(()=>r8(e),[e]),w=v.useMemo(()=>xI(S,r),[S,r]),x=v.useMemo(()=>CI(w),[w]),C=v.useMemo(()=>DJ(e,t),[e,t]),D=v.useMemo(()=>b?IJ(C,_5(r)):C,[b,C,r]),z=v.useMemo(()=>$0(b?_5(r):r),[b,r]),F=b?D.length:w.length,N=b5(u,F),I=b?D[N]?.commandId:w[N]?.operationId,j=I===void 0?void 0:b?w5(I):S5(I);if(v.useEffect(()=>{if(!e.operationSearchOpen)return;m.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const Z=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>p.current?.focus(),0),()=>{document.body.style.overflow=Z,m.current?.focus()}},[e.operationSearchOpen]),v.useEffect(()=>{if(!e.operationSearchOpen){o(""),h(0);return}h(0)},[e.operationSearchOpen,r]),v.useEffect(()=>{!e.operationSearchOpen||I===void 0||_.current.get(I)?.scrollIntoView({block:"nearest"})},[I,e.operationSearchOpen]),!e.operationSearchOpen)return null;const U=Z=>{m.current=null,_c(Z),n("/operations"),tf()},G=Z=>{const V=Z.action;switch(V.kind){case"switch-theater":{if(Z.current)break;m.current=null,z0(V.theaterId),n("/operations");break}case"new-operation":{m.current=null,i.pathname.startsWith("/operations")||n("/operations"),GI();break}case"open-rail-panel":{i.pathname.startsWith("/operations")||n("/operations"),dB(V.panelId),FA(!0);break}case"toggle-rail":{i.pathname.startsWith("/operations")||n("/operations"),m.current=document.querySelector(".command-band-rail-toggle"),X0();break}case"toggle-sidebar":{i.pathname.startsWith("/operations")||n("/operations"),m.current=document.querySelector(".command-band-sidebar-toggle"),sc(!vp().collapsed);break}case"switch-theme":{if(Z.current)break;const O=e.activeTheme;gc(V.theme),io("theme",V.theme).then(A=>{A||gc(O)});break}case"open-settings":{m.current=null,n("/settings");break}case"open-keyboard-shortcuts":{LJ(m.current),m.current=null,VI();break}case"whats-new":{pA();break}}tf()},W=Z=>{if(Z.key==="Escape"){Z.preventDefault(),tf();return}if(Z.key==="ArrowDown"||Z.key==="ArrowUp"){Z.preventDefault(),h(V=>b5(V+(Z.key==="ArrowDown"?1:-1),F));return}if(Z.key==="Enter"){if(b){const O=D[N];if(!O)return;Z.preventDefault(),G(O);return}const V=w[N];if(!V)return;Z.preventDefault(),U(V.operationId);return}Z.key==="Tab"&&FJ(Z,f.current)};return c.jsx("div",{className:"operation-search-overlay",onMouseDown:Z=>{Z.target===Z.currentTarget&&tf()},children:c.jsxs("section",{ref:f,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":b?"Console commands":"Operation quick search",tabIndex:-1,onKeyDown:W,children:[c.jsxs("div",{className:"operation-search-field",children:[c.jsx(UJ,{}),c.jsx("input",{ref:p,id:"operation-search-input",type:"search",value:r,onChange:Z=>o(Z.target.value),placeholder:"Search Operations — type > for commands",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":v5,"aria-activedescendant":j,"aria-autocomplete":"list",spellCheck:!1}),c.jsx("kbd",{children:"esc"})]}),c.jsx("div",{id:v5,className:"operation-search-results",role:"listbox","aria-label":b?"Command results":"Operation results",children:b?D.length>0?c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":y5,children:[c.jsx("h2",{id:y5,className:"operation-search-section-heading",children:"Commands"}),D.map((Z,V)=>{const O=V===N;return c.jsxs("button",{id:w5(Z.commandId),ref:A=>{A?_.current.set(Z.commandId,A):_.current.delete(Z.commandId)},type:"button",className:`operation-search-result ${O?"is-active":""}`,role:"option","aria-selected":O,onMouseEnter:()=>h(V),onClick:()=>G(Z),children:[c.jsx("span",{className:"operation-search-command-glyph","aria-hidden":"true",children:"›"}),c.jsx("span",{className:"operation-search-result-text",children:c.jsx("strong",{children:Nf(Z.label,z)})}),Z.current?c.jsx("span",{className:"operation-search-theater",children:"current"}):null]},Z.commandId)})]}):c.jsx("p",{className:"operation-search-empty",children:"No matching commands."}):x.length>0?x.map(Z=>{const V=zJ(Z.theaterId);return c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":V,children:[c.jsx("h2",{id:V,className:"operation-search-section-heading",children:Nf(Z.theaterLabel,z)}),Z.entries.map(O=>{const A=w.indexOf(O),B=A===N;return c.jsxs("button",{id:S5(O.operationId),ref:M=>{M?_.current.set(O.operationId,M):_.current.delete(O.operationId)},type:"button",className:`operation-search-result ${B?"is-active":""}`,role:"option","aria-selected":B,onMouseEnter:()=>h(A),onClick:()=>U(O.operationId),children:[c.jsxs("span",{className:"operation-search-result-text",children:[c.jsx("strong",{children:Nf(O.operationName,z)}),c.jsx("small",{children:$J(O)})]}),c.jsx("span",{className:"operation-search-theater",children:Nf(O.theaterLabel,z)})]},O.operationId)})]},Z.theaterId??FM)}):c.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function b5(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function $J(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function zJ(e){return`operation-search-heading-${J1(e??FM)}`}function S5(e){return`operation-search-option-${J1(e)}`}function w5(e){return`operation-search-command-${J1(e)}`}function J1(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Nf(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=HJ(e,t,i);if(!r){n.push(e.slice(i));break}r.start>i&&n.push(e.slice(i,r.start)),n.push(c.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),i=r.end}return n}function HJ(e,t,n){const i=e.toLocaleLowerCase();let r=null;for(const o of t){const u=i.indexOf(o,n);u!==-1&&(!r||u<r.start)&&(r={start:u,end:u+o.length})}return r}function FJ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(BJ)).filter(o=>o.offsetParent!==null);if(n.length===0)return;const i=n[0],r=n[n.length-1];if(e.shiftKey&&document.activeElement===i){e.preventDefault(),r?.focus();return}!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i?.focus())}function UJ(){return c.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:c.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 WJ({open:e,title:t,message:n,tone:i="info",onDismiss:r}){return e?c.jsx("div",{className:"app-toast-host",children:c.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[c.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),c.jsxs("div",{className:"app-toast-body",children:[c.jsx("p",{className:"app-toast-title",children:t}),n?c.jsx("p",{className:"app-toast-message",children:n}):null]}),r?c.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}let uc=null,od=0;function UM(e){uc?.abort();const t=new AbortController,n=++od;return uc=t,NI(),nD({...e,signal:t.signal}).then(i=>{n===od&&LI(i)}).catch(i=>{t.signal.aborted||n!==od||MI(i instanceof Error?i.message:String(i))}).finally(()=>{n===od&&(uc=null)})}function qJ(){uc!==null&&(uc.abort(),uc=null,od+=1)}function WM(e,t=GM()){return qM(e,t)}function qM(e,t=GM()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function GM(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const KM=[{id:"fleet-cli",label:"Fleet CLI"},{id:"fleet-console",label:"Fleet Console"},{id:"fleet-desktop",label:"Fleet Desktop"},{id:"fleet-plugin",label:"Fleet Plugin"},{id:"fleet-core",label:"Fleet Core"}],Pv={id:"overview",label:"Overview"},GJ={id:"all-updates",label:"All updates"},KJ={id:"other-updates",label:"Other updates"};function VM(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=KM.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[Pv,GJ]:t?[Pv,...n,KJ]:[Pv,...n]}function VJ(e,t){return t==="overview"?[]:e.sections.map(n=>({...n,items:n.items.filter(i=>t==="all-updates"||t==="other-updates"?i.product===void 0:i.product===t)})).filter(n=>n.items.length>0)}function YJ(e){const t=KM.flatMap(i=>{const r=e.sections.flatMap(o=>o.items.filter(u=>u.product===i.id));return r.length===0?[]:[{id:i.id,label:i.label,count:r.length,summary:r[0].text}]}),n=e.sections.flatMap(i=>i.items.filter(r=>r.product===void 0));return n.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:n.length,summary:n[0].text}]}function XJ(e,t){return VM(e).some(n=>n.id===t)}const ZJ=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Gu=10;function JJ({state:e}){const t=v.useRef(null),n=v.useRef([]),i=v.useRef(null),r=v.useRef(null),o=v.useRef(new Map),[u,h]=v.useState("overview"),p=Jp(),f=WM(p.state?.language??"auto"),m=e.selectedReleaseNoteKey??Ku(e.releaseNotes[0]?.version??"",0),_=e.releaseNotes.findIndex((G,W)=>Ku(G.version,W)===m),b=e.releaseNotes[_]??e.releaseNotes[0],S=b?Ku(b.version,_>=0?_:0):"",w=b?VM(b):[];v.useEffect(()=>{h("overview")},[S]),v.useEffect(()=>{b&&!XJ(b,u)&&h("overview")},[u,b]),v.useEffect(()=>{const G=W=>{const Z=W.target instanceof HTMLElement?W.target:null;if(!Z||Z.closest(".whatsnew-card"))return;const V=n.current.filter(O=>O!==Z&&O.isConnected);n.current=[...V.slice(-4),Z]};return document.addEventListener("focusin",G,!0),()=>document.removeEventListener("focusin",G,!0)},[]);const x=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen||e.keyboardShortcutsOpen;if(e.whatsNewOpen&&!x&&t.current===null&&(t.current=document.activeElement),v.useEffect(()=>{if(!e.whatsNewOpen||x)return;const G=W=>{iQ(W)||(W.key==="Escape"?(W.preventDefault(),nf()):rQ(W,r.current,h)?W.preventDefault():W.key==="Tab"&&sQ(W,r.current),W.stopImmediatePropagation())};return i.current?.focus(),window.addEventListener("keydown",G,!0),()=>{window.removeEventListener("keydown",G,!0);const W=t.current?.isConnected?t.current:[...n.current].reverse().find(Z=>Z.isConnected);t.current=null,W?.focus?.()}},[e.whatsNewOpen,x]),!e.whatsNewOpen||x||b===void 0)return null;const C=()=>{UM({force:!0,locale:f})},D=async G=>{await io("language",G)},z=Math.max(1,Math.ceil(e.releaseNotes.length/Gu)),F=Math.min(z-1,Math.floor((_>=0?_:0)/Gu)),N=F*Gu,I=e.releaseNotes.slice(N,N+Gu),j=G=>{const W=F+G;if(W<0||W>=z)return;const Z=W*Gu,V=e.releaseNotes[Z];V&&lk(Ku(V.version,Z))},U=G=>{h(G),requestAnimationFrame(()=>o.current.get(G)?.focus())};return c.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[c.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:nf,"aria-label":"Close What's new"}),c.jsxs("section",{className:"whatsnew-card",ref:r,children:[c.jsxs("header",{className:"whatsnew-header",children:[c.jsxs("div",{className:"whatsnew-heading-row",children:[c.jsx("h2",{id:"whatsnew-title",children:"What's new"}),c.jsxs("span",{className:"whatsnew-version-badge",children:["v",b.version]})]}),c.jsxs("div",{className:"whatsnew-meta-row",children:[b.date?c.jsxs("time",{className:"whatsnew-date",dateTime:b.date,children:["Released ",b.date]}):c.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?c.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),c.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:nf,"aria-label":"Close What's new",children:"x"}),c.jsxs("div",{className:"whatsnew-body",children:[c.jsxs("div",{className:"whatsnew-version-selector",children:[c.jsx(Ni,{label:"Release version",className:"whatsnew-version-select",value:S,onChange:lk,options:I.map((G,W)=>{const Z=N+W;return{value:Ku(G.version,Z),label:`${G.version==="Unreleased"?"Unreleased":`v${G.version}`}${G.date?` · ${G.date}`:""}`}})}),z>1?c.jsxs("div",{className:"whatsnew-pagination",children:[c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>j(-1),disabled:F===0,"aria-label":"Newer versions",children:"‹"}),c.jsxs("span",{className:"whatsnew-page-status",children:[F+1," / ",z]}),c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>j(1),disabled:F>=z-1,"aria-label":"Older versions",children:"›"})]}):null,c.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(G=>c.jsx("button",{type:"button",className:f===G?"is-active":"","aria-pressed":f===G,disabled:p.savingField==="language",onClick:()=>{D(G)},children:G==="en"?"EN":"한국어"},G))}),c.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:C,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),c.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(G=>c.jsx("button",{ref:W=>{W?o.current.set(G.id,W):o.current.delete(G.id)},id:`whatsnew-tab-${G.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":G.id,"aria-selected":u===G.id,"aria-controls":"whatsnew-tab-panel",tabIndex:u===G.id?0:-1,onClick:()=>h(G.id),children:G.label},G.id))}),e.releaseNotesError?c.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,c.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${u}`,children:u==="overview"?c.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:YJ(b).map(G=>c.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>U(G.id),children:[c.jsx("span",{className:"whatsnew-overview-label",children:G.label}),c.jsxs("span",{className:"whatsnew-overview-count",children:[G.count," ",G.count===1?"update":"updates"]}),c.jsx("span",{className:"whatsnew-overview-summary",children:G.summary})]},G.id))}):VJ(b,u).map((G,W)=>c.jsx(QJ,{section:G,index:W},G.heading))})]}),c.jsx("footer",{className:"whatsnew-footer",children:c.jsx("button",{type:"button",className:"whatsnew-done",onClick:nf,children:"Close"})})]})]})}function QJ({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return c.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[c.jsx("h3",{children:c.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),c.jsx("ul",{children:e.items.map((r,o)=>c.jsx("li",{children:c.jsx(eQ,{item:r})},`${r.text}:${o}`))})]})}function eQ({item:e}){return c.jsxs(c.Fragment,{children:[e.packageTags.map((t,n)=>c.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),c.jsx("span",{children:e.text})]})}function Ku(e,t){return`${e}:${t}`}const tQ=new Set(["ArrowDown","ArrowUp","Enter"," "]);function nQ(e){return e instanceof HTMLElement&&e.dataset.open==="true"}function iQ(e){const t=e.target instanceof Element?e.target:null;if(!t)return!1;if(t.closest('.fc-select__popup[data-open="true"]'))return!0;const n=t.closest(".fc-select__trigger");if(n instanceof HTMLButtonElement){const i=n.getAttribute("aria-controls");return i&&nQ(document.getElementById(i))?!0:tQ.has(e.key)}return!1}function sQ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(ZJ)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function rQ(e,t,n){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const i=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!i||!t)return!1;const r=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=r.indexOf(i);if(o<0||r.length===0)return!1;const u=e.key==="Home"?0:e.key==="End"?r.length-1:(o+(e.key==="ArrowRight"?1:-1)+r.length)%r.length,h=r[u],p=h.dataset.tabId;return p?(n(p),h.focus(),!0):!1}function YM(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function aQ(e,t=window){const n=i=>{if(!(CA()||YM(t.document))){if((i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"){i.preventDefault(),i.stopImmediatePropagation(),e.toggleOperationSearch();return}if((i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&i.altKey&&!i.shiftKey&&(i.metaKey||i.key.toLowerCase()==="b")){i.preventDefault(),i.stopImmediatePropagation(),e.toggleRailChrome();return}(i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&!i.altKey&&!i.shiftKey&&(i.preventDefault(),i.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)}function wm(e=()=>{}){return{...nT(e),notifications:{emit:n=>zI(n),dismiss:n=>t8(n)},status:{set:(n,i)=>$I(n,i),clear:n=>uA(n)}}}async function oQ(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await lQ(t),cQ(await t.json(),t.status).routes}async function lQ(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new pn(e.status,t)}function cQ(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new pn(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>uQ(i,t))}}function uQ(e,t){const n=e;if(!n||typeof n!="object"||typeof n.method!="string"||typeof n.path!="string"||typeof n.summary!="string"||typeof n.category!="string"||typeof n.gate!="string")throw new pn(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const r0=new Set;let a0={loading:!1,state:null,error:null};function dQ(){return v.useSyncExternalStore(hQ,x5,x5)}function x5(){return a0}function hQ(e){return r0.add(e),()=>{r0.delete(e)}}async function fQ(e){$v({loading:!0,error:null});try{const t=await oQ(e);$v({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;$v({loading:!1,error:pQ(t)})}}function $v(e){a0={...a0,...e};for(const t of r0)t()}function pQ(e){return e instanceof Error?e.message:String(e)}function mQ(){const e=dQ(),[t,n]=v.useState(!0),i=v.useMemo(()=>vQ(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return v.useEffect(()=>{const u=new AbortController;return fQ(u.signal),()=>u.abort()},[]),c.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[c.jsx("div",{className:`backend-api-control settings-disclosure-control ${t?"is-expanded":""}`,children:c.jsxs("div",{className:"settings-disclosure-head",children:[c.jsxs("div",{className:"backend-api-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),c.jsx("p",{className:"global-settings-help",children:r>0?`${r} loopback route${r===1?"":"s"} across ${o} categor${o===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),c.jsx("div",{className:"settings-disclosure-actions",children:c.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":t,onClick:()=>n(u=>!u),children:t?"Hide":"Show"})})]})}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?c.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?c.jsxs("div",{className:"backend-api-groups",children:[i.length>0?i.map(u=>c.jsx(gQ,{group:u},u.category)):null,e.state&&i.length===0?c.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,c.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 gQ({group:e}){return c.jsxs("div",{className:"backend-api-group",children:[c.jsxs("div",{className:"backend-api-group-head",children:[c.jsx("span",{children:e.category}),c.jsx("span",{children:e.entries.length})]}),c.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>c.jsx(_Q,{entry:t},`${t.method}:${t.path}`))})]})}function _Q({entry:e}){return c.jsxs("div",{className:"backend-api-row",children:[c.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),c.jsx("code",{className:"backend-api-path",children:e.path}),c.jsx("span",{className:"backend-api-summary",children:e.summary}),c.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function vQ(e){const t=new Map;for(const n of e){const i=n.category.trim()||"Uncategorized",r=t.get(i);r?r.push(n):t.set(i,[n])}return Array.from(t.entries()).map(([n,i])=>({category:n,entries:i}))}const yQ=[{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)"]}],bQ=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],SQ=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],wQ=1024,xQ=65535,C5=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function CQ(){const e=Jp(),t=e.state,n=e.savingField!==null,[i,r]=v.useState("general"),o=vs(),u=Tc(),h=Mc(),p=TQ(h.plugins),f=AQ(p),m=_=>{r(_),u({pathname:"/settings",search:_==="general"?"":`?section=${encodeURIComponent(_)}`})};return v.useEffect(()=>{const _=new AbortController;return DD(_.signal),()=>_.abort()},[]),v.useEffect(()=>{const _=new URLSearchParams(o.search).get("section"),b=new Set([...C5.map(w=>w.id),...p.map(w=>w.id)]),S=_&&b.has(_)?_:"general";r(S),_&&_!==S&&u({pathname:"/settings",search:""},{replace:!0})},[o.search,u,p]),c.jsxs("main",{className:"global-settings-page",children:[c.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[c.jsxs("div",{children:[c.jsx("p",{className:"bridge-kicker",children:"Console"}),c.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),c.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?"Saving…":""})]}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,c.jsxs("section",{className:"global-settings-grid",children:[c.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[c.jsx("p",{className:"global-settings-nav-group",children:"Console"}),C5.map(_=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${_.id===i?"is-active":""}`,"aria-pressed":_.id===i,onClick:()=>m(_.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:_.label}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:_.eyebrow})]},_.id)),p.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),f.map(_=>c.jsxs("div",{className:"global-settings-plugin-group",children:[c.jsx("p",{className:"global-settings-plugin-heading",children:_.pluginLabel}),_.sections.map(b=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>m(b.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:b.sectionTitle}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:b.pluginLabel})]},b.id))]},_.pluginId))]}):null]}),c.jsx("div",{className:"global-settings-detail",children:EQ(i,t,n,p)},i)]})]})}function kQ({render:e}){return c.jsx(c.Fragment,{children:e()})}function EQ(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?c.jsx(cp,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:c.jsx(kQ,{render:r.render})}):c.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return c.jsxs(c.Fragment,{children:[c.jsx(NQ,{state:t,saving:n}),c.jsx(LQ,{state:t,saving:n}),c.jsx(MQ,{state:t,saving:n})]});case"backend-api":return c.jsx(mQ,{})}}function TQ(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:RQ(t.id),sectionTitle:n.title,render:n.render})))}function AQ(e){const t=[];for(const n of e){const i=t.at(-1);if(i?.pluginId===n.pluginId){t[t.length-1]={...i,sections:[...i.sections,n]};continue}t.push({pluginId:n.pluginId,pluginLabel:n.pluginLabel,sections:[n]})}return t}function RQ(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function NQ({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(hc().savingField!==null)return;const o=n;gc(r),io("theme",r).then(u=>{u||gc(o)})};return c.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),c.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),c.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:yQ.map(r=>{const o=r.id===n;return c.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>i(r.id),children:[c.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:r.swatch.map(u=>c.jsx("i",{style:{background:u}},u))}),c.jsx("span",{className:"theme-card-label",children:r.label}),c.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:o?c.jsx(IQ,{}):null})]},r.id)})})]}),c.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function LQ({state:e,saving:t}){const n=e?.uiFont??ld,[i,r]=v.useState([]),[o,u]=v.useState(!0),[h,p]=v.useState(null);v.useEffect(()=>{const _=new AbortController;return KA({signal:_.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),p(null)}).catch(b=>{_.signal.aborted||(r([]),p(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{_.signal.aborted||u(!1)}),()=>_.abort()},[]);const f=_=>{if(hc().savingField!==null)return;const b=n;wy(_),io("uiFont",_).then(S=>{S||wy(b)})},m=_=>{const b=_.source==="builtin"?{source:"builtin",id:_.id,size:n.size}:{source:"system",familyName:_.familyName,size:n.size};f(b)};return c.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),c.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),c.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||n.source==="builtin"&&n.id==="manrope"&&n.size===nc.defaultValue,onClick:()=>f(ld),children:"Reset to Fleet default"})]}),c.jsx(qA,{builtIns:fp.map(({id:_,label:b,family:S,aliases:w,description:x})=>({id:_,label:b,family:S,aliases:w,description:x})),installedFonts:i,selected:n.source==="builtin"?{source:"builtin",id:n.id}:{source:"system",familyName:n.familyName},selectedSystemFont:n.source==="system"?n.familyName:null,fallbackStack:LT(ld),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:nc,loading:o,error:h,disabled:!e||t,onSelectionChange:m,onSizeCommit:_=>f({...n,size:_})}),c.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function MQ({state:e,saving:t}){const n=ir();return c.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?c.jsxs(c.Fragment,{children:[c.jsx(DQ,{state:e,saving:t,consoleState:n}),c.jsx(jQ,{state:e,saving:t}),c.jsx(OQ,{state:e,saving:t})]}):c.jsx("p",{className:"global-settings-help",children:"Loading settings."}),c.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function jQ({state:e,saving:t}){return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Panel Motion"}),c.jsx("p",{className:"global-settings-help",children:"Stop panel animations when panels open, move, minimize, and restore. When off, your operating system's Reduce Motion setting is followed."})]}),c.jsx("button",{type:"button","aria-pressed":e.reducePanelMotion,className:`global-settings-toggle ${e.reducePanelMotion?"is-on":""}`,disabled:t,onClick:()=>{io("reducePanelMotion",!e.reducePanelMotion)},children:"Reduce panel motion"})]})}function OQ({state:e,saving:t}){return c.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),c.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),c.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:SQ.map(n=>{const i=e.language===n.id;return c.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,disabled:t,onClick:()=>{io("language",n.id)},children:n.label},n.id)})}),c.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function DQ({state:e,saving:t,consoleState:n}){const[i,r]=v.useState(e.consoleStaticPort?.toString()??""),o=n.effectivePort,u=n.portMode==="static"&&!n.portHonored,h=n.requestedPort,p=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=i.trim(),m=Number(f),_=f.length>0,b=_&&k5(m),S=e.consolePortMode==="static"&&_&&!b;return v.useEffect(()=>{r(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),c.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",c.jsx("span",{className:"new-badge",children:"New"})]}),c.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."})]}),c.jsxs("div",{className:"console-port-control",children:[c.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:bQ.map(w=>{const x=e.consolePortMode===w.id;return c.jsx("button",{type:"button","aria-pressed":x,className:`segmented-option ${x?"is-active":""}`,disabled:t,onClick:()=>{io("consolePortMode",w.id)},children:w.label},w.id)})}),c.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:c.jsxs("div",{className:"console-port-reveal-inner",children:[c.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),c.jsx("input",{id:"console-static-port-input",className:`console-port-input ${S?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:i,disabled:t,"aria-invalid":S,"aria-describedby":"console-static-port-hint",onChange:w=>{const x=w.target.value;r(x);const C=Number(x.trim());k5(C)&&io("consoleStaticPort",C)}}),c.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${S?"is-invalid":""}`,children:"1024–65535"})]})}),c.jsxs("div",{className:`console-port-effective ${u?"is-fallback":""}`,"aria-live":"polite",children:[c.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),c.jsxs("div",{children:[c.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),c.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",c.jsx("span",{children:o||"..."}),u?" · Dynamic":""]})]})]}),u&&h?c.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",c.jsx("strong",{children:h})," was unavailable — the console fell back to a ",c.jsx("strong",{children:"Dynamic"})," port and is running on ",c.jsxs("strong",{children:["127.0.0.1:",o||"..."]}),"."," ",p?c.jsxs(c.Fragment,{children:["Next restart will try ",c.jsx("strong",{children:e.consoleStaticPort}),"."]}):c.jsx(c.Fragment,{children:"Next restart will use a dynamic port."})]}):null,c.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function k5(e){return Number.isInteger(e)&&e>=wQ&&e<=xQ}function IQ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 BQ(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function Nd(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function PQ(e,t){return{...BQ(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const $Q=600,E5=360,T5="cubic-bezier(0.4, 0.14, 0.2, 1)";function XM(e){if(typeof document>"u"||O0())return;const t=ZM(e);if(!qp(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=JM(e);qp(i)&&QM(n,i.getBoundingClientRect(),()=>zQ(i))})}function o0(e){if(typeof document>"u"||O0())return;const t=JM(e);if(!qp(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=ZM(e);qp(i)&&QM(n,i.getBoundingClientRect())})}function ZM(e){return document.querySelector(`.canvas-operation[data-operation-id="${Q1(e)}"]`)}function JM(e){return document.querySelector(`[data-side-bar-chip-id="${Q1(e)}"]`)}function qp(e){if(!e)return!1;const t=e.getBoundingClientRect();return t.width<=0||t.height<=0?!1:getComputedStyle(e).visibility!=="hidden"}function Q1(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}function QM(e,t,n){if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return;const i=document.createElement("div");if(i.className="panel-motion-ghost",i.setAttribute("aria-hidden","true"),i.style.left=`${e.left}px`,i.style.top=`${e.top}px`,i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,typeof i.animate!="function")return;document.body.appendChild(i);const{duration:r,easing:o}=HQ();let u=!1,h=null;const p=m=>{u||(u=!0,h!==null&&window.clearTimeout(h),i.remove(),m&&n?.())};let f;try{f=i.animate([{transform:"translate(0, 0) scale(1, 1)",opacity:.9},{transform:`translate(${t.left-e.left}px, ${t.top-e.top}px) scale(${t.width/e.width}, ${t.height/e.height})`,opacity:0}],{duration:r,easing:o})}catch{p(!1);return}h=window.setTimeout(()=>p(!0),r+120),f.onfinish=()=>p(!0),f.oncancel=()=>p(!1)}function zQ(e){e.classList.add("is-arrival-pulse"),window.setTimeout(()=>e.classList.remove("is-arrival-pulse"),$Q)}function HQ(){try{const e=getComputedStyle(document.documentElement);return{duration:FQ(e.getPropertyValue("--duration-slow"))??E5,easing:e.getPropertyValue("--ease-glide").trim()||T5}}catch{return{duration:E5,easing:T5}}}function FQ(e){const t=e.trim(),n=/^(\d+(?:\.\d+)?)(ms|s)$/.exec(t);if(!n)return null;const i=Number.parseFloat(n[1]);return n[2]==="s"?i*1e3:i}const A5=256,R5=176,zv=12,Lf=220,e3="fleet-console.map.radarCollapsed";function UQ({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:r,onJump:o}){const u=v.useRef(null),h=v.useRef(!1),p=v.useRef(null),[f,m]=v.useState(WQ),_=Qp();if(v.useEffect(()=>{if(_){p.current===null&&(p.current=f,m(!0));return}p.current!==null&&(m(p.current),p.current=null)},[f,_]),r.width<=0||r.height<=0||i.zoom<=0)return null;const b=[...Object.entries(e).map(([k,T])=>({id:k,x:T.x,y:T.y,width:T.width,height:T.height})),...Object.entries(t).map(([k,T])=>({id:k,x:T.geometry.x,y:T.geometry.y,width:T.geometry.width,height:T.geometry.height}))];if(b.length===0)return null;const S=()=>{m(k=>{const T=!k;return _||qQ(T),T})};if(f)return c.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:c.jsx(KQ,{})});const w=A5-zv*2,x=R5-zv*2,C={x:-i.x/i.zoom,y:-i.y/i.zoom,width:r.width/i.zoom,height:r.height/i.zoom};let D=Math.min(C.x,...b.map(k=>k.x)),z=Math.min(C.y,...b.map(k=>k.y)),F=Math.max(C.x+C.width,...b.map(k=>k.x+k.width)),N=Math.max(C.y+C.height,...b.map(k=>k.y+k.height));D-=Lf,z-=Lf,F+=Lf,N+=Lf;const I=F-D,j=N-z,U=Math.min(w/I,x/j),G=(w-I*U)/2,W=(x-j*U)/2,Z=k=>G+(k-D)*U,V=k=>W+(k-z)*U,O=k=>{const T=u.current?.getBoundingClientRect();if(!T)return;const R=k.clientX-T.left,$=k.clientY-T.top;o({x:D+(R-G)/U,y:z+($-W)/U})},A=k=>{k.stopPropagation(),h.current=!0,k.currentTarget.setPointerCapture(k.pointerId),O(k)},B=k=>{h.current&&(k.stopPropagation(),O(k))},M=k=>{h.current=!1;try{k.currentTarget.releasePointerCapture(k.pointerId)}catch{}};return c.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:A5,height:R5},children:[c.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),c.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:c.jsx(GQ,{})}),c.jsxs("div",{ref:u,className:"canvas-minimap-inner",style:{inset:zv},onPointerDown:A,onPointerMove:B,onPointerUp:M,onPointerCancel:M,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[b.map(k=>c.jsx("div",{className:"canvas-minimap-operation",style:{left:Z(k.x),top:V(k.y),width:Math.max(2,k.width*U),height:Math.max(2,k.height*U),...n?.[k.id]?{"--user-accent":n[k.id]}:{}}},k.id)),c.jsx("div",{className:"canvas-minimap-view",style:{left:Z(C.x),top:V(C.y),width:C.width*U,height:C.height*U}})]})]})}function WQ(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(e3)==="true"}catch{return!1}}function qQ(e){if(!(typeof window>"u"))try{window.localStorage.setItem(e3,String(e))}catch{}}function GQ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function KQ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),c.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function VQ({viewport:e}){return c.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[c.jsx("div",{className:"operations-canvas-sea"}),c.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 YQ=["n","ne","e","se","s","sw","w","nw"],Hv=320,Fv=200,XQ=1500;function ZQ({operation:e,active:t,geometry:n,zoom:i,status:r,minimized:o=!1,maximized:u=!1,renderHidden:h=!1,focusLayerTarget:p=!1,topEdge:f=!1,interactionDisabled:m=!1,accentKey:_=null,children:b,onActivate:S,onClose:w,onMinimize:x,onMaximize:C,onRename:D,onSetAccent:z,onGeometryChange:F,onGeometryCommit:N,onRenderHiddenFocus:I}){const j=v.useRef(null),U=v.useRef(null),G=v.useRef(null),W=v.useRef(null),Z=v.useRef(null),V=v.useRef(n),O=v.useRef(!1),[A,B]=v.useState(null),[M,k]=v.useState(!1),[T,R]=v.useState(!1),$=e.title,K=K0({currentTitle:e.title,onBegin:()=>{ne()},onCommit:we=>{D(we),O.current=!0}}),L=_?Bs(_):null,q=["canvas-operation",t?"is-active":"",o?"is-minimized":"",u?"is-maximized":"",f?"is-top-edge":"",T?"is-dragging":"",QQ(r)].filter(Boolean).join(" ");v.useEffect(()=>()=>{Z.current!==null&&window.clearTimeout(Z.current)},[]),v.useEffect(()=>{if(K.renaming||!O.current)return;O.current=!1;const we=window.requestAnimationFrame(()=>U.current?.focus());return()=>window.cancelAnimationFrame(we)},[K.renaming]),v.useLayoutEffect(()=>{if(!h||typeof document>"u")return;const we=A!==null;we&&B(null),(we||j.current?.contains(document.activeElement))&&I?.()},[A,h,I]);const H=()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},ne=()=>{H(),k(!1)},oe=()=>{H(),k(!0),Z.current=window.setTimeout(()=>{Z.current=null,k(!1)},XQ)};v.useEffect(()=>{!u&&!m&&!o||(G.current=null,W.current=null,R(!1))},[u,m,o]);const Se=()=>{!G.current&&!W.current||(G.current=null,W.current=null,R(!1))},xe=we=>{ne(),!(u||m)&&we.button===0&&(we.preventDefault(),we.stopPropagation(),S(),G.current={pointerId:we.pointerId,startX:we.clientX,startY:we.clientY,geometry:n,latest:n},R(!0),we.currentTarget.setPointerCapture(we.pointerId))},fe=we=>{if(u||m)return;const Oe=G.current;if(!Oe||Oe.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const cn={...Oe.geometry,x:Oe.geometry.x+(we.clientX-Oe.startX)/i,y:Oe.geometry.y+(we.clientY-Oe.startY)/i};Oe.latest=cn,F(cn)},De=we=>{if(u||m){G.current=null,R(!1);return}const Oe=G.current;!Oe||Oe.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),G.current=null,R(!1),we.currentTarget.releasePointerCapture(we.pointerId),N(Oe.latest))},rt=(we,Oe)=>{u||m||(Oe.preventDefault(),Oe.stopPropagation(),S(),W.current={direction:we,pointerId:Oe.pointerId,startX:Oe.clientX,startY:Oe.clientY,geometry:n,latest:n},R(!0),Oe.currentTarget.setPointerCapture(Oe.pointerId))},Ie=we=>{if(u||m)return;const Oe=W.current;if(!Oe||Oe.pointerId!==we.pointerId)return;we.preventDefault(),we.stopPropagation();const cn=JQ(Oe.geometry,Oe.direction,(we.clientX-Oe.startX)/i,(we.clientY-Oe.startY)/i);Oe.latest=cn,F(cn)},Ce=we=>{if(u||m){W.current=null,R(!1);return}const Oe=W.current;!Oe||Oe.pointerId!==we.pointerId||(we.preventDefault(),we.stopPropagation(),W.current=null,R(!1),we.currentTarget.releasePointerCapture(we.pointerId),N(Oe.latest))},Me=we=>{we.stopPropagation()},je=we=>{we.stopPropagation(),ne()},ze=we=>{we.stopPropagation(),S()},bt=we=>{we.stopPropagation()},pt=()=>{ne();const we=typeof document<"u"?document.activeElement:null;we instanceof HTMLElement&&j.current?.contains(we)&&we.blur(),x()},vt=()=>{ne(),C?.()},lt=we=>{ne(),S(),B(we)},de=we=>{we.stopPropagation(),ne(),S()},ut=()=>{if(!M){oe();return}ne(),w()},tt=we=>{we.stopPropagation(),K.begin()},Vt=we=>{we.key!=="Enter"&&we.key!=="F2"||(we.preventDefault(),we.stopPropagation(),K.begin())},st=we=>{we.key==="Escape"&&(O.current=!0),K.handleKeyDown(we)};o||(V.current=n);const zt=o?V.current:n,Ft={left:Math.round(zt.x),top:Math.round(zt.y),width:Math.round(zt.width),height:Math.round(zt.height),zIndex:zt.zIndex,...h?{visibility:"hidden",pointerEvents:"none"}:{},...L?{"--user-accent":L}:{}};return c.jsxs("article",{ref:j,className:q,style:Ft,onPointerDown:S,"data-canvas-operation":!0,"data-operation-id":e.id,"data-focus-layer-target":p?"true":void 0,"aria-label":`Operation ${$}`,"aria-hidden":h||void 0,tabIndex:p?-1:void 0,inert:o||h?!0:void 0,children:[L?c.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!u&&!m?c.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:xe,onPointerMove:fe,onPointerUp:De,onPointerCancel:De,onLostPointerCapture:Se,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,c.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:xe,onPointerMove:fe,onPointerUp:De,onPointerCancel:De,onLostPointerCapture:Se,"data-canvas-blocker":!0,children:[L?c.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,K.renaming?c.jsx("input",{ref:K.inputRef,className:"canvas-operation-identity-input",value:K.draftTitle,"aria-label":`Rename operation ${$}`,onChange:we=>K.setDraftTitle(we.target.value),onKeyDown:st,onBlur:K.handleBlur,onPointerDown:je}):c.jsx("button",{ref:U,type:"button",className:"canvas-operation-identity-name",onPointerDown:je,onDoubleClick:tt,onKeyDown:Vt,"aria-label":`Rename operation ${$}`,title:`${$} — Double-click, Enter, or F2 to rename`,children:$}),z?c.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:Me,onClick:we=>lt(we.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${$}`,"aria-haspopup":"menu",title:"Set accent",children:c.jsx("span",{className:N5(r),"aria-hidden":"true"})}):c.jsx("span",{className:N5(r),onPointerDown:de,"aria-hidden":"true"}),c.jsxs("div",{className:"canvas-operation-window-controls",children:[c.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:Me,onClick:pt,"aria-label":`Minimize operation ${$}`,title:"Minimize operation",children:c.jsx(eee,{})}),C?c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${u?"is-active":""}`,onPointerDown:Me,onClick:vt,"aria-label":u?`Restore operation ${$}`:`Maximize operation ${$}`,"aria-pressed":u,title:u?"Restore operation":"Maximize operation",children:u?c.jsx(nee,{}):c.jsx(tee,{})}):null,c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${M?"is-armed-close":""}`,onPointerDown:Me,onClick:ut,"aria-label":M?`Confirm close operation ${$}`:`Close operation ${$}`,title:M?"Confirm close":"Close operation",children:M?"Close?":c.jsx(iee,{})})]})]}),c.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:$}),c.jsx("div",{className:"canvas-operation-terminal",onPointerDown:ze,onWheel:bt,"data-canvas-blocker":!0,children:b}),!u&&!m&&YQ.map(we=>c.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${we}`,onPointerDown:Oe=>rt(we,Oe),onPointerMove:Ie,onPointerUp:Ce,onPointerCancel:Ce,onLostPointerCapture:Se,"data-canvas-blocker":!0,"aria-hidden":"true"},we)),A&&z?c.jsx(D8,{anchor:A,accentKey:_,onSelect:z,onClose:()=>B(null)}):null]})}function JQ(e,t,n,i){let{x:r,y:o,width:u,height:h}=e;return t.includes("e")&&(u+=n),t.includes("s")&&(h+=i),t.includes("w")&&(r+=n,u-=n),t.includes("n")&&(o+=i,h-=i),u<Hv&&(t.includes("w")&&(r-=Hv-u),u=Hv),h<Fv&&(t.includes("n")&&(o-=Fv-h),h=Fv),{...e,x:r,y:o,width:u,height:h}}function QQ(e){const t=im(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function N5(e){const t=im(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 eee(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function tee(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 nee(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 iee(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.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 see({rect:e,viewport:t}){const n=PQ(e,t);return c.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const ree=.25,aee=2,oee=200,lee=150,L5=5,cee=.0018;function uee({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:r,onCreate:o,onConsumePointerDown:u,onClick:h}){const p=v.useRef(null),f=v.useRef(e),[m,_]=v.useState(null),[b,S]=v.useState(!1),[w,x]=v.useState(!1);v.useEffect(()=>{f.current=e},[e]),v.useEffect(()=>{const j=G=>{G.key==="Shift"&&x(!0),!dee(G.target)&&G.code==="Space"&&(G.preventDefault(),S(!0))},U=G=>{G.key==="Shift"&&x(!1),G.code==="Space"&&S(!1)};return window.addEventListener("keydown",j),window.addEventListener("keyup",U),()=>{window.removeEventListener("keydown",j),window.removeEventListener("keyup",U)}},[]);const C=j=>{if(t||M5(j.target)||j.button!==0&&j.button!==1)return;if(j.preventDefault(),n){u?.();return}const U=Wv(j),G=j.shiftKey&&j.button===0&&!b?"create":"pan";p.current={pointerId:j.pointerId,mode:G,startScreen:U,currentScreen:U,startViewport:f.current},j.currentTarget.setPointerCapture(j.pointerId),G==="create"&&_(Uv(U,U,f.current))},D=j=>{const U=p.current;if(!U||U.pointerId!==j.pointerId)return;j.preventDefault();const G=Wv(j);if(p.current={...U,currentScreen:G},U.mode==="pan"){i({...U.startViewport,x:U.startViewport.x+G.x-U.startScreen.x,y:U.startViewport.y+G.y-U.startScreen.y});return}_(Uv(U.startScreen,G,f.current))},z=j=>{I(j,!0)},F=j=>{I(j,!1)},N=j=>{if(t||M5(j.target))return;j.preventDefault();const U=Wv(j),G=f.current,W=hee(G.zoom*Math.exp(-j.deltaY*cee),ree,aee),Z=Nd(U,G);r({x:U.x-Z.x*W,y:U.y-Z.y*W,zoom:W})},I=(j,U)=>{const G=p.current;if(!G||G.pointerId!==j.pointerId||(p.current=null,j.currentTarget.releasePointerCapture(j.pointerId),_(null),!U))return;const W=Math.abs(G.currentScreen.x-G.startScreen.x),Z=Math.abs(G.currentScreen.y-G.startScreen.y);if(W<L5&&Z<L5){h?.();return}if(G.mode!=="create")return;const V=Uv(G.startScreen,G.currentScreen,f.current),O={x:V.x,y:V.y,width:Math.max(V.width,oee),height:Math.max(V.height,lee)};o(O,G.currentScreen)};return{rubberBand:m,spaceActive:b,shiftActive:w,onPointerDown:C,onPointerMove:D,onPointerUp:z,onPointerCancel:F,onWheel:N}}function Uv(e,t,n){const i=Nd(e,n),r=Nd(t,n),o=Math.min(i.x,r.x),u=Math.min(i.y,r.y);return{x:o,y:u,width:Math.abs(i.x-r.x),height:Math.abs(i.y-r.y)}}function Wv(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function M5(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function dee(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function hee(e,t,n){return Math.min(n,Math.max(t,e))}const fee="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",pee=560,mee=360,gee=12;function _ee({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:u,onFocus:h,onRename:p,onSetAccent:f}){const m=v.useRef(null),_=N0(),b=FT(),S=Qp(),w=zT(),x=HT(),C=KD(x),D=v.useRef(null),z=UT(),F=e.activeOperationId,[N,I]=v.useState(null),j=Mc(),U=Jp(),G=qM(U.state?.language??"auto"),[W,Z]=v.useState({width:0,height:0}),V=xee(),O=!e.activeTheaterId||e.addingTheater;v.useEffect(()=>{const de=m.current;if(!de||typeof ResizeObserver>"u")return;const ut=()=>Z({width:de.clientWidth,height:de.clientHeight});ut();const tt=new ResizeObserver(ut);return tt.observe(de),()=>tt.disconnect()},[]);const A=uee({viewport:_.viewport,disabled:O||S||x!==null,onViewportChange:my,onZoom:qT,onCreate:de=>{if(I(null),e.activeTheaterId&&n){const ut=Cee(t);if(!ut)return;const tt={...bee(de),zIndex:Yo()};o(ut.pluginId,ut.kind,tt)}},consumePointerDown:N!==null,onConsumePointerDown:()=>{I(null)},onClick:yee}),B=(de,ut)=>{const tt=N?.canvasPoint;I(null),tt&&r(de,ut,tt)},M=de=>{if(de.target instanceof Element&&de.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;de.preventDefault();const ut=m.current?.getBoundingClientRect();if(!ut)return;const tt={x:de.clientX-ut.left,y:de.clientY-ut.top};I({anchor:tt,canvasPoint:Nd(tt,_.viewport)})},k=new Set(z);v.useEffect(()=>{e.activeOperationId&&k.has(e.activeOperationId)&&Bi(null)},[z,e.activeOperationId]);const T=Object.fromEntries(Object.entries(_.operations).filter(([de])=>!k.has(de))),R=(e.operations??[]).filter(de=>de.theaterId===e.activeTheaterId),$=j.operationKinds,L=w!==null&&R.some(de=>de.id===w&&!k.has(de.id))?w:null,q=x===null?void 0:R.find(de=>de.id===x&&!k.has(de.id)),H=q?$.find(de=>de.pluginId===q.pluginId&&de.type===q.type):void 0;x===null&&(D.current=null),q&&H?.companions?.length&&(D.current={operation:q,descriptor:H});const ne=!q&&D.current?.operation.id===x?D.current:null,oe=q??ne?.operation,xe=(H??ne?.descriptor)?.companions??[],fe=xe.filter(de=>C[de.id]??!de.defaultHidden),De=xe.filter(de=>!fe.includes(de)).map(de=>de.id),rt=oe&&xe.length>0?oe.id:null,Ie=q&&H?.companions?.length?q.id:null,Ce=oe&&!R.some(de=>de.id===oe.id)?[...R,oe]:R,Me=Ce.length>0;v.useEffect(()=>{if(x===null||Ie!==null)return;const de=setTimeout(()=>{D.current=null,tr()},1500);return()=>clearTimeout(de)},[x,Ie]);const je=H0(R,e.groups.filter(de=>de.theaterId===e.activeTheaterId),_.operationOrder,[]).filter(de=>!k.has(de.id)).map(de=>de.id),ze=S?ZD({x:0,y:0,width:W.width,height:W.height},je.length,void 0,void 0,void 0,void 0,b):[],bt=new Map(je.map((de,ut)=>[de,ze[ut]]));v.useEffect(()=>{if(!S||O0())return;const de=m.current;if(!de)return;const ut=je.map(st=>de.querySelector(`.canvas-operation[data-operation-id="${Q1(st)}"]`)).filter(st=>st!==null);ut.forEach((st,zt)=>{st.style.setProperty("--panel-stagger-delay",`${zt*40}ms`)});const tt=()=>{for(const st of ut)st.style.removeProperty("--panel-stagger-delay")},Vt=window.setTimeout(tt,600+ut.length*40);return()=>{window.clearTimeout(Vt),tt()}},[S,b]);const pt=L||rt||S?1:_.viewport.zoom,vt=wee(_.operations)+1,lt=fe.length+1;return c.jsxs("main",{className:`operations-canvas ${A.spaceActive?"is-panning":""} ${A.shiftActive?"is-creating":""} ${V?"is-glance":""} ${L?"is-panel-maximized":""} ${rt?"is-companion-layout":""} ${S?"is-formation-view":""}`,onPointerDown:A.onPointerDown,onPointerMove:A.onPointerMove,onPointerUp:A.onPointerUp,onPointerCancel:A.onPointerCancel,onWheel:A.onWheel,onContextMenu:M,ref:m,tabIndex:-1,children:[c.jsx(VQ,{viewport:_.viewport}),c.jsx("div",{style:{transform:L||rt||S?"none":`translate(${Math.round(_.viewport.x)}px, ${Math.round(_.viewport.y)}px) scale(${_.viewport.zoom})`},className:"operations-canvas-world",children:Ce.map(de=>{const ut=_.operations[de.id]??de.geometry??qv(de),tt=L===de.id,Vt=rt===de.id,st=(L!==null||rt!==null)&&!tt&&!Vt,zt=bt.get(de.id),Ft=tt?See(W,vt):Vt?j5(W,0,lt,vt):zt?{...ut,...zt}:ut,we=!tt&&!Vt&&!zt&&_.viewport.y+Ft.y*pt<gee*pt;return kee(de,{active:F===de.id,keyboardFocusRequestId:e.keyboardFocusRequest?.operationId===de.id?e.keyboardFocusRequest.requestId:0,geometry:Ft,topEdge:we,operationKindRegistry:$,status:e.operationStatus[de.id],theme:e.activeTheme,language:G,viewportZoom:pt,minimized:k.has(de.id),maximized:tt,companion:Vt,companions:Vt?fe:[],companionGeometries:Vt?fe.map((Oe,cn)=>j5(W,cn+1,lt,vt)):[],hiddenCompanionPanelIds:Vt?De:[],formation:S,focusLayerHidden:st,onRenderHiddenFocus:()=>{const Oe=m.current?.querySelector("[data-focus-layer-target='true']");if(Oe){Oe.focus();return}m.current?.focus()},accentKey:_.operationAccent[de.id]??D5(de),onActivate:()=>{Bi(de.id),!tt&&!Vt&&!S&&gy(de.id,_.operations[de.id]??de.geometry??qv(de))},onClose:()=>{e.activeOperationId===de.id&&Bi(null),L===de.id&&so(),rt===de.id&&tr(),u(de.id)},onMinimize:()=>{e.activeOperationId===de.id&&Bi(null),XM(de.id),GT(de.id)},onMaximize:()=>{tt?so():(Bi(de.id),L0(de.id))},onRename:Oe=>{p(de.id,Oe)},onSetAccent:Oe=>{f(de.id,Oe)},onGeometryChange:Oe=>{!tt&&!Vt&&!S&&gy(de.id,Oe)},onGeometryCommit:Oe=>{!tt&&!Vt&&!S&&Tee(de.id,gr().operations[de.id]??Oe)}})})}),Me?null:c.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[c.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),c.jsx("p",{children:e.activeTheaterId?fee:"Add a Theater from the sidebar to start operations."})]}),A.rubberBand?c.jsx(see,{rect:A.rubberBand,viewport:_.viewport}):null,N?c.jsx(bA,{anchor:N.anchor,viewportBounds:vee(m.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:B,onClose:()=>I(null)},`${N.anchor.x}:${N.anchor.y}`):null,c.jsx(UQ,{operations:T,pluginOperations:Object.fromEntries(R.filter(de=>!k.has(de.id)).map(de=>[de.id,{theaterId:de.theaterId,geometry:_.operations[de.id]??de.geometry??qv(de)}])),accents:Object.fromEntries(R.flatMap(de=>{const ut=_.operationAccent[de.id]??D5(de),tt=ut?Bs(ut):null;return tt?[[de.id,tt]]:[]})),viewport:_.viewport,canvasSize:W,onJump:de=>my({x:W.width/2-de.x*_.viewport.zoom,y:W.height/2-de.y*_.viewport.zoom,zoom:_.viewport.zoom})})]})}function vee(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function yee(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Bi(null)}function bee(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function qv(e){return e.geometry??{x:0,y:0,width:pee,height:mee,zIndex:0}}function See(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function j5(e,t,n,i){const r=Math.max(1,n),o=8,u=Math.max(0,(e.width-o*(r-1))/r);return{x:t*(u+o),y:0,width:u,height:Math.max(0,e.height),zIndex:i}}function wee(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function xee(){const[e,t]=v.useState(!1),n=v.useRef(new Set);return v.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=h=>{!O5(h)||h.repeat||h.ctrlKey||h.metaKey||YM()||(n.current.add(h.code),t(!0))},o=h=>{O5(h)&&(n.current.delete(h.code),t(n.current.size>0))},u=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",r),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",u)}},[]),e}function O5(e){return e.code==="AltLeft"||e.code==="AltRight"}function Cee(e){const t=e.flatMap(n=>n.kinds.filter(i=>i.disabled!==!0).map(i=>({pluginId:n.id,kind:i})));return t.find(({kind:n})=>n.type==="shell")??t[0]??null}function D5(e){return typeof e.accent=="string"?e.accent:null}function kee(e,t){const n=t.operationKindRegistry.find(h=>h.pluginId===e.pluginId&&h.type===e.type),i=t.geometry;if(!n?.render)return null;const r=wm(()=>{Qi(null).then(ms).catch(()=>{})}),o=h=>{h?(Bi(e.id),KT(e.id)):iI()},u=(h,p)=>{VD(e.id,h,p)};return c.jsxs(v.Fragment,{children:[c.jsx(ZQ,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:c.jsx(cp,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:c.jsx(I5,{active:t.active,keyboardFocusRequestId:t.keyboardFocusRequestId,capabilities:r,geometry:i,operation:e,theme:t.theme,language:t.language,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:u,render:n.render})})}),t.companions.map((h,p)=>c.jsx(Eee,{descriptor:h,geometry:t.companionGeometries[p],children:c.jsx(cp,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin companion failed to render."}),children:c.jsx(I5,{active:t.active,capabilities:r,geometry:i,operation:e,theme:t.theme,language:t.language,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:u,render:h.render})})},h.id))]},e.id)}function I5({active:e,keyboardFocusRequestId:t,capabilities:n,geometry:i,operation:r,theme:o,language:u,viewportZoom:h,onActivate:p,onClose:f,onGeometryChange:m,onRequestCompanions:_,companionsOpen:b,hiddenCompanionPanelIds:S,onSetCompanionPanelVisible:w,render:x}){return x({operationId:r.id,theaterId:r.theaterId,pluginId:r.pluginId,type:r.type,operation:r,geometry:i,active:e,...t===void 0?{}:{keyboardFocusRequestId:t},zoom:h,theme:o,language:u,api:n.api,lifecycle:n.lifecycle,terminal:n.terminal,notifications:n.notifications,operations:n.operations,preferences:n.preferences,settings:n.settings,status:n.status,onActivate:p,onClose:f,onGeometryChange:m,onRequestCompanions:_,companionsOpen:b,hiddenCompanionPanelIds:S,onSetCompanionPanelVisible:w})}function Eee({descriptor:e,geometry:t,children:n}){const i={left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),zIndex:t.zIndex};return c.jsxs("article",{className:"canvas-operation canvas-companion-frame",style:i,"data-canvas-operation":!0,"aria-label":`Companion ${e.title}`,children:[e.hideCaption?null:c.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[c.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),c.jsx("span",{className:"canvas-companion-caption-title",children:e.title})]}),c.jsx("div",{className:"canvas-operation-terminal canvas-companion-body",onPointerDown:r=>r.stopPropagation(),onWheel:r=>r.stopPropagation(),"data-canvas-blocker":!0,children:n})]})}async function Tee(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function t3(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(n=>n.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function n3(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function i3(e,t){const n=[],i=[];for(const r of e)t.has(r.operationId)?i.push(r):n.push(r);return{hidden:n,visible:i}}function l0(e){const t=new Map;for(const n of[...e].sort((i,r)=>r.lastRaisedSeq-i.lastRaisedSeq)){const i=n.theaterId??"__unknown__",r=t.get(i)??{theaterId:n.theaterId,theaterLabel:n.theaterLabel,notifications:[]};r.notifications.push(n),t.set(i,r)}return[...t.values()].sort((n,i)=>{const r=n.notifications[0]?.lastRaisedSeq??0;return(i.notifications[0]?.lastRaisedSeq??0)-r})}function s3(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const Aee={ended:"Ended","input-waiting":"Waiting for input"},Ree={id:"alerts",title:"Alerts",icon:()=>c.jsx(Lee,{}),render:()=>c.jsx(Nee,{})};function Nee(){const e=ir(),t=Tc(),[n,i]=v.useState(!1),r=v.useMemo(()=>n3(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=t3(e),u=i3(r,o).hidden,h=s3(u,e.notificationPreferences),p=l0(h),f=l0(u),m=c0(p,"input-waiting"),_=c0(p,"ended"),b=p.length===0,S=v.useCallback(w=>{_c(w.operationId),t("/operations")},[t]);return c.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[c.jsxs("div",{className:"alerts-panel-toolbar",children:[c.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[m>0?c.jsx("span",{className:"notification-tally is-input-waiting",children:m}):null,_>0?c.jsx("span",{className:"notification-tally is-ended",children:_}):null,b?c.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),c.jsx("button",{type:"button",className:`alerts-panel-settings-btn${n?" is-active":""}`,onClick:()=>i(w=>!w),"aria-expanded":n,"aria-label":"Notification settings",title:"Notification settings",children:c.jsx(Dee,{})})]}),n?c.jsx(Mee,{groups:f}):null,b?c.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):c.jsx("div",{className:"notification-dock-deck",children:p.map(w=>c.jsxs("section",{className:"notification-cluster-group",children:[c.jsxs("header",{className:"notification-cluster-group-head",children:[c.jsx("span",{className:"notification-cluster-theater",children:w.theaterLabel}),c.jsx("span",{className:"notification-cluster-group-count",children:w.notifications.length})]}),c.jsx("ul",{className:"notification-cluster-roster",children:w.notifications.map(x=>c.jsxs("li",{className:`notification-row is-${x.kind}`,children:[c.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),c.jsxs("span",{className:"notification-row-body",children:[c.jsx("span",{className:"notification-row-op",children:x.operationLabel}),c.jsx("span",{className:"notification-row-state",children:Aee[x.kind]})]}),c.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>S(x),"aria-label":`Open ${w.theaterLabel} ${x.operationLabel}`,children:"Open"})]},x.operationId))})]},w.theaterId??"__unknown__"))})]})}function Lee(){const e=ir();UA();const t=v.useMemo(()=>n3(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=t3(e),i=i3(t,n).hidden,r=s3(i,e.notificationPreferences),o=l0(r),u=o.reduce((f,m)=>f+m.notifications.length,0),h=c0(o,"input-waiting"),p=u===0?"muted":h>0?"awaiting":"ended";return c.jsxs("span",{className:`alerts-icon is-${p}`,"aria-hidden":"true",children:[c.jsx(Oee,{}),u>0?c.jsx("span",{className:"alerts-icon-badge",children:u}):null]})}function Mee({groups:e}){const t=ir(),n=jee(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return c.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:i=>n8(i.currentTarget.checked)}),c.jsx("span",{children:"Mute all"})]}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:i=>i8(i.currentTarget.checked)}),c.jsx("span",{children:"Do not disturb"})]}),n.length>0?c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,n.map(i=>c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:i.theaterId?t.notificationPreferences.mutedTheaterIds[i.theaterId]===!0:!1,onChange:()=>{i.theaterId&&s8(i.theaterId)}}),c.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function jee(e,t,n){const i=new Map;for(const r of e)r.theaterId&&i.set(r.theaterId,r);for(const r of Object.keys(t))i.has(r)||i.set(r,{theaterId:r,theaterLabel:n.find(o=>o.id===r)?.label??r,notifications:[]});return[...i.values()]}function c0(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function Oee(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[c.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"}),c.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Dee(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[c.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"}),c.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class eS extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function Iee(e,t){const i=new URLSearchParams().toString();return oo(Vn(e,`/search${i?`?${i}`:""}`))}async function Bee(e,t,n){return oo(Vn(e,`/entry/${encodeURIComponent(t)}`))}async function r3(e,t="pending"){return oo(Vn(e,`/drydock?status=${encodeURIComponent(t)}`))}async function Pee(e,t){return oo(Vn(e,`/drydock/${encodeURIComponent(t)}`))}async function $ee(e){return oo(Vn(e,"/schema"))}async function zee(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return oo(Vn(e,n))}async function Hee(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),Jee(Vn(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function Fee(e){return oo(Vn(e,"/conflicts"))}async function Uee(e,t){return oo(Vn(e,`/conflicts/${encodeURIComponent(t)}`))}async function Wee(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),a3(Vn(e,`/cowork/options?${i}`))}async function B5(e,t,n){return lo(Vn(e,"/cowork/sessions"),{entryId:t,...n})}async function qee(e,t){try{return await a3(Vn(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof eS&&n.status===404)return null;throw n}}async function Gv(e,t,n){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function Gee(e,t,n){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function P5(e,t,n){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function Kee(e,t,n){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function Vee(e,t){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function Yee(e,t,n){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function Xee(e,t){return lo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function Zee(e,t,n,i){const r=new EventSource(`${Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=u=>{try{const h=JSON.parse(u.data);if(!Qee(h))return;i(h,Number(u.lastEventId)||0)}catch{}};for(const u of["session","transcript","tool","done","error"])r.addEventListener(u,o);return()=>r.close()}function Vn(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function oo(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await l3(e,t));return t.json()}async function Jee(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await l3(e,n));return n.json()}async function a3(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await o3(t);return t.json()}async function lo(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await o3(n);return n.json()}async function o3(e){const t=await e.json().catch(()=>null);return new eS(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function Qee(e){if(!e||typeof e!="object")return!1;const t=e;return["session","transcript","tool","done","error"].includes(t.type??"")&&(t.session===void 0||t.session!==null&&typeof t.session=="object")}async function l3(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const u0=new Set;let tp=0;const dc={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function Yl(){return dc}function c3(e){return u0.add(e),()=>u0.delete(e)}function $5(e){tp+=1,np({currentWorkspaceId:e,schemaCatalog:null})}async function Gp(){const e=dc.currentWorkspaceId,t=tp;np({loading:!0,error:null});try{const[n,i,r]=await Promise.all([Iee(e),r3(e,"pending").catch(()=>null),$ee(e).catch(()=>null)]);if(dc.currentWorkspaceId!==e||tp!==t)return;np({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:r,loading:!1})}catch(n){if(dc.currentWorkspaceId!==e||tp!==t)return;np({loading:!1,error:ete(n)})}}function np(e){Object.assign(dc,e);for(const t of u0)t(dc)}function ete(e){return e instanceof Error?e.message:String(e)}const tte=120;function Pi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function nte(e,t){if(!t)return Pi(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?Pi(e):Pi(e.slice(0,n))+`<mark>${Pi(e.slice(n,n+t.length))}</mark>`+Pi(e.slice(n+t.length))}function ite(e){return`<span class="codex-nav-tag">${Pi(e)}</span>`}function ste(e,t,n){const i=t?e.tags.some(h=>h.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(ite).join(""),o=Pi(e.status??"current"),u=Pi(e.updated??"");return`<button
230
+ class="codex-nav-entry${n?" is-current":""}"
231
+ data-entry-id="${Pi(e.id)}"
232
+ type="button"
233
+ ${n?'aria-current="page"':""}
234
+ title="${Pi(e.title)}"
235
+ >
236
+ <span class="t">${nte(e.title,i?"":t)}</span>
237
+ ${r?`<span class="tg">${r}</span>`:""}
238
+ <span class="meta">${o} · ${u}</span>
239
+ </button>`}function rte(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(i=>i.title.toLowerCase().includes(n)||i.tags.some(r=>r.toLowerCase().includes(n)))}function ate(e,t){let n="",i=null,r="entries",o=null;e.innerHTML=`
240
+ <div class="codex-navigator">
241
+ <div class="codex-nav-modes" role="tablist" aria-label="Codex catalog">
242
+ <button type="button" role="tab" data-mode="entries" aria-selected="true">Entries</button>
243
+ <button type="button" role="tab" data-mode="schema" aria-selected="false">Schema</button>
244
+ </div>
245
+ <div class="codex-nav-search">
246
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
247
+ <input
248
+ class="codex-nav-search-input"
249
+ type="search"
250
+ placeholder="Search entries"
251
+ autocomplete="off"
252
+ spellcheck="false"
253
+ aria-label="Search Codex entries"
254
+ />
255
+ </div>
256
+ <div class="codex-nav-quick-row">
257
+ <button class="codex-nav-quick" data-action="drydock" type="button">
258
+ Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
259
+ </button>
260
+ <button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
261
+ </div>
262
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
263
+ <div class="codex-navigator-scroll">
264
+ <div class="codex-nav-list" id="codex-nav-list"></div>
265
+ </div>
266
+ </div>
267
+ `;const u=e.querySelector(".codex-nav-search-input"),h=e.querySelector("#codex-nav-list"),p=e.querySelector("#codex-nav-eyebrow"),f=e.querySelector("#codex-nav-drydock-badge");function m(w){if(e.querySelectorAll("[data-mode]").forEach(C=>C.setAttribute("aria-selected",String(C.dataset.mode===r))),u.hidden=r==="schema",r==="schema"){const C=w.schemaCatalog;p.textContent=`Schema · ${C?.templates.length??0} templates`,h.innerHTML=C?`
268
+ <button class="codex-nav-entry" type="button" ${C.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">Workspace schema</span><span class="meta">${C.schema.exists?Pi(C.schema.ref):"Unavailable"}</span></button>
269
+ ${C.templates.map(D=>`<button class="codex-nav-entry" type="button" data-template-id="${Pi(D.id)}"><span class="t">${Pi(D.id)}</span><span class="meta">${Pi(D.ref)}</span></button>`).join("")}`:'<div class="codex-nav-empty">Schema catalog unavailable.</div>',f.textContent=String(w.pendingPatchCount);return}const x=rte(w.index,n);if(p.textContent=`Entries · ${x.length}`,f.textContent=String(w.pendingPatchCount),f.hidden=w.pendingPatchCount===0,w.loading&&w.index.length===0){h.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(w.error){h.innerHTML=`<div class="codex-nav-error" role="alert">${Pi(w.error)}</div>`;return}if(x.length===0){h.innerHTML=`<div class="codex-nav-empty">${n?"No entries match.":"No entries."}</div>`;return}h.innerHTML=x.map(C=>ste(C,n,C.id===i)).join("")}function _(w){const x=w.target;if(!(x instanceof Element))return;const C=x.closest("[data-mode]");if(C?.dataset.mode==="entries"||C?.dataset.mode==="schema"){r=C.dataset.mode,m(Yl());return}if(x.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const z=x.closest("[data-template-id]");if(z?.dataset.templateId){t.onRequest({kind:"schema",templateId:z.dataset.templateId});return}const F=x.closest("[data-entry-id]");if(F?.dataset.entryId){i=F.dataset.entryId,m(Yl()),t.onRequest({kind:"entry",id:i});return}const N=x.closest("[data-action]");if(N?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(N?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function b(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=u.value,m(Yl())},tte)}e.addEventListener("click",_),u.addEventListener("input",b);const S=c3(w=>m(w));return m(Yl()),{destroy(){S(),e.removeEventListener("click",_),u.removeEventListener("input",b),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(w){n="",i=null,u&&(u.value=""),m(Yl())}}}function ote(e,t){t.initialTheaterId&&$5(t.initialTheaterId);const n=ate(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=c3(()=>{});Gp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){$5(o),Gp(),n.setTheater(o)}}}function Mt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sa(e){return Mt(e).replace(/"/g,"&quot;")}function lte(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${Mt(i)}</span>`).join(""),n=ute(e);return`
270
+ <div class="meta-chips">
271
+ ${t}
272
+ ${n}
273
+ <span class="chip">Updated ${Mt(cte(e.updated))}</span>
274
+ </div>
275
+ `}function u3(e){return e.map(t=>`<span class="chip chip-muted">${Mt(t)}</span>`).join("")}function cte(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function ute(e){const t=dte(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${sa(t.title)}">${Mt(t.label)}</span>`:""}function dte(e,t=new Date){const n=e.status,i=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return n==="deprecated"||n==="superseded"?{label:n,tone:"deprecated",title:i?`${n} · stale`:n}:i?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:n==="current"||n==="draft"?{label:n,tone:"neutral",title:n}:null}const hte="active";function Kv(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${sa(t.id)}" data-toc-id="${sa(t.id)}">${Mt(t.text)}</a>`).join("")}function z5(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],r=new Set(t.map(f=>f.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(f=>r.has(f.id));if(i.length===0||o.length===0)return()=>{};const u=e.closest(".codex-reading-sheet-read"),h=new Set,p=new IntersectionObserver(f=>{for(const _ of f){const b=_.target instanceof HTMLElement?_.target.id:"";b&&(_.isIntersecting?h.add(b):h.delete(b))}const m=fte(o,h)??pte(o,u)??o[0]?.id??null;H5(i,m)},{root:u,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of o)p.observe(f);return H5(i,o[0]?.id??null),()=>p.disconnect()}function fte(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function pte(e,t){const n=t?t.getBoundingClientRect().top:0;let i=null;for(const r of e)if(r.getBoundingClientRect().top-n<=80)i=r.id;else break;return i}function H5(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(hte,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function Kp(e){return`/entry/${encodeURIComponent(e)}`}const d3=1<<20;function mte(e,t){const n=e.replace(/\r\n/g,`
276
+ `).split(`
277
+ `),i=t.replace(/\r\n/g,`
278
+ `).split(`
279
+ `),r=n.length+1,o=i.length+1;if(r*o>d3)return i.map((m,_)=>({text:m,changed:n[_]!==m}));const u=Array.from({length:r},()=>new Uint16Array(o));for(let m=n.length-1;m>=0;m-=1)for(let _=i.length-1;_>=0;_-=1)u[m][_]=n[m]===i[_]?u[m+1][_+1]+1:Math.max(u[m+1][_],u[m][_+1]);const h=[];let p=0,f=0;for(;f<i.length;)p<n.length&&n[p]===i[f]?(h.push({text:i[f],changed:!1}),p+=1,f+=1):p<n.length&&u[p+1][f]>=u[p][f+1]?p+=1:(h.push({text:i[f],changed:!0}),f+=1);return h}function gte(e,t){const n=F5(e),i=F5(t),r=n.length+1,o=i.length+1,u=[];if(r*o>d3){const m=Math.max(n.length,i.length);for(let _=0;_<m;_+=1){const b=n[_],S=i[_];S!==void 0&&S===b?u.push({markdown:S,kind:"same"}):(b!==void 0&&u.push({markdown:b,kind:"removed"}),S!==void 0&&u.push({markdown:S,kind:"added"}))}return U5(u)}const h=Array.from({length:r},()=>new Uint16Array(o));for(let m=n.length-1;m>=0;m-=1)for(let _=i.length-1;_>=0;_-=1)h[m][_]=n[m]===i[_]?h[m+1][_+1]+1:Math.max(h[m+1][_],h[m][_+1]);let p=0,f=0;for(;p<n.length||f<i.length;)p<n.length&&f<i.length&&n[p]===i[f]?(u.push({markdown:i[f],kind:"same"}),p+=1,f+=1):p<n.length&&(f>=i.length||h[p+1][f]>=h[p][f+1])?(u.push({markdown:n[p],kind:"removed"}),p+=1):(u.push({markdown:i[f],kind:"added"}),f+=1);return U5(u)}function F5(e){const t=[];let n=[],i=null;for(const r of e.replace(/\r\n/g,`
280
+ `).split(`
281
+ `)){const o=r.trim();if(!i&&o===""){n.length&&(t.push(n.join(`
282
+ `)),n=[]);continue}if(n.push(r),i)o.startsWith(i)&&(i=null);else{const u=o.match(/^(`{3,}|~{3,})/);u&&(i=u[1])}}return n.length&&t.push(n.join(`
283
+ `)),t}function U5(e){const t=[];for(const n of e){const i=t[t.length-1];i&&i.kind===n.kind?t[t.length-1]={markdown:`${i.markdown}
284
+
285
+ ${n.markdown}`,kind:i.kind}:t.push(n)}return t}function Vv(e){return e.map(t=>({value:t,label:t}))}function _te({clis:e,models:t,efforts:n,cli:i,model:r,effort:o,onCliChange:u,onModelChange:h,onEffortChange:p}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:"CLI"}),c.jsx(Ni,{label:"CLI",value:i,options:Vv(e),onChange:u,disabled:!e.length,compact:!0})]}),c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:"Model"}),c.jsx(Ni,{label:"Model",value:r,options:Vv(t),onChange:h,disabled:!t.length,compact:!0})]}),c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:"Effort"}),c.jsx(Ni,{label:"Effort",value:o,options:Vv(n),onChange:p,disabled:!n.length,compact:!0})]})]})}const h3="fleet.codex.cowork.settings",vte="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",yte=32;function bte(e){let t=!1,n=null,i=null,r=0,o={clis:[],models:[],efforts:[]},u=kte(),h=[],p="",f="",m="",_=null,b="",S="idle",w=!1,x=null,C=!1,D=!1,z=!1,F=null,N=!1,I=!1,j=!1,U=null,G="",W="",Z="published",V=null,O=null,A=null;const B=()=>n?((!O||O.base!==n.baseDraft||O.draft!==n.draft)&&(O={base:n.baseDraft,draft:n.draft,lines:mte(n.baseDraft,n.draft)}),O.lines):[],M=e.body.innerHTML,k=document.createElement("div");k.className="cowork-anchor";const T=document.createElement("div");T.className="cowork-dock-zone";const R=document.createElement("div");R.className="cowork-tip",R.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(k,T,R);const $=()=>{A?.unmount(),A=null},K=()=>{if(!z||t)return;const ee=T.querySelector("[data-cowork-settings-host]");ee&&(A||(A=aT.createRoot(ee)),A.render(v.createElement(_te,{clis:o.clis,models:o.models,efforts:o.efforts,cli:u.cli,model:u.model,effort:u.effort,onCliChange:le=>L("cli",le),onModelChange:le=>L("model",le),onEffortChange:le=>L("effort",le)})))},L=(ee,le)=>{if(u=ee==="cli"?{cli:le,model:"",effort:""}:{...u,[ee]:le},Xv(u),!n){ee!=="effort"?lt().then(()=>{ne()}).catch(()=>{}):K();return}ee!=="effort"?lt().then(()=>Oe(()=>Gv(e.theaterId,n.id,u))).then(ne).catch(Be=>{W=Be instanceof Error?Be.message:"Cowork request failed.",ne()}):Oe(()=>Gv(e.theaterId,n.id,u)).then(ne).catch(()=>{})},q=()=>{if(t)return;const ee=!!n&&n.state!=="closed",le=ee?N?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(le!==Z){if(Z=le,!ee){e.body.innerHTML=M;return}e.body.innerHTML=N?`<div class="cowork-rendered-diff" aria-label="Draft changes">${wte(Yv(n.baseDraft),Yv(n.draft))}</div>`:Hs(Yv(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:Be=>Kp(Be)}).html}},H=()=>{if(t)return;if(!x){k.innerHTML="";return}const ee=e.article.getBoundingClientRect().width||0,le=C?Math.min(340,ee*.86)/2+8:56,Be=Math.min(Math.max(x.left,le),Math.max(ee-le,le)),Le=`style="top:${x.top}px;left:${Be}px"`;k.innerHTML=C?`<div class="cowork-composer" ${Le} role="dialog" aria-label="Add a comment">
286
+ <blockquote>${Mt(q5(x.quote,140))}</blockquote>
287
+ <textarea class="cowork-composer-input" rows="2" placeholder="What should change here?" aria-label="Comment"></textarea>
288
+ <div class="cowork-composer-actions">
289
+ <button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">Cancel</button>
290
+ <button type="button" class="cowork-solid" data-cowork-action="add-comment">Add</button>
291
+ </div>
292
+ </div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${Le}><span aria-hidden="true">✦</span>Comment</button>`,C&&k.querySelector(".cowork-composer-input")?.focus()},ne=()=>{if(t)return;const ee=!!n&&n.state!=="closed"&&n.state!=="applied";T.classList.add("is-open");const le=j||ee&&n.state==="running"&&S!=="complete"&&S!=="stopped";e.body.classList.toggle("is-cowork-running",le);const Be=ee&&n.baseDraft!==n.draft,Le=Be?B().filter(Fe=>Fe.changed).length:0;Ie(`
293
+ ${oe(le)}
294
+ ${D?Ce():""}
295
+ ${z?Me():""}
296
+ ${Be&&!le?je(Le):""}
297
+ <div class="cowork-bar${le?" is-running":""}" data-cowork-form>
298
+ ${le?'<span class="cowork-glow" aria-hidden="true"></span>':""}
299
+ <button type="button" class="cowork-chip${D?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${D}" aria-label="Annotations" ${le?"disabled":""}><span aria-hidden="true">✦</span>${h.length}</button>
300
+ <input class="cowork-dock-input" name="prompt" value="${sa(G)}" placeholder="${h.length?"Add an instruction (optional)…":"Ask AI to revise this entry…"}" aria-label="Instruction" ${le?"disabled":""}>
301
+ <button type="button" class="cowork-chip cowork-chip--config${z?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${z}" aria-label="Agent settings" ${le?"disabled":""}>${Mt(u.cli||"agent")}</button>
302
+ ${le?'<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="Stop"><span aria-hidden="true"></span></button>':'<button type="button" class="cowork-send" data-cowork-action="send" aria-label="Send to AI">↑</button>'}
303
+ </div>
304
+ ${W?`<p class="cowork-error" role="alert">${Mt(W)}</p>`:""}`),K()},oe=ee=>{if(!(ee||S!=="idle"))return"";const Be=ee?"running":S,Le=ee?"Editing entry":S==="complete"?"Revision complete":"Revision stopped",Fe=!!(b||p||ee);return`<section class="cowork-revision-stream is-${Be}${w?" is-collapsed":""}" aria-label="Cowork revision stream">
305
+ ${ee?'<span class="cowork-revision-scan" aria-hidden="true"></span>':""}
306
+ <header class="cowork-revision-head"><span class="cowork-revision-mark" aria-hidden="true">✳</span><span class="cowork-revision-copy"><strong>Cowork</strong><small>${Le}</small></span>${Fe?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!w}" aria-label="${w?"Expand":"Collapse"} Cowork stream"><span aria-hidden="true"></span></button>`:""}</header>
307
+ ${Fe?`<div class="cowork-revision-content" aria-hidden="${w}"><div class="cowork-revision-content-inner">
308
+ ${b||p?`<div class="cowork-revision-body">
309
+ ${b?`<p class="cowork-revision-instruction">${Mt(b)}</p>`:""}
310
+ ${p?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${m}</div></div>`:""}
311
+ </div>`:""}
312
+ ${ee?'<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>Writing revision</strong></span></footer>':""}
313
+ </div></div>`:""}
314
+ </section>`},Se=()=>{_!==null&&window.clearTimeout(_),_=null},xe=()=>{f!==p&&(f=p,m=p?Hs(p).html:"")},fe=()=>{xe();const ee=T.querySelector(".cowork-revision-output");if(!ee){ne();return}ee.innerHTML=m;const le=ee.closest(".cowork-revision-output-scroll");le&&(le.scrollTop=le.scrollHeight)},De=()=>{_===null&&(_=window.setTimeout(()=>{_=null,t||fe()},yte))},rt=()=>{Se(),xe()},Ie=ee=>{if(ee===V)return;$(),V=ee;const le=document.activeElement,Be=le instanceof HTMLInputElement&&le.name==="prompt"&&T.contains(le)?"prompt":le instanceof HTMLTextAreaElement&&le.dataset.coworkComment&&T.contains(le)?`comment:${le.dataset.coworkComment}`:null;if(T.innerHTML=ee,Be==="prompt"){const Le=T.querySelector(".cowork-dock-input");Le?.focus(),Le?.setSelectionRange(Le.value.length,Le.value.length)}else if(Be?.startsWith("comment:")){const Le=T.querySelector(`[data-cowork-comment="${CSS.escape(Be.slice(8))}"]`);Le?.focus(),Le?.setSelectionRange(Le.value.length,Le.value.length)}},Ce=()=>`
315
+ <div class="cowork-popover cowork-panel" role="region" aria-label="Annotations">
316
+ ${h.length===0?'<p class="cowork-empty">Select text in the document to add a comment.</p>':h.map(ee=>`
317
+ <article class="cowork-card is-${ee.status}">
318
+ <blockquote>${Mt(q5(ee.quote,160))}</blockquote>
319
+ <textarea data-cowork-comment="${sa(ee.id)}" aria-label="Comment" placeholder="Add a comment" ${ee.status==="sent"?"disabled":""}>${Mt(ee.comment)}</textarea>
320
+ <footer><span class="cowork-card-status">${ee.status==="sent"?"Sent":ee.status==="done"?"Done":"Ready"}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${sa(ee.id)}" aria-label="Delete annotation">×</button></footer>
321
+ </article>`).join("")}
322
+ </div>`,Me=()=>`
323
+ <div class="cowork-popover cowork-config" role="region" aria-label="Agent settings">
324
+ <div data-cowork-settings-host></div>
325
+ </div>`,je=ee=>F?`<div class="cowork-review is-confirm"><span>${F==="apply"?"Apply these changes to the entry?":"Discard this draft?"}</span><button type="button" class="cowork-solid${F==="discard"?" cowork-solid--danger":""}" data-cowork-action="${F==="apply"?"apply-confirm":"discard-confirm"}">${F==="apply"?"Apply":"Discard"}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">Back</button></div>`:`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${ee>0?`${ee} changed line${ee===1?"":"s"}`:"Removed content"}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${N?"View draft":"View diff"}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">Apply</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">Discard</button></div>`,ze=()=>{if(!t){for(const ee of[...e.body.querySelectorAll("mark.cowork-mark")]){const le=ee.parentNode;if(le){for(;ee.firstChild;)le.insertBefore(ee.firstChild,ee);le.removeChild(ee)}}if(e.body.normalize(),!N)for(const ee of h)ee.quote&&bt(ee)}},bt=ee=>{const le=[],Be=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let ue=Be.nextNode();ue;ue=Be.nextNode())le.push(ue);let Le="";const Fe=[];for(const ue of le)Fe.push(Le.length),Le+=ue.data;const it=Le.indexOf(ee.quote);if(it<0)return;const X=it+ee.quote.length;for(let ue=0;ue<le.length;ue+=1){const be=Fe[ue],Ge=be+le[ue].data.length,At=Math.max(it,be),jt=Math.min(X,Ge);if(At>=jt)continue;const Re=document.createRange();Re.setStart(le[ue],At-be),Re.setEnd(le[ue],jt-be);const Ae=document.createElement("mark");Ae.className="cowork-mark",Ae.dataset.annotationId=ee.id;try{Re.surroundContents(Ae)}catch{}}},pt=ee=>{const le=h.find(it=>it.id===ee.dataset.annotationId);if(!le){R.hidden=!0;return}R.textContent=le.comment.trim()||"No comment yet",R.hidden=!1;const Be=ee.getBoundingClientRect(),Le=e.article.getBoundingClientRect(),Fe=R.offsetWidth/2+8;R.style.top=`${Math.max(Be.top-Le.top-6,0)}px`,R.style.left=`${Math.min(Math.max(Be.left+Be.width/2-Le.left,Fe),Math.max(Le.width-Fe,Fe))}px`},vt=()=>{q(),ne(),ze()},lt=async()=>{o=await Wee(e.theaterId,u.cli,u.model||void 0);const ee=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",le=o.defaultEffort&&o.efforts.includes(o.defaultEffort)?o.defaultEffort:o.efforts[0]??"";u={cli:o.clis.includes(u.cli)?u.cli:o.clis[0]??"",model:o.models.includes(u.model)?u.model:ee,effort:o.efforts.includes(u.effort)?u.effort:le},Xv(u)},de=async ee=>{n=ee;const le=ee.annotations.map(xte),Be=new Set(le.map(Le=>Le.id));h=[...le,...h.filter(Le=>!Be.has(Le.id))],(ee.cli||ee.model||ee.effort)&&(u={cli:ee.cli??u.cli,model:ee.model??u.model,effort:ee.effort??u.effort},Xv(u));try{await lt()}catch{}if(!t){if(n&&(n.cli!==u.cli||n.model!==u.model||n.effort!==u.effort))try{n=await Gv(e.theaterId,n.id,u)}catch{}t||(tt(),vt())}},ut=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const ee=await B5(e.theaterId,e.entryId,u);return await de(ee),ee};ne(),lt().then(ne).catch(()=>{}),(async()=>{try{const ee=await qee(e.theaterId,e.entryId);!t&&ee&&await de(ee)}catch{}})();function tt(){n&&(i?.(),i=Zee(e.theaterId,n.id,r,(ee,le)=>{if(le&&le<=r)return;r=Math.max(r,le);const Be=n?.state==="running";if(ee.session&&(n=ee.session),ee.type==="transcript"&&ee.text&&n?.state==="running"){p=S==="running"?p+ee.text:ee.text,S="running",De();return}ee.type==="done"&&(rt(),(!U?.cancelled||U.submitted)&&(S=Be||I||S==="stopped"||!!p||!!b?"complete":"idle",h=h.map(Fe=>Fe.status==="sent"?{...Fe,status:"done"}:Fe),I&&(I=!1,n&&n.baseDraft!==n.draft&&(N=!0)))),(ee.type==="error"||ee.type==="session"&&Be&&n?.state!=="running")&&(rt(),S="stopped",I=!1,h=h.map(Le=>Le.status==="sent"?{...Le,status:"pending"}:Le)),ee.type==="error"&&ee.text&&(W=ee.text),vt()}))}async function Vt(ee,le){h=[...h,{id:Cte(),quote:ee,comment:le,status:"pending"}],x=null,C=!1,H(),ne(),ze();try{await ut(),await Oe(()=>Gee(e.theaterId,n.id,ee)),await zt()}catch{}}async function st(ee){h=h.filter(le=>le.id!==ee),ne(),ze(),R.hidden=!0;try{await zt()}catch{}}async function zt(){n&&await Oe(()=>P5(e.theaterId,n.id,h.map(W5)))}async function Ft(){if(j||n?.state==="running")return;const ee=h.filter(Fe=>Fe.status!=="done"),le=G.trim(),Be=le||(ee.length?vte:"");if(!Be)return;const Le={cancelled:!1,submitted:!1};U=Le,j=!0,h=ee.map(Fe=>({...Fe,status:"sent"})),Se(),p="",f="",m="",b=le,S="running",w=!1,G="",D=!1,z=!1,ne(),ze();try{if(await ut(),Le.cancelled||U!==Le||(await Oe(()=>P5(e.theaterId,n.id,h.map(W5))),Le.cancelled||U!==Le))return;Le.submitted=!0,await Oe(()=>Kee(e.theaterId,n.id,Be)),I=!0}catch{!Le.cancelled&&U===Le&&(I=!1,S="idle",h=h.map(Fe=>Fe.status==="sent"?{...Fe,status:"pending"}:Fe))}finally{!Le.cancelled&&U===Le&&(j=!1,U=null,ne())}}async function we(){if(!n)return;const ee=n.id;try{W="",await Xee(e.theaterId,ee)}catch(le){W=le instanceof Error?le.message:"Cowork request failed.",ne();return}i?.(),i=null,r=0,h=[],Se(),p="",f="",m="",b="",S="idle",w=!1,F=null,N=!1;try{await de(await B5(e.theaterId,e.entryId,u))}catch{n=null,vt()}}async function Oe(ee){try{W="",n=await ee(),vt()}catch(le){throw W=le instanceof eS&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(le.code)?"This entry changed or is busy. Your draft is safe; reopen the entry before applying.":le instanceof Error?le.message:"Cowork request failed.",vt(),le}}const cn=ee=>{if(C||n?.state==="running"||ee.target instanceof Node&&k.contains(ee.target))return;const le=window.getSelection(),Be=le?.toString().trim()??"";if(!Be||!le||le.rangeCount===0||!e.body.contains(le.anchorNode))return;const Le=le.getRangeAt(0).getBoundingClientRect(),Fe=e.article.getBoundingClientRect();x={quote:Be,top:Le.bottom-Fe.top+8,left:Math.min(Math.max(Le.left+Le.width/2-Fe.left,0),Math.max(Fe.width,0))},H()},ti=ee=>{if(ee.target instanceof Element){if(ee.target.closest(".cowork-pill")){ee.preventDefault();return}!k.contains(ee.target)&&x&&(x=null,C=!1,H())}},ni=ee=>{if(ee.target instanceof Element&&ee.target.closest(".cowork-revision-output")){ee.stopPropagation();return}if(ee.key==="Escape"){x||C?(x=null,C=!1,H()):(D||z||F)&&(D=!1,z=!1,F=null,ne());return}const le=ee.target;ee.key==="Enter"&&!ee.shiftKey&&le instanceof HTMLTextAreaElement&&le.classList.contains("cowork-composer-input")&&(ee.preventDefault(),We()),ee.key==="Enter"&&le instanceof HTMLInputElement&&le.name==="prompt"&&(ee.preventDefault(),Ft())},We=()=>{const ee=k.querySelector(".cowork-composer-input")?.value.trim()??"";x&&Vt(x.quote,ee)},gt=ee=>{if(!(ee.target instanceof Element))return;const le=ee.target.closest(".cowork-revision-output");le&&ee.stopPropagation();const Be=ee.target.closest('[data-action="copy-code"]');if(Be){const it=Be.closest("pre")?.getAttribute("data-code");if(!it)return;Ste(Be,it);return}if(le)return;const Le=ee.target.closest("[data-cowork-action]");if(!Le)return;const Fe=Le.dataset.coworkAction;if(Fe==="comment"&&(C=!0,H()),Fe==="cancel-comment"&&(x=null,C=!1,H()),Fe==="add-comment"&&We(),Fe==="toggle-panel"&&(D=!D,z=!1,ne()),Fe==="toggle-config"&&(z=!z,D=!1,ne()),Fe==="toggle-revision"){w=!w;const it=Le.closest(".cowork-revision-stream");it?.classList.toggle("is-collapsed",w),Le.setAttribute("aria-expanded",String(!w)),Le.setAttribute("aria-label",`${w?"Expand":"Collapse"} Cowork stream`),it?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(w))}if(Fe==="send"&&Ft(),Fe==="cancel-run"&&j&&U&&!U.submitted){U.cancelled=!0,j=!1,I=!1,S="stopped",h=h.map(it=>it.status==="sent"?{...it,status:"pending"}:it),ne(),ze();return}Fe==="toggle-diff"&&(N=!N,vt()),Fe==="delete-annotation"&&Le.dataset.annotationId&&st(Le.dataset.annotationId),Fe==="apply-arm"&&(F="apply",ne()),Fe==="discard-arm"&&(F="discard",ne()),Fe==="confirm-back"&&(F=null,ne()),Fe==="apply-confirm"&&n&&(F=null,Oe(()=>Yee(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Fe==="discard-confirm"&&we(),Fe==="cancel-run"&&n&&Oe(()=>Vee(e.theaterId,n.id)).then(()=>{S="stopped",h=h.map(it=>it.status==="sent"?{...it,status:"pending"}:it),ne()}).catch(()=>{})},xt=ee=>{const le=ee.target instanceof Element?ee.target.closest("mark.cowork-mark"):null;le?pt(le):R.hidden||(R.hidden=!0)},Tt=()=>{R.hidden=!0},$t=ee=>{const le=ee.target;if(le instanceof Element&&le.closest(".cowork-revision-output")){ee.stopPropagation();return}if(le instanceof HTMLInputElement&&le.name==="prompt"){G=le.value;return}if(le instanceof HTMLTextAreaElement&&le.dataset.coworkComment){const Be=le.dataset.coworkComment;h=h.map(Le=>Le.id===Be?{...Le,comment:le.value,status:"pending"}:Le)}},Cn=ee=>{const le=ee.target;if(le instanceof Element&&le.closest(".cowork-revision-output")){ee.stopPropagation();return}le instanceof HTMLTextAreaElement&&le.dataset.coworkComment&&zt().catch(()=>{})};return e.article.addEventListener("mouseup",cn),e.article.addEventListener("mousedown",ti),e.article.addEventListener("keydown",ni),e.article.addEventListener("click",gt),e.article.addEventListener("input",$t),e.article.addEventListener("change",Cn),e.article.addEventListener("mouseover",xt),e.article.addEventListener("mouseleave",Tt),{destroy(){t=!0,Se(),$(),i?.(),e.article.removeEventListener("mouseup",cn),e.article.removeEventListener("mousedown",ti),e.article.removeEventListener("keydown",ni),e.article.removeEventListener("click",gt),e.article.removeEventListener("input",$t),e.article.removeEventListener("change",Cn),e.article.removeEventListener("mouseover",xt),e.article.removeEventListener("mouseleave",Tt),k.remove(),T.remove(),R.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function Ste(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function wte(e,t){return gte(e,t).map(n=>{const i=Hs(n.markdown,{resolveWikiLink:r=>Kp(r)}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function W5(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||"Please revise this passage."}}function xte(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function Yv(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function q5(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function Cte(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function kte(){try{const e=JSON.parse(localStorage.getItem(h3)??"{}");return{cli:typeof e.cli=="string"?e.cli:"claude",model:typeof e.model=="string"?e.model:"",effort:typeof e.effort=="string"?e.effort:"medium"}}catch{return{cli:"claude",model:"",effort:"medium"}}}function Xv(e){try{localStorage.setItem(h3,JSON.stringify(e))}catch{}}const f3={create_wiki:"+",update_wiki:"↻"},p3={create_wiki:"Create",update_wiki:"Update"};function Ete(e,t){let n=!1,i=0,r=null,o=null,u=t,h="idle",p=null,f=null,m=null;vm(e);function _(N){const I=N.target;if(!(I instanceof Element))return;const j=I.closest("[data-patch-id]");if(j){N.preventDefault();const W=j.dataset.patchId||void 0;u.onPatchOpen?.(W);return}const U=I.closest("[data-entry-id]");if(U?.dataset.entryId){N.preventDefault(),u.onRelatedClick(U.dataset.entryId);return}const G=I.closest("[data-drydock-action]");if(G){N.preventDefault(),b(G.dataset.drydockAction);return}}function b(N){if(N){if(N==="back"){u.onPatchOpen?.(void 0);return}if(N==="approve"){h="approving",p=null,w();return}if(N==="approve-confirm"){S("approve",void 0);return}if(N==="reject"){h="rejecting",p=null,w();return}if(N==="reject-submit"){const I=e.querySelector("#queue-reject-reason")?.value.trim();if(!I){p="Rejection reason is required.",w();return}S("reject",I);return}if(N==="cancel"){h="idle",p=null,w();return}}}async function S(N,I){if(m){h="submitting",p=null,w();try{await Hee(u.theaterId,m,N,I),u.onDecided?.()}catch(j){h=N==="approve"?"approving":"rejecting",p=j instanceof Error?j.message:String(j),w()}}}function w(){const N=e.querySelector("[data-decision-bar-wrap]");N&&(N.innerHTML=m3(h,p))}e.addEventListener("click",_);function x(){o?.destroy(),o=null,r?.(),r=null}async function C(N){if(!n){Mf(e,t.tocContainer),x();try{const I=await Bee(u.theaterId,N);if(n)return;const{index:j}=Yl(),{html:U,toc:G}=Hs(I.body,{omitDuplicateTitle:I.frontmatter.title,resolveWikiLink:V=>Kp(V)});e.innerHTML=`
326
+ <article class="document">
327
+ <header class="document-header">
328
+ ${Tte(I.frontmatter.title)}
329
+ <h1>${Mt(I.frontmatter.title)}</h1>
330
+ ${lte(I.frontmatter)}
331
+ </header>
332
+ <div class="markdown-body" id="codex-reader-body">
333
+ ${U}
334
+ </div>
335
+ ${Ate(I.frontmatter.id,I.frontmatter.tags,j)}
336
+ </article>
337
+ `,t.tocContainer.innerHTML=Kv(G);const W=e.querySelector("article");W&&G.length>0&&(r=z5(W,G,t.tocContainer));const Z=e.querySelector("#codex-reader-body");W&&Z&&(o=bte({theaterId:u.theaterId,entryId:N,title:I.frontmatter.title,article:W,body:Z,onApplied:()=>{C(N)}}))}catch(I){n||jf(e,t.tocContainer,I)}}}async function D(N){if(!n){Mf(e,t.tocContainer),x(),f=null,m=null,h="idle",p=null;try{if(N){const I=await Pee(u.theaterId,N);if(n)return;f=I.meta,m=N;const{html:j,toc:U}=Hs(I.wikiEntry.body,{omitDuplicateTitle:I.wikiEntry.title,resolveWikiLink:W=>Kp(W)});e.innerHTML=Lte(I,j),t.tocContainer.innerHTML=Kv(U);const G=e.querySelector("article");G&&U.length>0&&(r=z5(G,U,t.tocContainer))}else{const I=await r3(u.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Rte(I.items,"Review queue — Pending patches")}}catch(I){n||jf(e,t.tocContainer,I)}}}async function z(N){if(!n){Mf(e,t.tocContainer),x();try{if(N){const I=await Uee(u.theaterId,N);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Ote(I)}else{const I=await Fee(u.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Dte(I)}}catch(I){n||jf(e,t.tocContainer,I)}}}async function F(N){const I=++i,j=u.theaterId;Mf(e,t.tocContainer),x();try{const U=await zee(j,N);if(n||I!==i||j!==u.theaterId)return;const{html:G,toc:W}=Hs(U.content);e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>Schema</span></li><li><span aria-current="page">${Mt(N??"Workspace schema")}</span></li></ol></nav><h1>${Mt(N??"Workspace schema")}</h1><span class="queue-dl-mono">${Mt(U.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${G}</div></article>`,t.tocContainer.innerHTML=Kv(W)}catch(U){!n&&I===i&&j===u.theaterId&&jf(e,t.tocContainer,U)}}return t.kind==="entry"&&t.initialEntryId?C(t.initialEntryId):t.kind==="drydock"?D(t.subId):t.kind==="conflicts"?z(t.subId):t.kind==="schema"&&F(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",_),x(),o?.destroy()},async setEntry(N){await C(N)},async navigateSub(N){t.kind==="drydock"?await D(N):t.kind==="conflicts"?await z(N):t.kind==="schema"&&await F(N)},refreshCallbacks(N){u={...u,...N}}}}function Mf(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function jf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${Mt(i)}</div>`,t.innerHTML=""}function Tte(e){return`
338
+ <nav class="breadcrumb" aria-label="Entry location">
339
+ <ol>
340
+ <li><span>Codex</span></li>
341
+ <li><span aria-current="page">${Mt(e)}</span></li>
342
+ </ol>
343
+ </nav>
344
+ `}function Ate(e,t,n){const i=new Set(t),r=n.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(u=>i.has(u))})).filter(o=>o.matchingTags.length>0).sort((o,u)=>u.matchingTags.length-o.matchingTags.length||o.entry.title.localeCompare(u.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return r.length===0?"":`
345
+ <section class="related-list">
346
+ <h2>Related entries</h2>
347
+ <div class="related-items">
348
+ ${r.map(o=>`<button class="related-card" type="button" data-entry-id="${sa(o.entry.id)}">
349
+ <strong>${Mt(o.entry.title)}</strong>
350
+ <span>${u3(o.matchingTags)}</span>
351
+ </button>`).join("")}
352
+ </div>
353
+ </section>
354
+ `}function Rte(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
355
+ <article class="document">
356
+ <header class="document-header">
357
+ <nav class="breadcrumb" aria-label="Entry location">
358
+ <ol>
359
+ <li><span>Codex</span></li>
360
+ <li><span aria-current="page">Review queue</span></li>
361
+ </ol>
362
+ </nav>
363
+ <h1>${Mt(t)}</h1>
364
+ </header>
365
+ <div class="queue-row-list">
366
+ ${e.map(Nte).join("")}
367
+ </div>
368
+ </article>
369
+ `}function Nte(e){const t=e.op??"create_wiki",n=f3[t]??"?",i=p3[t]??"Patch",r=e.target??e.id,u=[Ite(e.meta.createdAt)].filter(Boolean);return`
370
+ <button class="queue-row" type="button" data-patch-id="${sa(e.id)}" aria-label="${sa(i+": "+r)}">
371
+ <span class="queue-row-badge" aria-hidden="true">
372
+ <span class="op-badge">${n}</span>
373
+ </span>
374
+ <span class="queue-row-body">
375
+ <span class="queue-row-target">${Mt(r)}</span>
376
+ ${e.summary?`<span class="queue-row-summary">${Mt(e.summary)}</span>`:""}
377
+ ${u.length>0?`<span class="queue-row-meta">${u.map(Mt).join(" · ")}</span>`:""}
378
+ </span>
379
+ </button>
380
+ `}function Lte(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,u=n.frontmatter.op,h=f3[u]??"?",p=p3[u]??"Patch",f=o?"기존 문서 대체":"신규 문서 생성",m=i.status==="pending";return`
381
+ <article class="document">
382
+ <header class="document-header">
383
+ <nav class="breadcrumb" aria-label="Entry location">
384
+ <ol>
385
+ <li><span>Codex</span></li>
386
+ <li><span>Review queue</span></li>
387
+ <li><span aria-current="page">${Mt(p)}</span></li>
388
+ </ol>
389
+ </nav>
390
+ <button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
391
+ <h1><span class="op-badge">${h}</span> ${Mt(r.title)}</h1>
392
+ <p class="eyebrow">${Mt(n.frontmatter.target)} · v${r.version} · ${Mt(f)}</p>
393
+ ${Mte(n.frontmatter.proposer,r.tags)}
394
+ </header>
395
+ <div class="markdown-body" id="codex-reader-body">
396
+ ${t}
397
+ </div>
398
+ <div class="queue-decision-section" data-decision-bar-wrap>
399
+ ${m?m3("idle",null):jte(i)}
400
+ </div>
401
+ </article>
402
+ `}function Mte(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${Mt(e)}</span>`),t.length>0&&n.push(u3(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function m3(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
403
+ <p class="queue-decision-confirm">Apply this patch to the wiki?</p>
404
+ <div class="queue-action-buttons">
405
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
406
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
407
+ </div>
408
+ ${t?`<p class="queue-action-error">${Mt(t)}</p>`:""}
409
+ `:e==="rejecting"?`
410
+ <div class="queue-reject-form">
411
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
412
+ <div class="queue-action-buttons">
413
+ <button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
414
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
415
+ </div>
416
+ ${t?`<p class="queue-action-error">${Mt(t)}</p>`:""}
417
+ </div>
418
+ `:`
419
+ <div class="queue-action-buttons">
420
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
421
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
422
+ </div>
423
+ `}function jte(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${Mt(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function Ote(e){return`
424
+ <article class="document">
425
+ <header class="document-header">
426
+ <nav class="breadcrumb" aria-label="Entry location">
427
+ <ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
428
+ </nav>
429
+ <h1>${Mt(e.id)}</h1>
430
+ <p class="eyebrow">Conflict · ${Mt(e.meta?.status??"open")}</p>
431
+ </header>
432
+ <div class="markdown-body">
433
+ ${e.current?`<h2>Current</h2><pre><code>${Mt(e.current)}</code></pre>`:""}
434
+ ${e.proposed?`<h2>Proposed</h2><pre><code>${Mt(e.proposed)}</code></pre>`:""}
435
+ </div>
436
+ </article>
437
+ `}function Dte(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
438
+ <article class="document">
439
+ <header class="document-header">
440
+ <h1>Conflicts</h1>
441
+ </header>
442
+ <div class="markdown-body">
443
+ <ul class="queue-list">
444
+ ${e.map(t=>`<li class="queue-item">
445
+ <strong>${Mt(t.title||t.id)}</strong>
446
+ <span class="eyebrow">${Mt(t.status)}</span>
447
+ </li>`).join("")}
448
+ </ul>
449
+ </div>
450
+ </article>
451
+ `}function Ite(e){try{const n=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(n<1)return"< 1h ago";if(n<24)return`${Math.floor(n)}h ago`;const i=n/24;return i<7?`${Math.floor(i)}d ago`:i<30?`${Math.floor(i/7)}w ago`:`${Math.floor(i/30)}mo ago`}catch{return""}}let Po=null,Ld=null,g3=null,Qa=null,$o=null,Ya=null,ip=null,Zv=null,sp,d0=0;function G5(e){g3=e}function Bte(e,t){const n=zte();n.parentElement!==e&&e.appendChild(n),Ld||(Ld=ote(n,{initialTheaterId:t,onRequest:i=>g3?.(i)}))}function Pte(e){Ld?.setTheater(e)}function _3(e,t,n){const i=Hte(),r=Fte(),o=i.parentElement,u=n.kind==="entry"&&ip==="entry"&&n.initialEntryId===Zv;o&&o!==e&&(d0=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!Ya||ip!==n.kind?(Ya?.destroy(),Ya=Ete(i,{...n,tocContainer:r}),ip=n.kind,sp=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==Zv?Ya.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==sp&&(sp=n.subId,Ya.navigateSub(n.subId)),Zv=n.kind==="entry"?n.initialEntryId??null:null,Ya.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const h=u?d0:0;requestAnimationFrame(()=>{e.scrollTop=h})}function $te(){const e=Qa?.parentElement;e&&(d0=e.scrollTop)}function v3(){Ya?.destroy(),Ya=null,ip=null,sp=void 0,Qa?.parentElement&&Qa.parentElement.removeChild(Qa),$o?.parentElement&&$o.parentElement.removeChild($o)}function K5(){v3(),Ld?.destroy(),Ld=null,Po?.parentElement&&Po.parentElement.removeChild(Po)}function zte(){return Po||(Po=document.createElement("div"),Po.className="codex-host"),Po}function Hte(){return Qa||(Qa=document.createElement("div"),Qa.className="codex-reader-host"),Qa}function Fte(){return $o||($o=document.createElement("div"),$o.className="codex-toc-host"),$o}const Ute={id:"codex",title:"Codex",icon:()=>c.jsx(Vte,{}),render:e=>c.jsx(Wte,{theaterId:e.theaterId})};function Wte({theaterId:e}){const t=ir(),n=v.useRef(null),i=v.useRef(null),r=v.useRef(null),o=v.useRef(""),[u,h]=v.useState(null),p=t.codexReader,f=p!==null,m=t.codexReaderExpanded,_=t.theaters.find(D=>D.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=u?.contextKey===S&&u.hasWiki?u.id:null,x=w!==null,C=p?`${p.kind}:${p.kind==="entry"?p.entryId:p.kind==="drydock"?p.patchId??"":p.kind==="conflicts"?p.id??"":p.templateId??""}`:null;return v.useEffect(()=>{if(o.current=S,P_(),!e){h({contextKey:S,hasWiki:!1,id:null});return}Gte(e).then(D=>{o.current===S&&h({contextKey:S,...D})}).catch(()=>{o.current===S&&h({contextKey:S,hasWiki:!1,id:null})})},[S,e]),v.useEffect(()=>{u?.contextKey===S&&!u.hasWiki&&K5()},[S,u]),v.useEffect(()=>()=>K5(),[]),v.useEffect(()=>{if(!x||!w)return;const D=n.current;if(D)return Bte(D,w),G5(z=>{z.kind==="entry"?mr({kind:"entry",entryId:z.id}):z.kind==="drydock"?mr({kind:"drydock",patchId:z.patchId}):z.kind==="conflicts"?mr({kind:"conflicts",id:z.id}):z.kind==="schema"&&mr({kind:"schema",templateId:z.templateId})}),()=>{G5(null)}},[x,w,f]),v.useEffect(()=>{x&&w&&Pte(w)},[x,w]),v.useEffect(()=>{if(!x||!w||!f||m||!i.current||!r.current||!p)return;const D=p.kind,z=D==="drydock"?p.patchId:D==="conflicts"?p.id:D==="schema"?p.templateId:void 0;_3(i.current,r.current,{initialEntryId:D==="entry"?p.entryId:"",kind:D,subId:z,theaterId:w,onRelatedClick:F=>mr({kind:"entry",entryId:F}),onClose:()=>P_(),onPatchOpen:F=>mr({kind:"drydock",patchId:F}),onDecided:()=>{Gp(),mr({kind:"drydock",patchId:void 0})}})},[x,w,f,m,C]),v.useEffect(()=>{f||v3()},[f]),x?f?c.jsxs("div",{className:"codex-rail-host is-split",children:[c.jsxs("div",{className:"codex-doc-pane",children:[c.jsxs("div",{className:"codex-doc-pane-head",children:[c.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:$f,children:"⤢ Expand"}),c.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:P_,children:"✕"})]}),c.jsx("div",{ref:i,className:"codex-doc-scroll"}),c.jsx("div",{ref:r,className:"codex-doc-toc-inline"})]}),c.jsx("div",{ref:n,className:"codex-nav-pane"})]}):c.jsx("div",{ref:n,className:"codex-rail-host"}):c.jsx(qte,{activeTheater:_,hasTheaters:b})}function qte({activeTheater:e,hasTheaters:t}){return t?c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),c.jsx("h1",{children:e?.label||"This Theater"}),c.jsx("p",{children:"Fleet Wiki data could not be loaded for this Theater."})]}):c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),c.jsx("h1",{children:"Add a Theater"}),c.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function Gte(e){const t=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!t.ok)throw new Error("codex_workspace_unavailable");return Kte(await t.json())}function Kte(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 Vte(){return c.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:[c.jsx("circle",{cx:"12",cy:"12",r:"9"}),c.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),c.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),c.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function Yte(e,t,n){const i=t.trim().toLocaleLowerCase();return e.filter(r=>i===""||r.name.toLocaleLowerCase().includes(i)||r.title.toLocaleLowerCase().includes(i)?n==="all"?!0:r.tasksTotal<=0?!1:n==="complete"?r.tasksDone>=r.tasksTotal:r.tasksDone<r.tasksTotal:!1)}function Xte(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function h0(e){return e.replace(/\s+/g," ").trim()}function Zte(e,t){const n=i=>h0(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function y3(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"Unknown";const i=Math.max(0,Math.floor((t-n)/1e3));if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Jte(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 Qte(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function ene(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function tne(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(ene)?"ready":"blocked"}const nne="plans-changed",ine=3e4;function sne(e,t){let n=null,i=null,r=!1,o=!0;const u=()=>{const h=o;o=!1;let p=0;n=new EventSource(`/api/v1/plans/events?theaterId=${encodeURIComponent(e)}`),n.addEventListener(nne,()=>{t()}),n.onopen=()=>{p+=1,h&&p===1||t()},n.onerror=()=>{n?.readyState!==EventSource.CLOSED||i!==null||(r||t(),i=setTimeout(()=>{i=null,r||u()},ine))}};return u(),()=>{r=!0,i!==null&&clearTimeout(i),n?.close()}}const rne=360,ane={id:"plans",title:"Plans",icon:hne,render:e=>c.jsx(one,{...e})};function one(e){const t=e.theaterId;return c.jsx(lne,{...e},t)}function lne(e){const{requestExtraWidth:t,theaterId:n}=e,[i,r]=v.useState({kind:"no-theater"}),[o,u]=v.useState({kind:"loading"}),[h,p]=v.useState(null),[f,m]=v.useState(0),[_,b]=v.useState(0),[S,w]=v.useState(()=>new Set),x=v.useRef(0),C=v.useRef(0),D=v.useRef(null),z=v.useRef(o),F=v.useRef(null),N=v.useRef(!1),I=v.useRef(!1),j=v.useRef(!1),U=v.useRef(null),G=v.useRef(null),W=h?.theaterId===n?h.name:null;v.useEffect(()=>{U.current=W},[W]),v.useEffect(()=>{const M=++x.current;if(!n){r({kind:"no-theater"});return}const k=D.current!==null,T=j.current;j.current=!1,k||r({kind:"loading"}),aD(n).then(R=>{if(M!==x.current)return;const $=new Map(R.plans.map(q=>[q.name,Xte(q)])),K=D.current;if(K){const q=new Set(R.plans.filter(H=>K.get(H.name)!==$.get(H.name)).map(H=>H.name));q.size>0&&(G.current&&clearTimeout(G.current),w(q),G.current=setTimeout(()=>w(new Set),1200))}D.current=$,r({kind:"ready",plans:R.plans});const L=U.current;L&&($.has(L)?$.get(L)!==F.current&&b(q=>q+1):(F.current!==null||!N.current)&&(F.current=null,I.current=!0,b(q=>q+1)))}).catch(()=>{M===x.current&&(!k||T)&&r({kind:"error"})})},[n,f]),v.useEffect(()=>{const M=++C.current;if(!n||!W)return;N.current=!0,F.current=D.current?.get(W)??null;const k=I.current;I.current=!1,!k&&z.current.kind==="ready"&&z.current.plan.name===W||(z.current={kind:"loading"},u({kind:"loading"})),oD(n,W).then(R=>{if(M===C.current){N.current=!1,F.current=D.current?.get(R.name)??null;const $={kind:"ready",plan:R};z.current=$,u($)}}).catch(()=>{M===C.current&&(N.current=!1,F.current=null,z.current={kind:"error"},u({kind:"error"}))})},[_,W,n]),v.useEffect(()=>{if(n)return sne(n,()=>{m(M=>M+1)})},[n]),v.useEffect(()=>()=>{G.current&&clearTimeout(G.current)},[]),v.useLayoutEffect(()=>(t?.(W?rne:null),()=>t?.(null)),[t,W]);const Z=v.useCallback(M=>{n&&p({theaterId:n,name:M})},[n]),V=v.useCallback(()=>{p(null),N.current=!1,F.current=null,z.current={kind:"loading"},u({kind:"loading"})},[]),A=v.useCallback(()=>{j.current=!0,m(M=>M+1)},[]),B=v.useCallback(()=>b(M=>M+1),[]);return c.jsx("div",{className:"plans-panel-shell",children:c.jsxs("div",{className:`plans-root${W?" is-reader-open":""}`,onKeyDown:M=>{M.key==="Escape"&&W&&V()},children:[W&&c.jsx(une,{state:o,onClose:V,onRetry:B}),W&&c.jsx("div",{className:"plans-divider","aria-hidden":"true"}),c.jsx(cne,{selectedName:W,state:i,onRetry:A,onSelect:Z,pulsedNames:S})]})})}function cne({selectedName:e,state:t,onRetry:n,onSelect:i,pulsedNames:r}){const[o,u]=v.useState(""),[h,p]=v.useState("all"),[f,m]=v.useState(null),_=v.useRef(new Map);if(t.kind==="no-theater")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Jv,{children:"Select a Theater to browse plans."})});if(t.kind==="loading")return c.jsx("div",{className:"plans-list-pane",children:c.jsx("div",{className:"plans-loading",children:"Loading plans…"})});if(t.kind==="error")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(b3,{message:"Unable to load plans.",onRetry:n})});if(t.plans.length===0)return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Jv,{detail:"Workspace-scoped Fleet Plans appear here.",children:"No plans yet."})});const b=Yte(t.plans,o,h),S=(C,D)=>{const z=(C+D+b.length)%b.length;_.current.get(b[z]?.name??"")?.focus()},w=(C,D)=>{(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),S(D,C.key==="ArrowDown"?1:-1))},x=(C,D)=>{C.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${D}`).then(()=>{m(D),window.setTimeout(()=>m(z=>z===D?null:z),1200)}).catch(()=>{})};return c.jsxs("div",{className:"plans-list-pane",children:[c.jsxs("div",{className:"plans-toolbar",children:[c.jsxs("label",{className:"plans-search-label",children:[c.jsx("span",{children:"Search plans"}),c.jsx("input",{className:"plans-search",value:o,onChange:C=>u(C.target.value)})]}),c.jsx("div",{className:"plans-filter-group","aria-label":"Plan status",children:["all","in-progress","complete"].map(C=>c.jsx("button",{type:"button",className:`plans-filter${h===C?" is-active":""}`,"aria-pressed":h===C,onClick:()=>p(C),children:C==="all"?"ALL":C==="in-progress"?"IN PROGRESS":"COMPLETE"},C))}),c.jsx("button",{type:"button",className:"plans-refresh",onClick:n,children:"REFRESH"})]}),c.jsxs("div",{className:"plans-list","aria-label":"Plans",children:[b.length===0&&c.jsx(Jv,{children:"No matching plans."}),b.map((C,D)=>{const z=Jte(C.tasksDone,C.tasksTotal),F=z===100;return c.jsxs("div",{className:`plans-row${e===C.name?" is-selected":""}${r.has(C.name)?" is-pulsing":""}`,children:[c.jsxs("button",{ref:N=>{N?_.current.set(C.name,N):_.current.delete(C.name)},type:"button",className:"plans-row-select",onClick:()=>i(C.name),onKeyDown:N=>w(N,D),children:[c.jsx("span",{className:"plans-row-name",children:C.name}),c.jsxs("span",{className:"plans-row-meta",children:[C.waveCount," waves · ",C.tasksDone,"/",C.tasksTotal," tasks · ",y3(C.updatedAt),C.executionMode==="parallel"?" · parallel":""]}),z!==null&&c.jsx("span",{className:"plans-progress-track","aria-label":`${z}% complete`,children:c.jsx("span",{className:`plans-progress-fill${F?" is-complete":""}`,style:{width:`${z}%`}})})]}),c.jsx("button",{type:"button",className:"plans-copy",onClick:N=>x(N,C.name),"aria-label":f===C.name?`Copied plans/${C.name}`:`Copy plans/${C.name}`,children:f===C.name?"COPIED":"COPY"})]},C.name)})]})]})}function une({state:e,onClose:t,onRetry:n}){return e.kind==="loading"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:"Plan"}),c.jsx(f0,{onClose:t})]}),c.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:"Plan"}),c.jsx(f0,{onClose:t})]}),c.jsx(b3,{message:"Unable to load plan.",onRetry:n})]}):c.jsx(dne,{plan:e.plan,onClose:t})}function dne({plan:e,onClose:t}){const n=v.useMemo(()=>{const h=new DOMParser().parseFromString(Hs(e.content).html,"text/html");return Qv(h.body),h.body.innerHTML},[e.content]),i=v.useRef(null),r=v.useRef(null),o=v.useCallback((h,p)=>{const f=i.current;if(!f)return;const m=[...f.querySelectorAll(h)].find(b=>h==="h3"?Zte(b.textContent??"",p):h0(b.textContent??"")===h0(p));if(!m)return;const _=window.matchMedia("(prefers-reduced-motion: reduce)").matches;m.scrollIntoView({behavior:_?"auto":"smooth",block:"start"}),m.classList.remove("plans-heading-flash"),m.getBoundingClientRect(),m.classList.add("plans-heading-flash"),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>m.classList.remove("plans-heading-flash"),1200)},[]),u=v.useCallback(h=>{const p=h.target.closest('[data-action="copy-code"]');if(!p)return;const f=p.closest("pre")?.getAttribute("data-code");if(!f)return;navigator.clipboard?.writeText(f);const m=p.textContent;p.textContent="Copied",window.setTimeout(()=>{p.textContent=m},1200)},[]);return v.useEffect(()=>{const h=i.current;if(!h)return;vm(h),Qv(h);const p=new MutationObserver(()=>Qv(h));return p.observe(h,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>p.disconnect()},[n]),v.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsxs("div",{className:"plans-reader-heading",children:[c.jsx("h2",{className:"plans-reader-title",children:e.title}),c.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&c.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",y3(e.updatedAt)]})]}),c.jsx(f0,{onClose:t})]}),c.jsxs("div",{className:"plans-reader-body",children:[c.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((h,p)=>{const f=Qte(h.tasksDone,h.tasksTotal);return c.jsxs("div",{className:`plans-wave is-${f}`,children:[c.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>o("h2",h.heading),children:h.heading}),h.tasksTotal>0&&c.jsxs("span",{className:"plans-wave-count",children:[h.tasksDone,"/",h.tasksTotal]}),h.lanes.length>0&&c.jsx("div",{className:"plans-lane-list",children:h.lanes.map((m,_)=>{const b=tne(e.waves,p,m);return c.jsxs("div",{className:`plans-lane is-${b}`,children:[c.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>o("h3",m.heading),children:m.id??m.heading}),m.tasksTotal>0&&c.jsxs("span",{className:"plans-lane-count",children:[m.tasksDone,"/",m.tasksTotal]}),b==="ready"&&c.jsx("span",{className:"plans-lane-ready",children:"READY"})]},m.id??`${h.index}-${_}`)})})]},h.index)})}),c.jsx("div",{ref:i,className:"plans-markdown markdown-body",onClick:u,dangerouslySetInnerHTML:{__html:n}})]})]})}function f0({onClose:e}){return c.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Jv({children:e,detail:t}){return c.jsxs("div",{className:"plans-empty",children:[c.jsx("span",{children:e}),t&&c.jsx("span",{className:"plans-empty-detail",children:t})]})}function b3({message:e,onRetry:t}){return c.jsxs("div",{className:"plans-error-state",children:[c.jsx("span",{children:e}),c.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Qv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(n)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const n=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),i=t.tagName==="IMG"?"Image":"Media",r=t.ownerDocument.createElement("span");r.className="plans-md-blocked-image",r.textContent=n?`${i} blocked: ${n}`:`${i} blocked`,t.replaceWith(r)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const n=t.getAttribute("href")??t.getAttribute("xlink:href")??"";n!==""&&!n.startsWith("#")&&t.remove()}}function hne(){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[c.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),c.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 S3=[Ree,Ute,ane];function fne(e="right"){const{railPanels:t}=Mc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const pne=360;function mne(e){const{codexReader:t}=ir();return e==="codex"&&t!==null?pne:0}const w3=240,gne=312,x3="fleet-console.rail.panelWidth",V5="Theater";function _ne(){try{const e=localStorage.getItem(x3);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=w3)return t}}catch{}return gne}function vne({theaterId:e,api:t}){const n=v.useSyncExternalStore(cA,()=>Xo().theaters.find(W=>W.id===e)?.label??V5,()=>V5),i=v.useRef(null),r=UA(),o=WA(),u=_B(),h=v.useRef(o),p=v.useRef(u),f=fne(),m=S3,b=[...m,...f].find(W=>W.id===r)??null,S=b!==null,w=mne(r)+(b?.preferredExtraWidth??0)+gB(),x=v.useRef(w);x.current=w;const[C,D]=v.useState(_ne),z=v.useRef(C),[F,N]=v.useState(!1),[I,j]=v.useState(!1);v.useLayoutEffect(()=>{h.current&&!o&&SA(i.current,".command-band-rail-toggle"),h.current=o},[o]),v.useLayoutEffect(()=>{if(p.current===u)return;p.current=u,j(!0);let W=null;const Z=window.requestAnimationFrame(()=>{W=window.requestAnimationFrame(()=>j(!1))});return()=>{window.cancelAnimationFrame(Z),W!==null&&window.cancelAnimationFrame(W)}},[u]);const U=v.useCallback(W=>{W.preventDefault();const Z=W.clientX,V=z.current;N(!0);const O=B=>{const M=Z-B.clientX,k=window.innerWidth-148-x.current,T=Math.max(w3,Math.min(k,V+M));z.current=T,D(T)},A=()=>{document.removeEventListener("pointermove",O),document.removeEventListener("pointerup",A),N(!1);try{localStorage.setItem(x3,String(z.current))}catch{}};document.addEventListener("pointermove",O),document.addEventListener("pointerup",A)},[]),G=v.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:n},api:t,requestExtraWidth:W=>{r!==null&&mB(r,W)}}),[e,n,t,r]);return c.jsxs("div",{ref:i,className:`right-rail${S?" is-open":""}${o?" is-expanded":" is-closed"}${F?" is-dragging":""}${I?" is-switching":""}${u==="overlay"?" is-overlay":""}`,"data-rail-chrome":o?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!o,style:{"--right-rail-panel-width":`${S?C+w:0}px`},children:[c.jsxs("div",{className:"right-rail-panel-slot",children:[S&&c.jsx("div",{className:"right-rail-resize-handle",onPointerDown:U,"aria-hidden":"true"}),b&&c.jsx(yne,{activePanel:b,activeId:r,ctx:G,panelBehavior:u})]}),c.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:c.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[m.map(W=>c.jsx(Y5,{panel:W,isActive:r===W.id},W.id)),m.length>0&&f.length>0?c.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,f.map(W=>c.jsx(Y5,{panel:W,isActive:r===W.id},W.id))]})})]})}const yne=v.memo(function({activePanel:t,activeId:n,ctx:i,panelBehavior:r}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"right-rail-panel-head",children:[c.jsx("span",{className:"right-rail-panel-title",children:t.title}),c.jsx("button",{className:`right-rail-float-toggle${r==="overlay"?" is-active":""}`,type:"button","aria-pressed":r==="overlay","aria-label":"Float panel over the Map",onClick:pB,children:"Float over Map"}),c.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:hB,children:"✕"})]}),c.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:t.render(i)})]})});function Y5({panel:e,isActive:t}){const n=v.useCallback(()=>uB(e.id),[e.id]),i=typeof e.icon=="function"?e.icon():e.icon;return c.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:n,children:i})}const bne='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Sne(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=ir(),i=v.useRef(null),r=v.useRef(null),o=v.useRef(null),u=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.kind==="conflicts"?e.id??"":e.templateId??""}`:null,h=e!==null&&t,p=v.useCallback(()=>{$te(),e8()},[]);return v.useEffect(()=>{if(!h)return;const f=e;document.body.setAttribute("data-codex-reading","true");const m=document.querySelector(".operations-canvas"),_=document.querySelector(".operations-side-bar");m?.setAttribute("inert",""),_?.setAttribute("inert","");const b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&wne(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0),document.body.removeAttribute("data-codex-reading"),m?.removeAttribute("inert"),_?.removeAttribute("inert");const S=f?.kind==="entry"?f.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(S?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${S}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[h]),v.useEffect(()=>{if(!h||!r.current||!o.current||!e)return;const f=e.kind,m=f==="drydock"?e.patchId:f==="conflicts"?e.id:f==="schema"?e.templateId:void 0;_3(r.current,o.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:m,theaterId:n,onRelatedClick:_=>{mr({kind:"entry",entryId:_}),$f()},onClose:p,onPatchOpen:_=>{mr({kind:"drydock",patchId:_}),$f()},onDecided:()=>{Gp(),mr({kind:"drydock",patchId:void 0}),$f()}}),requestAnimationFrame(()=>{i.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[h,u]),h?aa.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),c.jsxs("div",{ref:i,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[c.jsxs("div",{className:"codex-reading-sheet-head",children:[c.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),c.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:p,children:"✕"})]}),c.jsxs("div",{className:"codex-reading-sheet-body",children:[c.jsx("div",{ref:r,className:"codex-reading-sheet-read"}),c.jsx("aside",{ref:o,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function wne(e,t){if(!e)return;const n=[...e.querySelectorAll(bne)].filter(o=>!o.closest("[inert]"));if(n.length===0)return;const i=n[0],r=n[n.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),i.focus())}const Of=wm().api,p0=560,m0=360,rp=new Set;function xne({state:e,claimBootPanelMinimization:t}){const n=v.useRef(null),i=zT(),r=HT(),o=Qp(),u=UT(),h=Mc(),[p,f]=v.useState([]),m=v.useMemo(()=>Cne(e).map(T=>T.id),[e.operations,e.activeTheaterId]),_=v.useRef(e),b=v.useRef(0);_.current=e,v.useEffect(()=>{tI(e.activeTheaterId)},[e.activeTheaterId]),v.useEffect(()=>{if(!e.activeTheaterId){f([]);return}Q5().then(f).catch(()=>{})},[e.activeTheaterId]),v.useEffect(()=>{const T=R=>{if(!F8()||!R.altKey||R.metaKey||R.ctrlKey)return;const $=document.activeElement;if($ instanceof HTMLElement&&$.matches("input, textarea, [contenteditable='true']")&&!$.closest(".xterm"))return;if(R.code==="KeyS"&&!R.shiftKey){R.preventDefault(),R.stopImmediatePropagation(),Ry();return}if(R.code==="KeyF"&&!R.shiftKey){R.preventDefault(),R.stopImmediatePropagation(),sI();return}if(R.shiftKey||R.key!=="ArrowLeft"&&R.key!=="ArrowRight")return;const K=_.current,L=gr(),q=K.operations.filter(Se=>Se.theaterId===K.activeTheaterId),H=Ny()?QI(q,L.operationOrder,K.operationStatus,L.minimized):ZI(q,K.groups.filter(Se=>Se.theaterId===K.activeTheaterId),L.operationOrder,L.collapsedGroups,L.minimized);if(R.preventDefault(),R.stopImmediatePropagation(),H.length===0)return;const ne=Ps()??yr()??_.current.activeOperationId,oe=XI(H,ne,R.key==="ArrowRight"?1:-1);oe&&ey(oe,h.operationKinds,Of,b,()=>_c(oe))};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[r,o,i,h.operationKinds]),v.useEffect(()=>{for(const $ of m)QD($);if(!e.operationsHydrated||(eI(m),!e.activeTheaterId))return;const T=t(e.activeTheaterId);if(T===null)return;const R=new Set([_.current.pendingOperationFocus,Ps(),yr()].filter($=>$!==null));JD(T.filter($=>!R.has($)))},[t,m,e.activeTheaterId,e.operationsHydrated]);const S=v.useCallback(T=>{const R=_.current.operations.find(H=>H.id===T);if(!R)return;const $=gr(),K=$.operations[T]??R.geometry??Ene(R);$.operations[T]||gy(T,K),$.minimized.includes(T)&&o0(T),_y(T),Bi(T);const q=kne(n.current);q&&nI(T,q)},[]);v.useEffect(()=>{const T=e.pendingOperationFocus;T!==null&&(ey(T,h.operationKinds,Of,b,()=>S(T)),FI())},[S,h.operationKinds,e.pendingOperationFocus]);const w=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(T=>T.theaterId===e.activeTheaterId);const x=v.useCallback((T,R)=>h.plugins.find(K=>K.id===T)?.renderLaunchIcon?.(R)??null,[h.plugins]),C=v.useCallback((T,R,$)=>{if(!_.current.activeTheaterId)return;const K={...X5($),zIndex:Yo()};ty(T,R,K,_.current.activeTheaterId,h.plugins)},[h.plugins]),D=v.useCallback((T,R)=>{if(!_.current.activeTheaterId)return;const $=Tne(n.current),K={...X5($),zIndex:Yo()};ty(T,R,K,_.current.activeTheaterId,h.plugins)},[h.plugins]),z=v.useCallback((T,R,$)=>{_.current.activeTheaterId&&ty(T,R,$,_.current.activeTheaterId,h.plugins)},[h.plugins]),F=v.useCallback(T=>{const R=_.current.operations.find($=>$.id===T);if(R){if(R.theaterId!==_.current.activeTheaterId){b.current+=1,_c(T);return}ey(T,h.operationKinds,Of,b,()=>S(T))}},[S,h.operationKinds]),N=v.useCallback(T=>{_.current.activeOperationId===T&&Bi(null),XM(T),GT(T)},[]),I=v.useCallback((T,R)=>{Pf(T,{accent:R}).then(()=>Qi(null)).then(ms).catch(()=>{})},[]),j=v.useCallback((T,R)=>{AT(T,R).then(()=>Qi(null)).then(ms).catch(()=>{})},[]),U=v.useCallback((T,R)=>{Pf(T,{groupId:R}).then(()=>Qi(null)).then(ms).catch(()=>{})},[]),G=v.useCallback((T,R,$)=>{cD({theaterId:T,name:R,color:"blue"}).then(K=>$?Pf($,{groupId:K.id}).then(()=>{}):void 0).then(()=>Promise.all([Qi(null).then(ms),Mo().then(jo)])).catch(()=>{})},[]),W=v.useCallback((T,R)=>{R&&O_(T,{color:R}).then(()=>Mo()).then(jo).catch(()=>{})},[]),Z=v.useCallback((T,R)=>{O_(T,{name:R}).then(()=>Mo()).then(jo).catch(()=>{})},[]),V=v.useCallback(T=>{const R=new Map(_.current.groups.map(K=>[K.id,K])),$=T.flatMap((K,L)=>{const q=R.get(K);return!q||q.order===L?[]:[O_(K,{order:L})]});$.length!==0&&Promise.allSettled($).then(()=>Mo()).then(jo).catch(()=>{})},[]),O=v.useCallback(T=>{const R=new Map(_.current.theaters.map(K=>[K.id,K])),$=T.flatMap((K,L)=>{const q=R.get(K);return!q||q.order===L?[]:[sD(K,L)]});$.length!==0&&Promise.allSettled($).then(()=>YC(null)).then(xy).catch(()=>{})},[]),A=v.useCallback(T=>{uD(T).then(()=>Promise.all([Qi(null).then(ms),Mo().then(jo)])).catch(()=>{})},[]),B=v.useCallback(T=>{if(rp.has(T))return;Ps()===T&&tr(),rp.add(T);const R=_.current.operations.find(K=>K.id===T)?.pluginId,$=(R?h.plugins.find(K=>K.id===R):null)??null;Ane(T,$).finally(()=>rp.delete(T))},[h.plugins]),M=v.useCallback(async T=>{dA();try{const R=await TT(T),$=await ET(R);hA($),YC(null).then(xy).catch(()=>{})}catch(R){Cy(R instanceof Error?R.message:String(R))}},[]),k=v.useCallback(async T=>{const R=()=>Promise.all([Qi(null).then(ms),Mo().then(jo)]).then(()=>{}).catch(()=>{});try{await lD(T),uk(T),await R()}catch($){if($ instanceof pn&&$.status===404){uk(T),await R();return}Cy($ instanceof Error?$.message:String($))}},[]);return c.jsxs("div",{className:"console-body is-canvas",children:[c.jsx(G7,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:u,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:p,canLaunch:w,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:x,onLaunchKind:D,onClose:B,onMinimize:N,onFocus:F,onSetAccent:I,onRename:j,onSetGroupId:U,onCreateGroup:G,onSetGroupColor:W,onRenameGroup:Z,onReorderGroups:V,onReorderTheaters:O,onUngroupAll:A,onSelectTheater:z0,onAddTheater:M,onCancelAddTheater:HI,onForgetTheater:k}),c.jsx("div",{className:"operations-center-stage",ref:n,children:c.jsx(_ee,{state:e,catalog:p,canLaunch:w,renderKindIcon:x,onLaunchKind:C,onLaunchAtGeometry:z,onClose:B,onFocus:F,onRename:j,onSetAccent:I})}),c.jsx(vne,{theaterId:e.activeTheaterId,api:Of}),c.jsx(Sne,{})]})}async function ey(e,t,n,i,r){const o=++i.current,u=ek(),h=Ps();if(h!==null){if(h===e){Bi(e),To(e);return}const p=Xo().operations.find(b=>b.id===e),f=gr().minimized.includes(e),m=p&&t.find(b=>b.pluginId===p.pluginId&&b.type===p.type);let _=!0;if(p&&m?.companions?.length&&m.canOpenCompanions){try{_=await m.canOpenCompanions({api:n,operation:p})}catch{_=!1}const b=Xo(),S=b.operations.find(x=>x.id===e),w=!f&&gr().minimized.includes(e);if(i.current!==o||ek()!==u||Ps()!==h||b.activeTheaterId!==p.theaterId||$T()!==p.theaterId||w||rp.has(e)||!S||S.pluginId!==p.pluginId||S.type!==p.type||S.theaterId!==p.theaterId)return}if(p&&(!m||!m.companions?.length||!_)){if(tr(),mp()){gr().minimized.includes(e)&&o0(e),_y(e),Bi(e),To(e);return}r(),To(e);return}Bi(e),KT(e),To(e);return}if(yr()!==null){Bi(e),L0(e),To(e);return}if(mp()){gr().minimized.includes(e)&&o0(e),_y(e),Bi(e),To(e);return}r(),To(e)}function Cne(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(ky)}function kne(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Ene(e){return e.geometry??{x:0,y:0,width:p0,height:m0,zIndex:0}}function Tne(e){const t=gr(),n=e?.clientWidth??800,i=e?.clientHeight??600;return Nd({x:n/2,y:i/2},t.viewport)}function X5(e){return{x:e.x-p0/2,y:e.y-m0/2,width:p0,height:m0}}async function ty(e,t,n,i,r){const o=r.find(_=>_.id===e),h=wm(()=>{Qi(null).then(ms).catch(()=>{})});let p=null;if(o?.launch?p=(await o.launch({theaterId:i,kind:t,geometry:n,operations:h.operations})).id:p=(await h.operations.create({theaterId:i,type:t.type,pluginId:e,title:t.title,geometry:n})).id,await Qi(null).then(ms).catch(()=>{}),!p)return;const f=$T()===i,m=Xo().operations.some(_=>_.id===p);GD(i)===null&&(f&&m&&yr()!==null?(Bi(p),L0(p)):_c(p))}async function Ane(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Qi(null).then(ms).catch(()=>{})}const Rne=3e4;let Df=1e3,Vu=null,ny=null,iy=!1;function C3(){Vu!==null&&(clearTimeout(Vu),Vu=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);Nne(i.operation)&&PI(i.operation)}catch{}}),e.addEventListener("update:available",()=>{Md()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{zM(JSON.parse(n.data))}catch{m5()}}),e.onopen=()=>{Df=1e3,Md()},e.onerror=()=>{e.close(),m5(),Vu=setTimeout(()=>{Vu=null,Df=Math.min(Df*2,Rne),Qi().then(ms).catch(()=>{}).finally(C3)},Df)}}function Md(){if(ny){iy=!0;return}ny=eD(Xo().activeTheaterId).then(RI).catch(()=>{}).finally(()=>{ny=null,iy&&(iy=!1,Md())})}function Nne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Lne=6e3;function Mne(){const e=ir(),t=v.useRef(new Set),n=v.useRef(null),i=vs(),r=Mc(),o=Jp(),u=WM(o.state?.language??"auto"),p=i.pathname.startsWith("/operations"),f=v.useMemo(()=>[...S3,...r.railPanels.filter(b=>(b.side??"right")==="right")].map(b=>({id:b.id,title:b.title})),[r.railPanels]),m=v.useCallback(b=>n.current===null||t.current.has(b)?null:(t.current.add(b),n.current),[]);v.useEffect(()=>{const b=wm(()=>{Qi().then(ms).catch(()=>{})}),S=r.plugins.map(w=>w.install?.(b)).filter(w=>typeof w=="function");return()=>{for(const w of S)w()}},[r.plugins]),v.useEffect(()=>{AI(p)},[p]),v.useEffect(()=>{const b=new AbortController;kT(b.signal).then(x=>{II(x),ck()}).catch(x=>{b.signal.aborted||(ht({theaterError:x instanceof Error?x.message:String(x)}),ck())});const S=Date.now();Qi(null,b.signal).then(x=>{n.current=x.filter(C=>C.ts.createdAt<S).map(C=>C.id),BI(x)}).catch(()=>{}),Mo(null,b.signal).then(jo).catch(()=>{}),Md();const w=window.setTimeout(Md,Lne);return()=>{window.clearTimeout(w),b.abort()}},[]),v.useEffect(()=>(UM({locale:u}),qJ),[u]);const _=v.useRef(null);return v.useLayoutEffect(()=>{e.keyboardShortcutsOpen&&(_.current=MJ()??(document.activeElement instanceof HTMLElement?document.activeElement:null))},[e.keyboardShortcutsOpen]),v.useEffect(()=>{if(e.keyboardShortcutsOpen)return;const b=_.current;_.current=null,b?.isConnected&&b.focus()},[e.keyboardShortcutsOpen]),v.useEffect(()=>aQ({getSideBarCollapsed:()=>vp().collapsed,setSideBarCollapsed:sc,toggleOperationSearch:fA,toggleRailChrome:X0}),[]),c.jsxs("div",{className:"console-shell",children:[c.jsx(yJ,{operationsViewVisible:p}),c.jsx("main",{className:"console-route-content",children:c.jsxs(yO,{children:[c.jsx(Fl,{path:"/",element:c.jsx(M_,{to:"/operations",replace:!0})}),c.jsx(Fl,{path:"/operations",element:c.jsx(xne,{state:e,claimBootPanelMinimization:m})}),c.jsx(Fl,{path:"/carrier-settings",element:c.jsx(M_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),c.jsx(Fl,{path:"/settings",element:c.jsx(CQ,{})}),c.jsx(Fl,{path:"*",element:c.jsx(M_,{to:"/operations",replace:!0})})]})}),c.jsx(PJ,{state:e,railPanels:f}),e.keyboardShortcutsOpen?c.jsx(kA,{onClose:YI}):null,c.jsx(JJ,{state:e}),c.jsx(RJ,{state:e}),c.jsx(WJ,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:ap,"react/jsx-runtime":L4,"@fleet-console/sdk/plugin/browser":Z4,"@fleet-console/sdk/settings/browser":fj,"@fleet-console/sdk/operations/browser":$4,"@fleet-console/sdk/notifications/browser":mj,"@fleet-console/sdk/react/browser":_j};gc("instrument");OI();const k3=()=>{document.documentElement.classList.toggle("reduce-panel-motion",hc().state?.reducePanelMotion===!0)};DT(k3);k3();try{const e=await MT();gc(e.theme),wy(e.uiFont),OD(e)}catch{}const jne=await aJ();C3();const Z5=document.querySelector("#app");Z5&&aT.createRoot(Z5).render(c.jsx(v.StrictMode,{children:c.jsx(UO,{basename:"/console",children:c.jsx(rJ,{value:jne,children:c.jsx(Mne,{})})})}));export{FU as _,One as a,g0 as g,ln as k,fd as p};